Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] QTpro - Quantity Tracking Professional


zonetown

Recommended Posts

New issue :(

 

OK so I've got it installed OK and I am using the "special ON / OFF" to make it only active on certain products. I have done this by creating new attribute groups for the products that I want to use the feature for.

 

NOw I am running into a new problem though... It doesn't represent the stock correctly with multiple attributes.. I thought this was functioning correctly before but I may be wrong.. Is this a bug or is there a fix here.

 

 

Example:

 

Here is what I have in the "Stock" button in the admin.

Color- Size- Quantity

Denim M 1

Olive L 1

 

But here is what is coming up on the item:

<size dropdown>

M

L

XL - Out of stock

<color dropdown>

Denim

Olive

 

But when you have Olive selected it should show "M - Out of stock" and when you have Denim Selected it should show "L-Out of stock". I would swear when I first installed this these fields populated upon selection.

 

Is there a fix for this or do I need to create seprate products for each color???

 

Thanks again for all your help :D

Link to comment
Share on other sites

New issue :(

 

OK so I've got it installed OK and I am using the "special ON / OFF" to make it only active on certain products. I have done this by creating new attribute groups for the products that I want to use the feature for.

 

NOw I am running into a new problem though... It doesn't represent the stock correctly with multiple attributes.. I thought this was functioning correctly before but I may be wrong.. Is this a bug or is there a fix here.

Example:

 

Here is what I have in the "Stock" button in the admin.

Color-  Size- Quantity 

  Denim    M    1 

  Olive    L    1

 

But here is what is coming up on the item:

<size dropdown>

M

L

XL - Out of stock

<color dropdown>

Denim

Olive

 

But when you have Olive selected it should show "M - Out of stock" and when you have Denim Selected it should show "L-Out of stock". I would swear when I first installed this these fields populated upon selection.

 

Is there a fix for this or do I need to create seprate products for each color???

 

Thanks again for all your help :D

 

This is working exactly as designed. Only completely out of stock attributes show as out of stock. Since there is at least one color in stock for M it does not show as out of stock. Same for L. Sorry, 3.1 doesn't do any better than this.

 

I am very, very close to a new version that will give you several ways of dealing with this issue. I have a couple of minor code changes left and a lot of testing. I'll get the code changes done in the next couple of days and start into the testing. I don't want all of the stock issues previous releases of this code had for multiple attributes so I'm building a pretty extensive test plan and it will take some time to go through all the tests. I'm guessing it will be ready to release before Christmas.

Link to comment
Share on other sites

Ralph,

Thanks for the info. I appreciate your help and your work on this project.

 

So then just to verify.. the way I have it set up now will now work. because it will allow the customer to purchase an item (denim L or olive M) that does not exist.

 

So my solution in the interum is to creat seprate items for each color... correct?

 

Thanks again!

Jesse

Link to comment
Share on other sites

Ralph,

Thanks for the info. I appreciate your help and your work on this project.

 

So then just to verify.. the way I have it set up now will now work. because it will allow the customer to purchase an item (denim L or olive M) that does not exist.

 

So my solution in the interum is to creat seprate items for each color... correct?

 

Thanks again!

Jesse

A customer will be able to put the items in the cart but won't be able to checkout if you have Allow Checkout set to false in the Configuration, Stock settings. If Allow Checkout is true, yes they will be able to buy them. Its not that bad if you mostly have all the colors and sizes in stock.

 

If you have a lot of broken color and size runs then, yes, you would probably be better setting up different products for each color to avoid the customer hunting for what's in stock and getting frustrated.

Link to comment
Share on other sites

Hi all - I've just installed the latest version of QTpro and it's working like a charm! It really has come on along nicely since I last used it (thanks Ralph!). :D

 

I've made a few mods to my install to make the drop-down system more intuitive - it uses JavaScript to display the stock levels for each colour / size, updating the stock info as you change between colours, etc... eliminating the problem where customers can add products to the basket when the specific colour / size is not available (if you should wish).

 

It also forces selection of each specific option, meaning people can't checkout without specifically selecting colours, sizes, etc.

 

It's probably not suited to all stores, only those with size and colour options for the majority of their products... also is *completely* dependant on JavaScript, which may be a worry to some people (I usually force it in admin). If anyone wants to be a guinea pig and try it out, drop me a message and I'll post the code! Example link below -

 

http://store-02.richerdesigns.co.uk/produc...?products_id=51

 

Cheers :)

Link to comment
Share on other sites

Hi all - I've just installed the latest version of QTpro and it's working like a charm! It really has come on along nicely since I last used it (thanks Ralph!). :D

 

I've made a few mods to my install to make the drop-down system more intuitive - it uses JavaScript to display the stock levels for each colour / size, updating the stock info as you change between colours, etc... eliminating the problem where customers can add products to the basket when the specific colour / size is not available (if you should wish).

 

It also forces selection of each specific option, meaning people can't checkout without specifically selecting colours, sizes, etc.

 

It's probably not suited to all stores, only those with size and colour options for the majority of their products... also is *completely* dependant on JavaScript, which may be a worry to some people (I usually force it in admin). If anyone wants to be a guinea pig and try it out, drop me a message and I'll post the code! Example link below -

 

http://store-02.richerdesigns.co.uk/produc...?products_id=51

 

Cheers :)

 

Looks nice. I've got that working as well. I have worked for large ecommerce sites for the last 8 or 9 years ($60M - $150M per year sales). In usability studies we've found some customers get confused with that type of sequenced choice. They don't always understand the interaction between the dropdowns. So I've provided a couple of other options as well.

 

Leaving the dropdowns as is but display a message line below them if the combination isn't in stock. Along with preventing add to cart if the combo isn't in stock. This can lead to some hunting for an in stock combination but isn't bad at all if you normally have full color and size ranges in stock.

 

Displaying a single dropdown with each entry in the dropdown a different combination ("Red, L", "White, XL"). This is particularly nice for outlet sites where you have only a few combinations in stock.

 

Displaying a single radio set same as the single dropdown.

 

I managed to get a little bit of testing in this morning.

Link to comment
Share on other sites

Thanks Ralph,

 

I'd agree with your points re: usability, but I think it's a step in the right direction.

 

I think the combined drop down with a list of all available (in stock) combinations would be a good solution - I'd guess it would need to combine the various option values into a single value - then extract it during the add to cart function. Certainly should be more compatible than my script (which is pretty much a store dependant hack).

 

Am in two minds currently whether displaying an "out of stock" message or simply hiding the option is the best approach... think I'll leave mine as is currently as it may prevent confusion.

 

Look forward to seeing your developments! :)

Link to comment
Share on other sites

Hey Ralph , i just noticed one problem. when i delete the order under admin > orders and if i put a check mark for Restock product quantity it restocks the whole quantity of that product but doesnt update the attribute.

for example if i delete an order of small size shirt and put the checkmark to restock the product quantity , it stocks the quantity but doesnt restock the quantity of small size.

 

your help is really apprecaited

 

thankx

Link to comment
Share on other sites

Thanks Ralph,

 

I'd agree with your points re: usability, but I think it's a step in the right direction.

 

I think the combined drop down with a list of all available (in stock) combinations would be a good solution - I'd guess it would need to combine the various option values into a single value - then extract it during the add to cart function. Certainly should be more compatible than my script (which is pretty much a store dependant hack).

 

Am in two minds currently whether displaying an "out of stock" message or simply hiding the option is the best approach... think I'll leave mine as is currently as it may prevent confusion.

 

Look forward to seeing your developments! :)

 

Some of it comes down to how savvy your customer base is and how many options you are going to sequence them through. Size/Clor isn't too bad but try pants that come in regular fit/relaxed fit/ baggy fit, color, waist, inseam, cuffed/hemmed, pleated/flat front, no wrinkle/regular. One big site using the sequenced dropdowns is nordstrom.com which surprises me since they have a pretty broad range of customers. I don't have a contact over there any more to find out how its working for them.

 

What a lot of stores do instead of the out of stock message on the page is to wait until you add to cart, check stock and throw up another page telling you its out of stock and either showing you in-stock combinations in a single dropdown or with two dropdowns - what's available in the size you selected and what's available in the color you selected. This works OK if you don't have many broken size or color runs. The double dropdown is OK if you have just two options but doesn't generalize well to 3 or more options. I've never been a fan of this out of stock page as personally I'd rather know sooner and not have to go to another page. I haven't done it yet, but its on my list to add a page like this as an option for QT Pro as every site is a little different and has different problems. For now I just throw up a Javascript alert box with an out of stock message.

Link to comment
Share on other sites

Hey Ralph , i just noticed one problem. when i delete the order under admin > orders and if i put a check mark for Restock product quantity it restocks the whole quantity of that product but doesnt update the attribute.

for example if i delete an order of small size shirt and put the checkmark to restock the product quantity , it stocks the quantity but doesnt restock the quantity of small size.

 

your help is really apprecaited

 

thankx

 

:lol: LOL, I was just wondering why I hadn't heard of that bug before. QT Pro has never dealt with deleting orders - something that was missed by the original author. I caught it scanning for products_quantity in all the files to be sure I had caught everything that adjusted and checked stock. I've got it fixed in the new version I'm testing right now. Unfortunately, its not a simple fix. The order only contains the option text and option value text - in the language the customer ordered in to boot and by the way only the 1st 32 bytes of the 64 byte option value text. But not the id's, so I had to add them to the database, and make changes to save them and add the code to put the stock back when the order is deleted. It only works for orders created with the fix in place unfortunately. I had hoped to write a simple SQL script to do a best guess conversion of old orders. But it turned out to be too complex for that and not require a very, very recent version of mysql. So I think I'm going to have to write a PHP program to do it. I decided to put that off and get the rest of what I have out the door.

 

Some of the changes I've made aren't compatible with the current version so it would be some work to post you changes. I want to wrap up testing and get what's done out there as I need to shift to working on some of the business startup tasks with my wife for a little while. So, sorry, you'll need to back the stock out by hand for now.

Link to comment
Share on other sites

Thanks again for this great contribution. I only have one question might it be possible to disbable the out of stock warnings?

I have a very limited supply but a very fast supplier and I don't want customers scared away by this message. I have found a topic concerning this issue ( http://www.oscommerce.com/forums/index.php?showtopic=119195 ) but I suspect this will not work for me as I'm using the QTpro contrib. Any thoughts on this issue?

 

Thanks in advance

Can't think of a signature tight now. But just you wait till I read the next Discworld!

Link to comment
Share on other sites

I'll check it thanx Ralph.

 

You appear to have everyting configured correctly in the admin except you'll want to change allow checkout to false.  But that shouldn't cause the problem you are seeing (it will cause stock not to be decremented).  It looks like you have another contribution installed for attribute sorting and assignment.  That definitely will hit some of the same code as QT Pro so there may be some issues with your merging of the two contributions.  Items are not showing out of stock in the cart so your problem is probably localized to product_info.php which an attribute sorting contribution would have changes in as well.

Your online success is Paramount.

Link to comment
Share on other sites

Thanks again for this great contribution. I only have one question might it be possible to  disbable the out of stock warnings?

I have a very limited supply but a very fast supplier and I don't want customers scared away by this message.  I have found a topic concerning this issue ( http://www.oscommerce.com/forums/index.php?showtopic=119195 ) but I suspect this will not work for me as I'm using the QTpro contrib. Any thoughts on this issue?

 

Thanks in advance

That's a simple change to the 3.1 version. In product_info.ph find this:

if (tep_db_num_rows($attribute_stock_query)==0) {
            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => 'Out of Stock - ' . $products_options['products_options_values_name']);
          } else {
            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          }

 

And replace it with this:

             $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

 

The version I've got in testing right now has configuration options for whether or not to show out of stock attributes, if shown whether to indicate if they are out of stock and whether to let them be added to the cart.

Link to comment
Share on other sites

That's a simple change to the 3.1 version.  In product_info.ph find this:

>code<

The version I've got in testing right now has configuration options for whether or not to show out of stock attributes, if shown whether to indicate if they are out of stock and whether to let them be added to the cart.

Thank you very much for replying this quickly. I will try it out tomorrow and let you know how this works out for me. Amazing that you're already working on adding this. :thumbsup: You don't happen to be psychic? :o

Can't think of a signature tight now. But just you wait till I read the next Discworld!

Link to comment
Share on other sites

It worked perfectly. Thanks a lot.

 

The version I've got in testing right now has configuration options for whether or not to show out of stock attributes, if shown whether to indicate if they are out of stock and whether to let them be added to the cart.

How will the system than handle those items? Will ther ebe minus values in stock?

That is some thing that isnt implemented standard in osC. I would think It would take quite a big change in the program?

Can't think of a signature tight now. But just you wait till I read the next Discworld!

Link to comment
Share on other sites

It worked perfectly. Thanks a lot.

How will the system than handle those items? Will ther ebe minus values in stock?

That is some thing that isnt implemented standard in osC. I would think It would take quite a big change in the program?

 

Yes, stock can go negative now for an attribute combination. I have fixed the low stock report too so you can find those items that are oversold easily. The product stock won't go negative though. When setting the product stock it is the sum of the attribute stock that is greater than zero. This prevents product stock from going negative when there are some attribute combinations in stock and some oversold by a larger quantity.

 

You are in luck. I saved an intermediate version without my incompatible code changes but which has the changes to allow attribute stock to go negative so it was no big deal to do a quick diff for the changes needed.

 

Find this:

                  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'];
                     if ($attributes_stock_left < 1) {
                         tep_db_query("update " . TABLE_PRODUCTS_STOCK . " set products_stock_quantity = '0' where products_stock_attributes = '$products_stock_attributes' AND products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                         $actual_stock_bought = $attributes_stock_values['products_stock_quantity'];
                     } else {
                         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 = $order->products[$i]['qty'];
                     } 
                 } else {
                     $actual_stock_bought = 0;
                 }

 

Replace it with this:

                  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;
                 }

 

BTW, stock does go negative in base osCommerce AFAIK.

Link to comment
Share on other sites

The query doesn't sort the attributes at all so it appears random, probably depending on the order they are added to the database.  This is a base MS2 problem, not a problem with this contribution.  As you discovered, you can work around this by adding your attributes to a product, see what order they display in and then change the names of the attributes to get the sorting right.

 

You might also want to look at this contribution:

 

Attributes Copier

 

Although its called Attributes Copier, it also adds the ability to set the sort order for both the options (want Size before Color?) and the attributes.

 

Anyone who have installed the contribution above together with QTPRO? Any problems or things you should think about when doing this?

Link to comment
Share on other sites

I tried to do this yesterday but ran into trouble. How to combine the /catalog/product_info.php is not very clear. If anyone has this file with QTpro and Attributes sorter and copier and is willing to share this I'd be very happy

 

Anyone who have installed the contribution above together with QTPRO? Any problems or things you should think about when doing this?

Link to comment
Share on other sites

I tried to do this yesterday but ran into trouble. How to combine the /catalog/product_info.php is not very clear. If anyone has this file with QTpro and Attributes sorter and copier and is willing to share this I'd be very happy

Yes, its unfortunate that Attribute Sorter Copier makes all kinds of changes to product_info.php that aren't really related to the functionality of the contribution. A lot of it is cleanup of unrelated code and changes to coding style. It makes it difficult to pick out what's really important and breaks code for other contributions. :(

 

I haven't merged 3.1 with attribute sorter/copier but I have merged 2.3 with a loaded version of osCommerce a while back. If no one has an already merged version of product_info for you here's some untested tips.

 

The changes for QT Pro aren't too extensive so its easiest to start with the attribute sorter/copier version of product_info. Find the line $products_options_name = tep_db_query... Add column $special to the query like in the QT Pro line $products_options_name_query = tep_db_query....

 

Find the two lines beginning $products_options = tep_db_query... Add the two columns pa.options_id, pa.options_values_id like in the QT Pro line $products_options_query = tep_db_query...

 

Then find

        while ($products_options_values = tep_db_fetch_array($products_options)) {
         $products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name']);
         if ($products_options_values['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_values['price_prefix'] . $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) .') ';
         }

 

Replace this with the following from the QT Pro product_info changing $products_options_name with $products_options_name_values and $products_options with $products_options_values:

        while ($products_options = tep_db_fetch_array($products_options_query)) {
       //START get attribute stock values/show out of stock
       if (!$products_options_name['special']) {
         $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "(,|$)' AND products_stock_quantity > 0");
         if (tep_db_num_rows($attribute_stock_query)==0) {
            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => 'Out of Stock - ' . $products_options['products_options_values_name']);
          } else {
            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
          }
        }
        else {
          $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
        }
        // END get attribute stock values/show out of stock

   if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }

 

I think that should do it.

 

A future to-do for QT Pro is to include enough of the changes from Attribute Sorter/Copier to make the QT Pro changes compatible with Attribute Sorter/Copier to minimize the effort for merging the two or possibly just incorporating Attribute Sorter/Copier into QT Pro.

Link to comment
Share on other sites

Thanks alot Ralph

Your solution above seems to work fine with one small exception.

 

In the large code replacement above you have to change the line

while ($products_options = tep_db_fetch_array($products_options_query))

with

while ($products_options = tep_db_fetch_array($products_options))

 

I'm still not finished with all files in admin, I'll write back here if there are any problems.

Link to comment
Share on other sites

Hi Guys,

 

Have tried added this great contribution and got this error message.

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'and products_attributes.options_id=products_options.products_op

select products_name,products_options_name as _option,products_attributes.options_id as _option_id,products_options_values_name as _value,products_attributes.options_values_id as _value_id from products_description, products_attributes,products_options,products_options_values where products_attributes.products_id=products_description.products_id and products_attributes.products_id= and products_attributes.options_id=products_options.products_options_id and products_attributes.options_values_id=products_options_values.products_options_v
alues_id and products_description.language_id=1 and products_options_values.language_id=1 and products_options.special=0 and products_options.language_id=1 order by products_attributes.options_id, products_attributes.options_values_id

[TEP STOP]

 

can anyone help? pls? I see this error apprearing a few times in this thread but did not see any reply. help pls? Thanks in Advance! :)

Link to comment
Share on other sites

estrellashopping

 

products_attributes.products_id=products_description.products_id

and products_attributes.products_id= ***

and products_attributes.options_id=products_options.products_options_id

andproducts_attributes.options_values_id=products_options_values.products_option

s_values_id

and products_description.language_id=1

and products_options_values.language_id=1

and products_options.special=0

and products_options.language_id=1

 

*** = Something is missing.

Your online success is Paramount.

Link to comment
Share on other sites

Hi Yesudo,

 

Thanks. I've kind of get tt problem solved. :)

 

But here's another error. Got this during checkout_process.

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/includes/functions/database.php on line 103

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/estrella/public_html/includes/functions/database.php on line 103

Warning: Cannot modify header information - headers already sent by (output started at /home/estrella/public_html/includes/functions/database.php:103) in /home/estrella/public_html/includes/functions/general.php on line 29

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...