Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] QTpro - Quantity Tracking Professional


zonetown

Recommended Posts

Okay, I have installed qtprov4.2 from scratch from oscommerce051113 and have only paypal ipn v1.1 from the official oscommerce team installed. When I try to buy something from the site, the total is decremented and the individual attributes are still not decremented. There must be some kind of bug in qt4.2. Has anyone seen this? What could possibly be the problem?

THanks!

 

 

I currently have the problem that stock attributes are not decremented when someone buys an item, but the overall product quantity is decremented.

For example, in

Categories->attributes->product quantity , the number displayed is decremented when someone buys an item. However, the same item that was bought with attribute "red" is not decremented at all, when it should be.

 

Does anyone have this same problem?

 

Thanks!

Link to comment
Share on other sites

Are you trying this while keeping the stock.php open (ie using two browsers, one for the store and one for admin). I find (sometimes) that if I keep the stock.php page open then it does not decrement, but if I am not in it it works fine. Not a solid answer but I assumed this was to do with the page cache.

 

W

 

I currently have the problem that stock attributes are not decremented when someone buys an item, but the overall product quantity is decremented.

For example, in

Categories->attributes->product quantity , the number displayed is decremented when someone buys an item. However, the same item that was bought with attribute "red" is not decremented at all, when it should be.

 

Does anyone have this same problem?

 

Thanks!

Link to comment
Share on other sites

Is there away for me to copy attributes to multiple products? so that I dont have to keep entering the same attributes to hundreds of items?

Link to comment
Share on other sites

I have tried keeping only one window open. However, this does not solve the problem, and the attributes still do not decrement. Any other ideas?

 

 

Are you trying this while keeping the stock.php open (ie using two browsers, one for the store and one for admin). I find (sometimes) that if I keep the stock.php page open then it does not decrement, but if I am not in it it works fine. Not a solid answer but I assumed this was to do with the page cache.

 

W

Link to comment
Share on other sites

Using QT Pro 4.1. Where should I look to hack the display of attributes that have only one option. For example, I'm using sequenced drop down, for the first attribute, shirt color, if only one (1) shirt color is available, I would like to "auto select it" and disable the dropdown, or possible just display it as text. Possible? Tips?

Link to comment
Share on other sites

Would you still have differnt sizes.

 

If not, then you could create it like a regular product (ie without attributes).

 

If yes (ie one color and many sizes), then just apply a size attribute selection to it so the only drop down is for size.

 

W

 

Using QT Pro 4.1. Where should I look to hack the display of attributes that have only one option. For example, I'm using sequenced drop down, for the first attribute, shirt color, if only one (1) shirt color is available, I would like to "auto select it" and disable the dropdown, or possible just display it as text. Possible? Tips?
Link to comment
Share on other sites

Would you still have differnt sizes.

 

If not, then you could create it like a regular product (ie without attributes).

 

Yes. A given shirt might come with options for men/women, shirt color, ink color, and size. Men/Women are catorgorized, so not a problem. It's the other three, where a shirt might only come in one (1) color and one (1) ink color that I'm focused on (size always being a choice).

 

If yes (ie one color and many sizes), then just apply a size attribute selection to it so the only drop down is for size.

That's what I'm doing now. But not "good enough" for client. Sometimes, clients don't get it. :-"

Link to comment
Share on other sites

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

 

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
Possibly ??? catalog/ssadmin/includes/functions/general.php (around line 980, function tep_remove_order)

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), add:
======================================================================
//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

======================================================================
Around line 83 (code is similar to checkout_process.php line 130), add:
======================================================================
	if (is_array($products_attributes)) {
	  $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
	}
	$stock_query = tep_db_query($stock_query_raw);
	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

======================================================================
Around line 89 (code similar to checkout_process.php line 136), add:
======================================================================
//begin QT PRO/Paypal IPN
}
//end QT PRO/Paypal IPN

======================================================================
Around line 156,
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']) . "'");

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, where Paypal IPN code exists:
======================================================================

	//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']);

		$subindex++;

Link to comment
Share on other sites

Well, another suggestion has sally'd forth from the client.

 

QT Pro 4.x has this concept of a single dropdown. This is very close to what they really would like to have. I'll call it a combination of the single dropdown and multiple dropdown.

 

In the first dropdown they want to merge Shirt color and Ink Color. The second dropdown would be Shirt size.

 

Should I just be looking to hack pad_multiple_dropdowns.php to accomplish this? I'm not really sure I'm up to the task actually. Anybody doing it? Maybe it's already built in.

Link to comment
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

 

Ok, been working on this and have got as far as the following:

 

1. Created additional column

2. Edited admin/stock.php code to

I can add both stock and a number in the barcode field and these are saved and displayed.

 

But, if i type a 13 number barcode in, the result always shows as '2147483647'.

 

Also, if I place an order from the store, the order goes through fine but does not decrement the stock.

 

Appreciate any expert eyes!!

 

W

Link to comment
Share on other sites

I would like to use a text field infront of my add button where I can put quantity in the product_info page.

I ran across some code that might work, but I don't know how to merge the line from QTPro and the line they require--can someone help??

 

QTPRO Line in Catalog/includes/application_top.php

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

 

 

Required Change:

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

 

 

As you can see they are very similar, but I don't know where the attribute stuff should go to make it work properly, can someone help

Teresa

Link to comment
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

Link to comment
Share on other sites

I am using QT Pro Version 4.0 but seem to have a problem removing attributes. I have deleted many attributes but they are still being shown on the stock page. This is because I have not removed the stock first!!! oops

 

When an attribute is deleted should the stock table be updated? Has anyone added this to the contribution??

 

If not surely there needs to be a delete button to remove those attribute combinations that are no longer valid. Has anyone added a delete button to carry out this task? I know that if you make the quantity 0 it deletes, but if the attributes are already gone this option is no longer avaiable. Adding all the attributes back would be very time consuming! There must be an easer way!

 

Thanks,

 

Gareth

Edited by WS Evolution
Link to comment
Share on other sites

I am using QT Pro Version 4.0 but seem to have a problem removing attributes. I have deleted many attributes but they are still being shown on the stock page. This is because I have not removed the stock first!!! oops

 

When an attribute is deleted should the stock table be updated? Has anyone added this to the contribution??

 

If not surely there needs to be a delete button to remove those attribute combinations that are no longer valid. Has anyone added a delete button to carry out this task? I know that if you make the quantity 0 it deletes, but if the attributes are already gone this option is no longer avaiable. Adding all the attributes back would be very time consuming! There must be an easer way!

 

Thanks,

 

Gareth

Apparantly no!

 

I asked Ralph the same question last year and this was his reply:

 

" QT Pro doesn't delete the products_stock rows when you add or delete attributes for a product. Its best to delete all of the stock for a product before messing with them. You need to go directly into the products_stock table with phpmyadmin to manually clean out the unneeded rows. "

 

Just make sure you delete the stock and it will work out. Hope that helps

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

Link to comment
Share on other sites

Any one integrate QTPro with New Attributes Manager?

 

If so can you post the changes you made. I have them both working, but not together. so when I make the attributes with New attributes manager, they dont show up in the stock.php page of the product.

Link to comment
Share on other sites

I'm a bit late with development of a clients store, any help would be very much appreciated!

 

1, I would like a quantity box besides the qtpro related dropdown in the product info page. I have seen other examples of this, but they are referring to code that does not exist in my shop.. Any suggestions of an easy way to add a box?

 

2, Does "Step by step manual order entry" and/or "Order Editor" work with QTPro 4.25?

 

Thanks!!!

Link to comment
Share on other sites

I'm a bit late with development of a clients store, any help would be very much appreciated!

 

1, I would like a quantity box besides the qtpro related dropdown in the product info page. I have seen other examples of this, but they are referring to code that does not exist in my shop.. Any suggestions of an easy way to add a box?

 

2, Does "Step by step manual order entry" and/or "Order Editor" work with QTPro 4.25?

 

Thanks!!!

There are some contributions out there that should take care of it, I have seen something in the forum myself where people have added a quantity box.

 

Step by Step Manual Order Entry firstly doesn't work properly. I can't even member how I hacked the code to get it to work. Even if you upload it on to a fresh install you will see it doesn't work.

 

Once you hack it to get it working, there are no QTPro options in the drop box etc - the attributes don't show up and it will be a mission for me to get QTPro to work in that, along with CCGV too.

Edited by chooch

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

Link to comment
Share on other sites

Using QT Pro 4.1. Where should I look to hack the display of attributes that have only one option. For example, I'm using sequenced drop down, for the first attribute, shirt color, if only one (1) shirt color is available, I would like to "auto select it" and disable the dropdown, or possible just display it as text. Possible? Tips?

 

Well, I got this... partially.

 

	  // Draw first option dropdown with all values
  if(sizeof($attributes[0]['ovals']) > 1) {
  $out.='<tr><td align="right" class=main><b>'.'<!-- XXX' . sizeof($attributes[0]['oname']) . ' -->'.
			 $attributes[0]['oname'].
		 ":</b></td><td class=main>".
		 tep_draw_pull_down_menu('id['.$attributes[0]['oid'].']',
								 array_merge(array(array('id'=>0, 
								 'text'=>'First select '.$attributes[0]['oname'])), 
								 $attributes[0]['ovals']),$attributes[0]['default'], 
								 "onchange=\"i".$attributes[0]['oid']."(this.form);setDetail(this.form);return false;\"").
		 "</td></tr>\n";
  } else {
  $out.='<tr><td align="right" class=main><b>'.
			 $attributes[0]['oname'].
		 ":</b></td><td class=main>".
		 tep_draw_pull_down_menu('id['.$attributes[0]['oid'].']',
								 $attributes[0]['ovals'],
								 " ", 
								 "disabled\"").
		 "</td></tr>\n";

  }

  // Draw second to next to last option dropdowns - no values, with onchange
  for($o=1; $o<sizeof($attributes)-1; $o++) {
	$out.='<tr><td align="right" class=main><b>'.$attributes[$o]['oname'].":</b></td><td class=main>".tep_draw_pull_down_menu('id['.$attributes[$o]['oid'].']',array(array('id'=>0, 'text'=>'Next select '.$attributes[$o]['oname'])), '', "onchange=\"i".$attributes[$o]['oid']."(this.form);setDetail(this.form);return false;\"")."</td></tr>\n";
  }

 

It's the "Draw second to next to last option dropdowns - no values, with onchange" loop that has been a lot tougher. I want to do the same thing as in the first option, display the dropdown, item selected, dropdown disabled. Tips?

Link to comment
Share on other sites

There are some contributions out there that should take care of it, I have seen something in the forum myself where people have added a quantity box.

 

Step by Step Manual Order Entry firstly doesn't work properly. I can't even member how I hacked the code to get it to work. Even if you upload it on to a fresh install you will see it doesn't work.

 

Once you hack it to get it working, there are no QTPro options in the drop box etc - the attributes don't show up and it will be a mission for me to get QTPro to work in that, along with CCGV too.

 

Thank you. Do you know if Order Editor works better with QTPro?

Link to comment
Share on other sites

Thank you. Do you know if Order Editor works better with QTPro?

sorry, from what I have heard no-one has added QTPro compatibilty to Order Editor... you should check out the Order Editor thread

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

Link to comment
Share on other sites

Any one integrate QTPro with New Attribute Manager? I would really really like to be able to use both of these contribs, together even. If any one can help me, Please Pipe up!

Link to comment
Share on other sites

Hi

I have Order Editor 2.2 on my QTPro maybe I just go lucky, but I've been using it for months. Not sure what I did that was so special, but seems to work okay. I have about a million other things on my site too, pretty heavily modified, but I would be willing to show you sections of code on my files showing how I merged the lines....I can't guarantee anything, I am not a php expert by an means, more of a novice, but I have learned a thing or two in the past 3 years.

Also to the fellow who has been asking about an attribute manger system. I found an attribute manager that I just installed and love it. I too was crushed when the QTPRO guys went to the pad.base stuff...makes it impossible for a novice to do any integration, however the attribute manager I just loaded doesn't interfere with ANY of the QTPRO stuff and took less then ten minutes to install AJAX-AttributeManager-v2.1-beta...don't panic about the beta, seems very robust so far and its very nice looking

Heres the link to the contribution

http://www.oscommerce.com/community/contributions,4063

good luck guys,

Teresa - ttstitches

Link to comment
Share on other sites

Namely the stock portion of QTpro is not working with "New Attributes Manager" That is the only portion that is not working.

sorry, I have never heard of New Attributes Manager.. I wish I could help

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...