Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

xpost from master products thread...

 

Has anyone got QTPro and Master Products working together? I have some products that I'd like to track a la QTPro and some one-offs that I like to display the way master products looks. I also want to get rid of any 'out of stock' referencing and the drop-down quantity box on non-master products, which is taking some effort...

 

I've got it functioning to a point where the qtpro bit seems to work but now if I try to add a slave product to the cart from the master listing it adds the master. I'm thinking it's to do with the 'buy now' form master products uses to allow the checkbox set-up to add more than 1 product at once or perhaps it's the hidden field doobrie on the input button?

 

Re QTPro I've set the out of stock messages to '' but it still shows the - on the oos attributes. Where can I change that bit? Thought I'd found it in pad_base but it's still showing a - on the dropdown. Really I want the dropdowns to look the same and just track the stock, I order in if I don't have the right combo available already.

Share this post


Link to post
Share on other sites

Sorry if someone has already asked this, I didnt have the time or patience to browse 52 pages of posts and a search for imprint returned nothing.

 

Im wondering if anyone has integrated the 'Imprint Text Options/Attributes' contrib with QTPro.

 

Thanks


Matt Mika

Installed Contributions: Multi-Stores, QTPro, CCGV(trad), Batch Print, EasyPopulate, Simple Manual Order Entry, Encrypting Credit Card Via Mcrypt, UPSXML, Down for Maintenance, On The Fly GD Thumbs, SPPC, SPPC Hide, and various personal tweaks

Share this post


Link to post
Share on other sites

Is there any way I can sort the posisions of the drop downs for the sequencial dropdowns option? I have 3 options and they need to be in a specific order. for selection, how can I change this?


++++++++++++++++++++

Im just a guy, Nothing more

++++++++++++++++++++

Share this post


Link to post
Share on other sites
Is there any way I can sort the posisions of the drop downs for the sequencial dropdowns option? I have 3 options and they need to be in a specific order. for selection, how can I change this?

someone else asked that earlier... i think it said it can't be done


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Hi all I have read a lot of these 52 pasges but...

I use OScommerce ms2fr-051113 with QTPRO 4.25

I can see and configure every thing but I can't have the right vue with the articles.

I have shoes: Male and female

Size 38, 40 and 42

I create option male and one option female

for each option I create 38, 40 and 42.

for my shoe Turbo XZX I create 6 items

turbo xzx male 38

turbo xzx female 38

.

.

turbo xzx female 42

Whatever I choose on Product Attribute Display Plugins I have allways have 2 combo box one for male and one for female so I can't bye only male shoes.

Is it clear ?

I'm french so excuse my english.

What it's wrong ?

Thanks

Gilbert

Share this post


Link to post
Share on other sites

Does anybody know if it is possible to use different model-numbers for each attribute-option?

Share this post


Link to post
Share on other sites
Hi all I have read a lot of these 52 pasges but...

I use OScommerce ms2fr-051113 with QTPRO 4.25

I can see and configure every thing but I can't have the right vue with the articles.

I have shoes: Male and female

Size 38, 40 and 42

I create option male and one option female

for each option I create 38, 40 and 42.

for my shoe Turbo XZX I create 6 items

turbo xzx male 38

turbo xzx female 38

.

.

turbo xzx female 42

Whatever I choose on Product Attribute Display Plugins I have allways have 2 combo box one for male and one for female so I can't bye only male shoes.

Is it clear ?

I'm french so excuse my english.

What it's wrong ?

Thanks

Gilbert

 

 

Excuse but it's ok but Whatever I choose on Product Attribute Display Plugins I have allways have combos

What's the problem ?

Thanks

Gilbert

Share this post


Link to post
Share on other sites
xpost from master products thread...

 

Has anyone got QTPro and Master Products working together? I have some products that I'd like to track a la QTPro and some one-offs that I like to display the way master products looks. I also want to get rid of any 'out of stock' referencing and the drop-down quantity box on non-master products, which is taking some effort...

 

I've got it functioning to a point where the qtpro bit seems to work but now if I try to add a slave product to the cart from the master listing it adds the master. I'm thinking it's to do with the 'buy now' form master products uses to allow the checkbox set-up to add more than 1 product at once or perhaps it's the hidden field doobrie on the input button?

 

Re QTPro I've set the out of stock messages to '' but it still shows the - on the oos attributes. Where can I change that bit? Thought I'd found it in pad_base but it's still showing a - on the dropdown. Really I want the dropdowns to look the same and just track the stock, I order in if I don't have the right combo available already.

 

I am also interested in it, because with Master Products it is possible to assign a model-no. to each product option (slave product), with QTpro not, so ideal would be combination of both contributions.

Share this post


Link to post
Share on other sites
Hi

 

Any more thoughts on managing barcode when using QTPro. I am still stuck on the fact then when I enter a barcode, ie 7321900177375 it saves it as 2147483647. If i enter a figure less than this it writes it to the db correctly. Within my db i have set products_stock_barcode, type: varchar(13), Not Null.

 

I have got a barcode mod working (inserted on product page) and this is set with the same type and Not Null.

 

Any assistance on this really grateful. Its the last thing I want to get right (so that I can link in with my retail store).

 

W

 

I'm pretty sure that the barcode is being entered as an integer in the sql statement. It sounds like your sql statement looks like this:

 

tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " values (0," . (int)$VARS['product_id'] . ",'$val'," . (int)$VARS['quantity'] . ", " . $barcode . ")");

 

when it should look like this:

 

tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " values (0," . (int)$VARS['product_id'] . ",'$val'," . (int)$VARS['quantity'] . ", '" . $barcode . "')");

 

Note the single quotes around the $barcode variable entry. Be sure to check any other sql queries as well.

 

To be safe, make sure you use the tep_db_prepare_input function before any sql statements that uses the user input barcode value:

 

$barcode = tep_db_prepare_input($_GET['barcode']);

 

Hope this helps

Share this post


Link to post
Share on other sites
I am also interested in it, because with Master Products it is possible to assign a model-no. to each product option (slave product), with QTpro not, so ideal would be combination of both contributions.

 

Have you looked at the barcode stuff? Seems to me to be the same effect as a model number for each attribute combination.

 

Meanwhile wrt QTPro and Master Products I'm taking it as a 'no' :lol:

Share this post


Link to post
Share on other sites

Hi there. Hoping someone can help me as I really need to be able to say if certain sizes or colours are out of stock in my shop without customers having to email/ring me first to check. I'm new to all this so please go easy with me!

Here goes: I uploaded the new_install.sql QTpro 4.25 script but when I tried to load the data using PHPmyadmin I got an error message telling me that 'product_options_track_stock' column already exists. What do I do now?

Trogette - I haven't edited any code as yet. What code were you thinking of? Did anyone else get this problem?

Cheers,

kaffy

Share this post


Link to post
Share on other sites
Hi there. Hoping someone can help me as I really need to be able to say if certain sizes or colours are out of stock in my shop without customers having to email/ring me first to check. I'm new to all this so please go easy with me!

Here goes: I uploaded the new_install.sql QTpro 4.25 script but when I tried to load the data using PHPmyadmin I got an error message telling me that 'product_options_track_stock' column already exists. What do I do now?

Trogette - I haven't edited any code as yet. What code were you thinking of? Did anyone else get this problem?

Cheers,

kaffy

whats your store URL? PM me if you want


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Hi there,

My URL is www.babyslingsandoutdoorthings.com

This is the error message I get.

 

SQL query:

 

# QT Pro V4.0 Date: 12/04/2004

# Database changes for QT Pro installation to a store that does not have a

# previous version of QT Pro installed

# Add new column to products_options to indicate if stock should be tracked

# for an option

ALTER TABLE products_options ADD products_options_track_stock tinyint( 4 ) default '0' NOT NULL AFTER products_options_name;

 

 

 

MySQL said:

 

#1060 - Duplicate column name 'products_options_track_stock'

 

 

Any help gratefully recieved. Thanks, kaffy

Share this post


Link to post
Share on other sites

This just means that the column already exists, so no further action needs to be taken. To make sure the field is the correct type you could try the following. This will just change it into the correct field type if it isn't already, chances are you won't need this.

 

ALTER TABLE products_options MODIFY products_options_track_stock tinyint( 4 ) default '0' NOT NULL AFTER products_options_name;


"...you do one little thing, you build a widget in Saskatoon and the next thing you know it's two miles under the desert, the essential component of a death machine..."

Share this post


Link to post
Share on other sites

So do I just go to the next step in the installation manual which is to copy the contents of the QT Pro catalog folder into my store folder?

Thanks,

kaffy

Share this post


Link to post
Share on other sites
So do I just go to the next step in the installation manual which is to copy the contents of the QT Pro catalog folder into my store folder?

Thanks,

kaffy

 

Hi from a fellow Storch retailer! :lol:

 

Have you made any other changes to your shop, and would you be doing this to your live site?

Share this post


Link to post
Share on other sites

Has anyone rewritten the stock addition/editing page to show all the attribute combinations and add stock quantities in batches rather than one at a time?

Share this post


Link to post
Share on other sites

whoo!!! I've sorted out my master products vs qtpro problem... Here's the code for the 'add slave' case in application_top.php:

 

	  //Master Products						 
  // customer adds multiple products from the master_listing page
  case 'add_slave' :	
						  while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) { 
							 if (substr($key,0,11) == "Qty_ProdId_") { 
							 $prodId = substr($key,11); 
							 $qty = $val; 
							 if ($qty <= 0 ) continue; 

//++++ QT Pro: Begin Changed code
							$attributes=array();
							if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {
							  $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);
							  foreach ($attrlist as $attr) {
								list($oid, $oval)=explode('-',$attr);
								if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)
								  $attributes[$oid]=$oval;
							  }
							}
							if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {
							  foreach ($HTTP_POST_VARS['id'] as $key=>$val) {
								if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)
								  $attributes=$attributes + $HTTP_POST_VARS['id'];
							  }
							}
				//			Master Products add slave in qtpro
							$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id'], $attributes))+1, $attributes);
//++++ QT Pro: End Changed Code

							} 
						  } 
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break; 
  //Master Products EOF

 

Note this isn't tested yet with the paypal IPN and nochex APC payment modules, that's the next step. But I'm so chuffed!!

Share this post


Link to post
Share on other sites

Oh and I found out how to get rid of the out of stock messages, they're options in 'products information' in the configuration box, doh :rolleyes: :blush:

Share this post


Link to post
Share on other sites

So it is you trogette! Small world! I was a customer of yours last year! Sorry for the competition, there seemed to be an empty void of decent slings here over here! (Plus I was really impressed by the Storch).

 

Back to work! Main changes made so far include moving the whole of the catalogue contents to my public_html folder and the changes needed to the configure files after that. Otherwise, its mostly just adding and editing text to the main pages, ie index, shipping and returns. That kind of thing. No additional contributions used as yet although I do want to add more product pics.

 

Yes I will be doing it to my live shop, arrrrrhhhh! Still, don't have many customers as yet so perhaps I can just start again if it all goes wrong!

Cheers,

kaffy

Share this post


Link to post
Share on other sites

This bit of my edit from before needs to have an $HTTP_POST_VARS in it:

 

	  
				//			Master Products add slave in qtpro
							$cart->add_cart($HTTP_POST_VARS['$prodId'], $cart->get_quantity(tep_get_uprid($prodId, $HTTP_POST_VARS['id'], $attributes))+1, $attributes);
//++++ QT Pro: End Changed Code

 

Not yet got atrribute stock deducting with paypal payments but nochex is fine, altered checkout_nochex.php with code from checkout_process.php :)

Share this post


Link to post
Share on other sites

revisiting actual price display.

 

I've taken code from Actual Price Pull Down v1.2.3a and adapted pad_base, with help from http://forums.oscommerce.com/index.php?sho...=960&p=810616 post 965. The pad_base function is the same as in the post above, the build attributes array is altered similarly but I wanted to only show the full price when changed.

 

// Start of Changes- display actual prices instead of +/-  Actual Price Pull Down v1.2.3a
			$new_price ? $original_price = $new_price : $original_price = $this->products_original_price; //// check if set special price	 note $this variable

	$option_price = $products_options['options_values_price'];
	if ($products_options['price_prefix'] == "-") // in case price lowers, don't add values, subtract.
  {
	$show_price = 0.0 + $original_price - $option_price; // force float (in case) using the 0.0;
  } else {
		 $show_price = 0.0 + $original_price + $option_price; // force float (in case) using the 0.0;
  }
if ($products_options['options_values_price'] != '0') {
	$products_options_array[sizeof($products_options_array)-1]['text'] .= ' ('
	. $currencies->display_price( $show_price, $this->products_tax_class_id) .') ';	   // note $this variable
}
// End Of Changes

Share this post


Link to post
Share on other sites

Integrating PayPal Shopping Cart IPN v3.1.5 with QT Pro 4.2 - Revision

 

Several people have messaged me asking about my post on Apr 6 2006, 02:07 PM, post # 832874, saying it is unclear where the changes need to be made. Here is a revised version of my post that shows you more clearly were in the code the changes are (I couldn't see a way to edit or delete the post itself).

 

A few people have asked me if I got my QTPro to work with Paypal IPN. I've only got it to work partially, but I did get stock attribute quantities to decrement, with the help of another user on this forum. I used the steps below, and keep in mind this is when integrating PayPal Shopping Cart IPN v3.1.5 with QT Pro 4.2, and NOT the OsCommerce team's PayPal IPN (though who knows, it may work for that too). What I still have no answer to is how to get the stock attribute quantities to properly increment again if an order is cancelled and "restock" is checked.

 

This is all I can provide, sorry. Please don't message me asking for more because I simply don't have it.

 

FILES AFFECTED:
catalog/includes/modules/payment/paypal/classes/osC/Order.class.php
catalog/includes/classes/order.php


CHANGES TO PAYPAL SHOPPING CART IPN CODE
_____________________________________________________________________
_____________________________________________________________________

IN catalog/includes/modules/payment/paypal/classes/osC/Order.class.php
_____________________________________________________________________
_____________________________________________________________________

======================================================================
AROUND LINE 73 (code is similar to checkout_process.php line 111)

REPLACE:

// Stock Update - Joao Correia
  if (STOCK_LIMITED == 'true') {
	if (DOWNLOAD_ENABLED == 'true') {
	  $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

WITH:

// Stock Update - Joao Correia
// BEGIN QT PRO/Paypal IPN
  $products_stock_attributes=null;
  if (STOCK_LIMITED == 'true') {
	$products_attributes = $order->products[$i]['attributes'];
//	if (DOWNLOAD_ENABLED == 'true') {
// END QT PRO/Paypal IPN
	  $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename

======================================================================
AROUND LINE 89 (code is similar to checkout_process.php line 130)

REPLACE:

	  // Will work with only one option for downloadable products
	  // otherwise, we have to build the query dynamically with a loop
	  $products_attributes = $order->products[$i]['attributes'];

WITH:

	  // Will work with only one option for downloadable products
	  // otherwise, we have to build the query dynamically with a loop
	  // BEGIN QT PRO/Paypal IPN
	  //  $products_attributes = $order->products[$i]['attributes'];
	  // END QT PRO/Paypal IPN

======================================================================
AROUND LINE 96

REPLACE:

	} else {
	  $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	}
	if (tep_db_num_rows($stock_query) > 0) {
	  $stock_values = tep_db_fetch_array($stock_query);
	  // do not decrement quantities if products_attributes_filename exists
	  if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
		$stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
	  } else {
		$stock_left = $stock_values['products_quantity'];
	  }
	  tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	  if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	  }
	}
  }

WITH:

	// BEGIN QT PRO/Paypal IPN
	// } else {
	//   $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	// }
	// END QT PRO/Paypal IPN
	if (tep_db_num_rows($stock_query) > 0) {
	  $stock_values = tep_db_fetch_array($stock_query);
	// BEGIN QT PRO/Paypal IPN
	$actual_stock_bought = $order->products[$i]['qty'];
	$download_selected = false;
	if ((DOWNLOAD_ENABLED == 'true') && isset($stock_values['products_attributes_filename']) && tep_not_null($stock_values['products_attributes_filename'])) {
	  $download_selected = true;
	  $products_stock_attributes='$$DOWNLOAD$$';
	}
	// If not downloadable and attributes present, adjust attribute stock
	if (!$download_selected && is_array($products_attributes)) {
	  $all_nonstocked = true;
	  $products_stock_attributes_array = array();
	  foreach ($products_attributes as $attribute) {
		if ($attribute['track_stock'] == 1) {
		  $products_stock_attributes_array[] = $attribute['option_id'] . "-" . $attribute['value_id'];
		  $all_nonstocked = false;
		}
	  } 
	  if ($all_nonstocked) {
		$actual_stock_bought = $order->products[$i]['qty'];
	  }  else {
		asort($products_stock_attributes_array, SORT_NUMERIC);
		$products_stock_attributes = implode(",", $products_stock_attributes_array);
		$attributes_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		if (tep_db_num_rows($attributes_stock_query) > 0) {
		  $attributes_stock_values = tep_db_fetch_array($attributes_stock_query);
		  $attributes_stock_left = $attributes_stock_values['products_stock_quantity'] - $order->products[$i]['qty'];
		  tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '" . $attributes_stock_left . "' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
		  $actual_stock_bought = ($attributes_stock_left < 1) ? $attributes_stock_values['products_stock_quantity'] : $order->products[$i]['qty'];
		} else {
		  $attributes_stock_left = 0 - $order->products[$i]['qty'];
		  tep_db_query("insert into " . TABLE_PRODUCTS_STOCK . " (products_id, products_stock_attributes, products_stock_quantity) values ('" . tep_get_prid($order->products[$i]['id']) . "', '" . $products_stock_attributes . "', '" . $attributes_stock_left . "')");
		  $actual_stock_bought = 0;
		}
	  }
	}
	//   $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	// }
	// if (tep_db_num_rows($stock_query) > 0) {
	//   $stock_values = tep_db_fetch_array($stock_query);
	// do not decrement quantities if products_attributes_filename exists
	if (!$download_selected) {
	  $stock_left = $stock_values['products_quantity'] - $actual_stock_bought;
	  tep_db_query("UPDATE " . TABLE_PRODUCTS . " 
					SET products_quantity = products_quantity - '" . $actual_stock_bought . "' 
					WHERE products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	// END QT PRO/Paypal IPN
	  if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) {
		tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
	  }
	}
  }
// BEGIN QT PRO/Paypal IPN
}
// END QT PRO/Paypal IPN

======================================================================
AROUND LINE 160

AFTER:

  // Update products_ordered (for bestsellers list)
  tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

AND BEFORE:

  //------insert customer choosen option to order--------

ADD:

  // BEGIN QT PRO/Paypal IPN
  tep_db_query("update " . TABLE_ORDERS_PRODUCTS . " SET products_stock_attributes = '" . $products_stock_attributes . "' WHERE orders_id = '" . $this->orderID . "' AND orders_products_id = '" . $order->products[i]['orders_products_id'] . "'");
  // END QT PRO/Paypal IPN

_____________________________________________________________________
_____________________________________________________________________

IN catalog/includes/classes/order.php
_____________________________________________________________________
_____________________________________________________________________

======================================================================
AROUND LINE 149 or possibly 127 (where Paypal Shopping Cart IPN code exists)

REPLACE:


//begin PayPal_Shopping_Cart_IPN
$attributes_query = tep_db_query("select products_options_id, products_options_values_id, products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
//end PayPal_Shopping_Cart_IPN
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
//begin PayPal_Shopping_Cart_IPN
														 'option_id' => $attributes['products_options_id'],
														 'value_id' => $attributes['products_options_values_id'],
//end PayPal_Shopping_Cart_IPN
																 'value' => $attributes['products_options_values'],
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);


WITH:


	//begin PayPal_Shopping_Cart_IPN
	// BEGIN QT PRO/Paypal IPN
	$attributes_query = tep_db_query("select opa.products_options_id, opa.products_options_values_id, opa.products_options, opa.products_options_values, opa.options_values_price, opa.price_prefix, popt.products_options_track_stock from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa, " . TABLE_PRODUCTS_OPTIONS . " popt where opa.orders_id = '" . (int)$order_id . "' and opa.orders_products_id = '" . (int)$orders_products['orders_products_id'] . "' and popt.products_options_id = opa.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
	// Old code from above line is on next line:
	//$attributes_query = tep_db_query("select products_options_id, products_options_values_id, products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
	// END QT PRO/Paypal IPN
	//end PayPal_Shopping_Cart_IPN
	if (tep_db_num_rows($attributes_query)) {
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
		$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
																  //begin PayPal_Shopping_Cart_IPN
																 'option_id' => $attributes['products_options_id'],
																 'value_id' => $attributes['products_options_values_id'],
																  //end PayPal_Shopping_Cart_IPN
																 // BEGIN QT PRO/Paypal IPN
																 'track_stock' => $attributes['products_options_track_stock'],
																 // END QT PRO/Paypal IPN
																 'value' => $attributes['products_options_values'],
																 'prefix' => $attributes['price_prefix'],
																 'price' => $attributes['options_values_price']);

Share this post


Link to post
Share on other sites
Nevermind, I did it myself....If anyone is interested here is the code for Application top:

 

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id']+(int)$HTTP_POST_VARS['quantity'], $attributes))+1, $attributes);

 

I haven't done extensive testing on it yet so don't kill me if doesn't work for you. The rest of the instructions can be found at contribution: Qty Field in Product Description Originally done by Brandon Clark and built off of Sean Wang and Doug Murrays versions.

 

you need only to do these steps:

 

in catalog/product_info.php on line 213:

 

replace:

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

 

with:

<td class="main" align="right"><?php echo TEXT_QUANTITY . tep_draw_input_field('quantity', '1', 'SIZE=2 maxlength=2') . tep_draw_separator('pixel_trans.gif', '5', '1') . tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align=absmiddle'); ?></td>

 

in catalog/includes/application_top.php on line 358:

 

replace:

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

 

with the above code I gave initially:

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id']+(int)$HTTP_POST_VARS['quantity'], $attributes))+1, $attributes);

 

and lastly:

in catalog/includes/languages/english/product_info.php on line 21 (and any other language you use):

 

after:

define('TEXT_CLICK_TO_ENLARGE', 'Click to enlarge');

 

add:

define('TEXT_QUANTITY', 'Qty:');

 

Good luck

 

 

Hi Teresa!

 

Exactly what I need. It doesnt work though. When trying to fill in 20 it just adds 1 to the cart. It was a very easy modification.. I can't understand whats gone wrong. Are you sure the code you wrote are right? Thank you!

Edited by Fredrik.r

Share this post


Link to post
Share on other sites

Hi

 

Bit of a cross post but probably more relevant to QTPro.

 

I want to edit stats_low_stock_attrib.php so that it includes an extra field I created called products_barcode.

 

How can I add this into the low stock report. I want to show

 

Products | Barcode | Qty | Price

 

I have detailed the code below for ease of reference.

 

Many thanks

 

W

 

<?php
/*
QT Pro Version 4.0

stats_low_stock_attrib.php

Contribution extension to:
osCommerce, Open Source E-Commerce Solutions
[url=http://www.oscommerce.com]http://www.oscommerce.com[/url]

Copyright ? 2004 Ralph Day
Released under the GNU General Public License

Based on prior works released under the GNU General Public License:
QT Pro prior versions
Ralph Day, October 2004
Tom Wojcik aka TomThumb 2004/07/03 based on work by Michael Coffman aka coffman
FREEZEHELL - 08/11/2003 freezehell@hotmail.com Copyright ? 2003 IBWO
Joseph Shain, January 2003
osCommerce MS2
Copyright ? 2003 osCommerce

Modifications made:
11/2004 - Clean up to not replicate for all languages
Handle multiple attributes per product
Ignore attributes that stock isn't tracked for
Remove unused code

********************************************************************************
***********

QT Pro Low Stock Report

This report lists all products and products attributes that have stock less than
the reorder level configured in the osCommerce admin site


********************************************************************************
***********

$Id: stats_products.php,v 1.22 2002/03/07 20:30:00 harley_vb Exp $
(v 1.3 by Tom Wojcik aka TomThumb 2004/07/03)
osCommerce, Open Source E-Commerce Solutions
[url=http://www.oscommerce.com]http://www.oscommerce.com[/url]

Copyright ? 2002 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');
require(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">


<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="menuboxheading" align="center"><?php echo strftime(DATE_FORMAT_LONG); ?></td>
</tr>

</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="formAreaTitle"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
<td class="formAreaTitle"><?php echo TABLE_HEADING_QUANTITY; ?></td>

<td class="formAreaTitle" align="right"><?php echo TABLE_HEADING_PRICE; ?> </td>

</tr>
<tr>
<td colspan="3"><hr></td>
</tr>
<?php
$products_query_raw = "select p.products_id, pd.products_name, p.products_quantity,p.products_price, l.name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_LANGUAGES . " l where p.products_id = pd.products_id and p.products_id = pd.products_id and l.languages_id = pd.language_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name ASC";

$products_query = tep_db_query($products_query_raw);
while ($products = tep_db_fetch_array($products_query)) {
$products_id = $products['products_id'];

// check for product or attributes below reorder level
$products_stock_query=tep_db_query("SELECT products_stock_attributes, products_stock_quantity
FROM " . TABLE_PRODUCTS_STOCK . "
WHERE products_id=" . $products['products_id'] ."
AND products_stock_quantity < '" . STOCK_REORDER_LEVEL ."'
ORDER BY products_stock_attributes");
$products_stock_rows=tep_db_num_rows($products_stock_query);
if (($products['products_quantity'] < STOCK_REORDER_LEVEL) || ($products_stock_rows > 0)) {
$products_quantity=($products_stock_rows > 0) ? ' ' : $products['products_quantity'];
$products_price=($products_stock_rows > 0) ? ' ' : $currencies->format($products['products_price']);
?>
<tr class="tableRow">
<td class="formAreaTitle"><?php echo '<a href="' . tep_href_link(FILENAME_STOCK, 'product_id=' . $products['products_id']) . '"><font size="+1"><strong>' . $products['products_name'] . '</strong></font></a>'; ?> </td>

<td class="dataTableContent"><?php echo $products_quantity; ?></td>
<td class="dataTableContent" align="right"><?php echo $products_price; ?> </td>
</tr>


<?php

///////////////// Add Attributes



if ($products_stock_rows > 0) {
$products_options_name_query = tep_db_query("SELECT distinct popt.products_options_id, popt.products_options_name
FROM " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
WHERE patrib.products_id='" . $products['products_id'] . "'
AND patrib.options_id = popt.products_options_id
AND popt.products_options_track_stock = '1'
AND popt.language_id = '" . (int)$languages_id . "'
ORDER BY popt.products_options_id");
?>
<tr class="dataTableRow">
<td class="main">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableRow">
<?php
// build headng line with option names
while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
echo " <td class=\"main\">" . $products_options_name['products_options_name'] . "</td>\n";
}
?>
</tr>
<?php
// buld array of attributes price delta
$attributes_price = array();
$products_attributes_query = tep_db_query("SELECT pa.options_id, pa.options_values_id, pa.options_values_price, pa.price_prefix
FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa
WHERE pa.products_id = '" . $products['products_id'] . "'");
while ($products_attributes_values = tep_db_fetch_array($products_attributes_query)) {
$option_price = $products_attributes_values['options_values_price'];
if ($products_attributes_values['price_prefix'] == "-") $option_price= -1*$option_price;
$attributes_price[$products_attributes_values['options_id']][$products_attributes_values['options_values_id']] = $option_price;
}

// now display the attribute value names, table the html for quantity & price to get everything
// to line up right
$quantity_html_table=" <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">\n";
$quantity_html_table.=" <tr class=\"dataTableRow\"><td class=\"main\" colspan=\"" . sizeof($products_options_array) . "\"> </td></tr>\n";
$price_html_table=" <table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">\n";
$price_html_table.=" <tr class=\"dataTableRow\"><td class=\"main\" colspan=\"" . sizeof($products_options_array) . "\"> </td></tr>\n";
while($products_stock_values=tep_db_fetch_array($products_stock_query)) {
$attributes=explode(",",$products_stock_values['products_stock_attributes']);
echo " <tr class=\"dataTableRowSelected\">\n";
$quantity_html_table.=" <tr class=\"dataTableRowSelected\">\n";
$price_html_table.=" <tr class=\"dataTableRowSelected\">\n";
$total_price=$products['products_price'];
foreach($attributes as $attribute) {
$attr=explode("-",$attribute);
echo " <td class=smalltext>".tep_values_name($attr[1])."</td>\n";
$total_price+=$attributes_price[$attr[0]][$attr[1]];
}
echo " </tr>\n";
$quantity_html_table.=" <td class=smalltext>" . $products_stock_values['products_stock_quantity'] . "</td>\n";
$quantity_html_table.=" </tr>\n";
$price_html_table.=" <td align=\"right\" class=smalltext>" . $total_price . " </td>\n";
$price_html_table.=" </tr>\n";
}
echo " </table>\n";
echo " </td>\n";
$quantity_html_table.=" </table>\n";
$price_html_table.=" </table>\n";
echo " <td class=smalltext>" . $quantity_html_table . "</td>\n";
echo " <td>" . $price_html_table . "</td>\n";
echo " </tr>\n";
}
}
////////////////////////// End Attributes
}
?>
<tr>
<td colspan="3"><?php echo tep_draw_separator(); ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<!-- body_text_eof //-->
</tr>
</table>
<!-- body_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×