Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

Ok, First of all a BIG TIME THANKS to all who have worked on this issue. I have got mine working, except for one thing. I have probably missed something in this thread, but as a non-tech person, I think I've done very well at managing php so far.

 

 

My issue is this: A customer is allowed to select an item with two attributes (white, small) that has zero stock. They properly get the warning that "Products marked with *** dont exist in desired quantity in our stock.

You can select them anyway and check the quantity we have in stock for immediate deliver in the checkout process."

 

Since I had some of the "White, Medium" they didn't get the "out of stock message" for the Color. (That's cool, since there are white - mediums available, I wouldn't want the White - Out of Stock message to show, so we're good here :thumbsup: )

 

The problem is, that the checkout procedure lets them finish the purchase AS IF the items were in stock, with no message, block, hard stop, or anything to indicate that the item wasn't in stock, and that theoretically the vendor doesn't have the item for delivery. In fact, it will send the email saying "congrats, your order should arrive in xx days." Definitely NOT cool :o

 

Is this the way the contribution is designed to work? Or have I done something in my earlier file adjustments that erased this functionality.

Share this post


Link to post
Share on other sites
The problem is, that the checkout procedure lets them finish the purchase AS IF the items were in stock, with no message, block, hard stop, or anything to indicate that the item wasn't in stock, and that theoretically the vendor doesn't have the item for delivery.  In fact, it will send the email saying "congrats, your order should arrive in xx days."  Definitely NOT cool :o

 

Is this the way the contribution is designed to work?  Or have I done something in my earlier file adjustments that erased this functionality.

 

You need to set your configuration to track stock and to not allow checkout for out of stock items. Go into Admin and select Stock under the Configuration section. Make sure Check Stock is set to true and Allow Checkout is set to false.

 

If these settings are correct, make sure you didn't indadvertently leave out checkout_process.php from the contribution.

Share this post


Link to post
Share on other sites

I have installed QTPRO and with a bit of tweaking here and there (because I have the Basic Template System installed ) everything seems to be working all the way through to checkout.

 

The actual problem I have is with the drop down menu in the products, it won't sort in order, it doesn't seem to follow any logic. I have looked through this contribution support thread and have seen a couple of suggestions to do with the options_id in the database but they don't seem to work for me. Is there a way of re-sorting the drop down menu at the point of it being displayed, i'm no php guru so any help would be greatly received.

 

Derek

Edited by Arcadiauk

Share this post


Link to post
Share on other sites
I have installed QTPRO and with a bit of tweaking here and there (because I have the Basic Template System installed ) everything seems to be working all the way through to checkout.

 

The actual problem I have is with the drop down menu in the products, it won't sort in order, it doesn't seem to follow any logic. I have looked through this contribution support thread and have seen a couple of suggestions to do with the options_id in the database but they don't seem to work for me. Is there a way of re-sorting the drop down menu at the point of it being displayed, i'm no php guru so any help would be greatly received.

 

Derek

 

Please ignore my message above, I found a 'work around' that works without altering the PHP script :)

 

Derek

Share this post


Link to post
Share on other sites
Please ignore my message above, I found a 'work around' that works without altering the PHP script :)

 

Derek

 

 

Mind pointing us to that workaround. I used the search and couldn't find anything.

 

Thanks

Share this post


Link to post
Share on other sites
Mind pointing us to that workaround.  I used the search and couldn't find anything.

 

Thanks

 

 

The work around is fairly simple really, here was our problem.

 

Our new shop will be selling lingerie and this is why we needed QTPRO because qty's needed to be given to different bra sizes. Eg: White 34A, White 34B, White 34D etc etc.

The problem we had was, instead of the attributes being listing as follows....

 

White 34A

White 34B

White 34C

White 34D

 

We were getting lists like this...

 

White 34A

White 34D

White 34C

White 34B

 

Our work around was this..

 

We made a note of the problem attributes and then went into the admin panel Product Attributes section. We then went into the "OPTION VALUES" area and located the attribute for White 34D and changed it to White 34B and also changed White 34B to White 34D. This then corrected the sequence in the product pull down menu.

 

This was all done with no stock in these items.

 

Simple really.

 

Hope i have explained that correctly.

 

 

Derek

Share this post


Link to post
Share on other sites
The actual problem I have is with the drop down menu in the products, it won't sort in order, it doesn't seem to follow any logic. I have looked through this contribution support thread and have seen a couple of suggestions to do with the options_id in the database but they don't seem to work for me. Is there a way of re-sorting the drop down menu at the point of it being displayed, i'm no php guru so any help would be greatly received.

 

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.

Share this post


Link to post
Share on other sites

I found another bug with the checking of stock in this contribution when using multiple attributes. stock.php does not sort the attributes properly (neither did general.php as I posted earlier). So in addition to the fixes I already posted for multiple attributes:

 

Find this in /catalog/admin/stock.php on line 33:

    sort($val_array);

 

and replace it with:

    sort($val_array, SORT_NUMERIC);

 

You'll only run into this if you have 20 or more options defined in your store (not for one product) and you setup a product to use 3 or more options - something like options 2, 11 and 20. stock.php will insert the attributes for a product into the database with them sorted '11-x,2-y,20-z' and general.php will be looking for '2-y,11-x,20-z', not find it and report it out of stock.

Share this post


Link to post
Share on other sites
You'll only run into this if you have 20 or more options defined in your store (not for one product) and you setup a product to use 3 or more options - something like options 2, 11 and 20.  stock.php will insert the attributes for a product into the database with them sorted '11-x,2-y,20-z' and general.php will be looking for '2-y,11-x,20-z', not find it and report it out of stock.

 

Doh! What was I thinking. This can happen with 10 or more products defined in your store and products using only 2 options. stock.php will use '10-x,9-y' and general.php '9-y,10-x'.

Share this post


Link to post
Share on other sites

Aaaargh! Yet another spot where the sorting is wrong. This one affects subtracting stock with multiple attributes. Same problem as with stock.php

 

To fix, find this in catalog/checkout_process.php:

                asort($products_stock_attributes_array);

 

And replace it with this:

                asort($products_stock_attributes_array, SORT_NUMERIC);

 

I'm pretty sure that's the last of them.

Share this post


Link to post
Share on other sites

I have packaged up the mulitple attributes fixes I have posted along with some other fixes and posted them as a contribution file. Note that multiple attributes will show an attribute as out of stock only if out of stock in all combinations. This means a customer may add an out of stock combination to the cart.

 

 

QT Pro 3.1

Share this post


Link to post
Share on other sites

AWESOME JOB RAPLH!

 

If there is anything i can do to help ralph, let me know! I am all about nailing this thing down.

 

Staaby

Share this post


Link to post
Share on other sites

I just downloaded and installed QT pro 3.1, hoping that it would allow me to specify how many of each attribute I have available, but I am not seeing that as an option.

 

Is QTpro cabable of doing that, or is it just a way to report how many of each attribute are sold?

 

I have products that come in multiple flavors, say one protein shake can come in vanilla, chocolate, and strawberry. I may have 50 jars in total, but 20 may be vanilla, 15 chocolate, and 15 strawberry, etc.

 

I need a way to specify the above quantities per attribute. Is there a way I can do that? Please let me know! Thanks.

Share this post


Link to post
Share on other sites
I just downloaded and installed QT pro 3.1, hoping that it would allow me to specify how many of each attribute I have available, but I am not seeing that as an option.

 

Is QTpro cabable of doing that, or is it just a way to report how many of each attribute are sold?

 

I have products that come in multiple flavors, say one protein shake can come in vanilla, chocolate, and strawberry. I may have 50 jars in total, but 20 may be vanilla, 15 chocolate, and 15 strawberry, etc.

 

I need a way to specify the above quantities per attribute. Is there a way I can do that? Please let me know! Thanks.

 

This should be what you are looking for. Under the admin>catalog>item, you should now see a "STOCK" button on the right hand side (over by add/move/edit/etc). Under here, you can add quantities to each attribute. Let me know if you are still having issues.

 

Staaby

Edited by Staaby

Share this post


Link to post
Share on other sites
This should be what you are looking for.  Under the admin>catalog>item, you should now see a "STOCK" button on the right hand side (over by add/move/edit/etc).  Under here, you can add quantities to each attribute.  Let me know if you are still having issues.

 

Staaby

 

 

Yes, that did work. Thanks. I just wasnt seeing the button.

 

I do have another question though. When I go to stock.php, I get this error message,

 

1064 - You have an error in your SQL syntax near 'and products_attributes.options_id=products_options.products_options_id and prod' at line 1

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]

 

Any idea why I am getting that?

Share this post


Link to post
Share on other sites

Sounds like you dont have the SQL tables set up. You should have a .sql file in the package that will need to be put into your database. You can use a tool like phpmyadmin to do this.

Share this post


Link to post
Share on other sites
Sounds like you dont have the SQL tables set up.  You should have a .sql file in the package that will need to be put into your database.  You can use a tool like phpmyadmin to do this.

 

Nope, the tables are setup. I ran the SQL file. I think it works actually, because if I press the stock button as you mentioned, it works, but if I go directly to stock.php it doesnt. Maybe because there are no variables telling it what product to look at.

Share this post


Link to post
Share on other sites
Nope, the tables are setup. I ran the SQL file. I think it works actually, because if I press the stock button as you mentioned, it works, but if I go directly to stock.php it doesnt. Maybe because there are no variables telling it what product to look at.

 

Yes, stock.php requires the product_id parameter passed to it on the query string to work.

Share this post


Link to post
Share on other sites
Yes, stock.php requires the product_id parameter passed to it on the query string to work.

 

You probably have it running on an older vesion of PHP.

I had this problem, and I changed the first few lines of stock.php from

 

 if ($_SERVER['REQUEST_METHOD']="GET"){
   $VARS=$_GET;
 } else {
   $VARS=$_POST;
 }

 

to

 
if ($_SERVER['REQUEST_METHOD']="GET"){
   $VARS=$HTTP_GET_VARS;
 } else {
   $VARS=$HTTP_POST_VARS;
 }

 

Try this and see if it works.

 

Tim

Share this post


Link to post
Share on other sites

oops, i meant this:

 

 if ($_SERVER['REQUEST_METHOD']="GET") {
   $VARS=$HTTP_GET_VARS;
 }  else  {
   $VARS=$HTTP_POST_VARS;
 }
 $product_id = $VARS['product_id'];

 

it worked for me.

 

Tim

Share this post


Link to post
Share on other sites
oops, i meant this:

 

 if ($_SERVER['REQUEST_METHOD']="GET") {
? ?$VARS=$HTTP_GET_VARS;
?} ?else ?{
? ?$VARS=$HTTP_POST_VARS;
?}
?$product_id = $VARS['product_id'];

 

it worked for me.

 

Tim

 

Hye man, thanks for this. I was having the same problem, and this did take away the SQL syntax problem, BUT...

 

Now the stock.php comes out blank as a sheet of paper...Just blank...nothing at all...

 

 

Any ideas?

Share this post


Link to post
Share on other sites

Actually, I took care of the prior post..Stupid extra space...Now I do get the stock.php showing up , yet:

 

A: When I add a new product the quantity amount gets entered in the db just fine. I see it happen, it shows up fine.

 

B; BUT the update quantity feature does not....The quantity does not get change, and after submitting the form, the text field shows up with the quantity as it was before.

 

Somehow the "quantity" variable is not getting updated in the db..not getting there...

 

I found the code for this action here:

...

 

if ($action=="Update")

{

tep_db_query("update products set products_quantity=$VARS[quantity] where products_id=$VARS[product_id]");

}

...

 

So I am trying to figure out what's up. Anybody with similar problems? I am running a Headers Tag Control + Ultrapics + easy populate + STS version of osc...still have to add two more contribus.

Share this post


Link to post
Share on other sites
Hye man, thanks for this. I was having the same problem, and this did take away the SQL syntax problem, BUT...

 

Now the stock.php comes out blank as a sheet of paper...Just blank...nothing at all...

Any ideas?

Is this running stock.php directly or using the admin inteface and clicking the stock button? stock.php is not designed to be run standalone, it needs the parameters passed by the stock button to work.

Share this post


Link to post
Share on other sites
Is this running stock.php directly or using the admin inteface and clicking the stock button?  stock.php is not designed to be run standalone, it needs the parameters passed by the stock button to work.

 

I guess you posted righty at the same time...Yes, I guess what I meant was that the stock.php apge was not operating right.

 

I guess my only problem as far as I can tell is teh whole update thing.

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

×