Zen Cart Logo
Forums / All Other Contributions/Addons / StockByAttributes with my stock id MOD 1.0.0

StockByAttributes with my stock id MOD 1.0.0

Views: 10,111

Results 21 to 40 of 87
8 Feb 2012, 3:45 PM
#21
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

StockByAttributes with my stock id MOD 1.0.0

Now my next problem....

It's showing them out of stock in the cart even though they have a qty of 5 for that size.

And the 'Save' button doesn't act like it's working. I click it and nothing happens.

8 Feb 2012, 4:01 PM
#22
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

A note for future reference....

If you put the model # in quote marks, you can use the same model number for all the sizes like I was originally doing in post #12.

8 Feb 2012, 4:17 PM
#23
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Yes, I noticed the distribution SQL file didn't make that field to be unique, I manually made mine unique so I couldn't screw up and use the same part number twice.

8 Feb 2012, 4:24 PM
#24
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Boggled:

Now my next problem....

It's showing them out of stock in the cart even though they have a qty of 5 for that size.

And the 'Save' button doesn't act like it's working. I click it and nothing happens.

I'm not seeing issues with either of those. I'm guessing the "Save" is on the Qty. edit in the Admin? it works but you have to sync quantities afterwards to make the total change. (at least on my installation) I did have an issue with the product showing out of stock if the item previously added was out of stock. I fixed that one though. You mentioned you have several other MODS installed, are you sure you didn't overwrite a file that something else needed instead of merging the files?

8 Feb 2012, 5:11 PM
#25
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

rhuseby:

I'm not seeing issues with either of those. I'm guessing the "Save" is on the Qty. edit in the Admin? it works but you have to sync quantities afterwards to make the total change. (at least on my installation) I did have an issue with the product showing out of stock if the item previously added was out of stock. I fixed that one though. You mentioned you have several other MODS installed, are you sure you didn't overwrite a file that something else needed instead of merging the files?

I fixed the SAVE button issue. Found the fix in the SBA thread.
I sync'd the quantities and it's still showing out of stock.
I did make sure not to overwrite any files, but I guess I could have screwed up merging one.

I've installed SBA ver 1.4.14 on two other carts recently and am having the same 'Out of Stock' in the cart issue with those too, so it must be something I'm not fixing or a setting.

Can you point me in the direction of what you fixed to resolve this issue on your version so I can check my files?

Also...if I try to just zero out a variant instead of delete it, I'm getting another SQL error:

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 ')' at line 1
in:
[insert into products_with_attributes_stock (products_id,stock_attributes,quantity,my_stock_id) values (1,"2,10,18,19",0,)]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

With the 1.4.14 ver I can just 0 them out and don't have to delete the whole variant.

I apologize for being such a pain :( I'm usually good at installing mods and can figure out a fix, but this SBA mod is driving me crazy.

8 Feb 2012, 5:17 PM
#26
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

No pain at all, some of this is problems with my MOD that I haven't seen and need to fix. Post #2 in this thread has a link to what I did to fix the out of stock message when the previous item was out of stock. I haven't seen the issue with zeroing out but it could be related to the issue that caused you to have to quote the part number. I'll play with it...

I just tried to duplicate the zero out issue using your part number that I had to quote. Couldn't duplicate the issue, it let me zero it out...

8 Feb 2012, 5:55 PM
#27
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

I checked and my file has the fix mentioned in post #2.

The problem I'm having is ALL products show out of stock all the time even if they have a qty of 100 units.

It just about has to be something I have set wrong or have edited/merged wrong.

One of the other mods installed is Fast & Easy Checkout, but I still get the same out of stock error even with it turned off.

8 Feb 2012, 5:59 PM
#28
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

rhuseby:

I just tried to duplicate the zero out issue using your part number that I had to quote. Couldn't duplicate the issue, it let me zero it out...

Weird. I click on the edit quantity, put 0 as the qty on the next page, hit submit and get the SQL syntax error message.

Wonder if it's tied into the issue I'm having with the out of stock?

8 Feb 2012, 6:12 PM
#29
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Boggled:

Weird. I click on the edit quantity, put 0 as the qty on the next page, hit submit and get the SQL syntax error message.

Wonder if it's tied into the issue I'm having with the out of stock?

UPDATE: If I add each size with it's own individual model number (eg F1-A-XS), it works to just 0 it out. If I add them in bulk and give all sizes the same model number (eg F1-A), then it throws the error.

8 Feb 2012, 6:34 PM
#30
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

rhuseby:

I may need to change the code, try quoting the part number:
"F1-A-XS"

admin/products_with_attributes_stock.php line #252

$query = 'insert into '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.' (products_id,stock_attributes,quantity,my_stock_id) values ('.$products_id.',"'.$attributes.'",'.$quantity.','.$my_stock_id.')';

Add quotes around last "'.my_stock_id.'" (same as I had to do to $attributes already.

This should fix that but I think having the same part number for multiple items may be more trouble than it's worth if it's just that one item. I created this specifically to have unique numbers on all variants... I will include this change in the next release. Thanks for pointing it out. :blush:

8 Feb 2012, 6:38 PM
#31
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

I don't know if this might be a 'clue' or not, but I just noticed that in the shopping cart it is showing the 'parent model #' instead of the variant model # like it should (based on the screenshots included in your mod).

I've attached screenshots of the item in the cart and in SBA. It's model # in SBA is F1-A-L.

8 Feb 2012, 6:44 PM
#32
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

rhuseby:

admin/products_with_attributes_stock.php line #252

$query = 'insert into '.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.' (products_id,stock_attributes,quantity,my_stock_id) values ('.$products_id.',"'.$attributes.'",'.$quantity.','.$my_stock_id.')';

Add quotes around last "'.my_stock_id.'" (same as I had to do to $attributes already.

This should fix that but I think having the same part number for multiple items may be more trouble than it's worth if it's just that one item. I created this specifically to have unique numbers on all variants... I will include this change in the next release. Thanks for pointing it out. :blush:

Perfect! :smile: Don't have to add the quotes now.

Thank you so much for helping me on this!!

8 Feb 2012, 7:08 PM
#33
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Boggled:

I don't know if this might be a 'clue' or not, but I just noticed that in the shopping cart it is showing the 'parent model #' instead of the variant model # like it should (based on the screenshots included in your mod).

I've attached screenshots of the item in the cart and in SBA. It's model # in SBA is F1-A-L.

I designed it to do that when the product doesn't have attributes, otherwise the display was blank under the product in the cart. It would just show (Item# ) with no part number. Hmmmm, not sure why it's not seeing that the product has attributes. I had to play with this feature for several days and thought I had tested about every scenario. Do you have a testbed setup where you could install ZC clean with just this mod to make sure it's working correctly, then add other mods you need. I'm using VMware player to run a bunch of test carts on their own server... I loaded up a clean install of ZC, then copied it as a backup, so now I can copy it and fire it up as a new clean server as many times as I need.

8 Feb 2012, 7:14 PM
#34
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

rhuseby:

I designed it to do that when the product doesn't have attributes, otherwise the display was blank under the product in the cart. It would just show (Item# ) with no part number. Hmmmm, not sure why it's not seeing that the product has attributes. I had to play with this feature for several days and thought I had tested about every scenario. Do you have a testbed setup where you could install ZC clean with just this mod to make sure it's working correctly, then add other mods you need. I'm using VMware player to run a bunch of test carts on their own server... I loaded up a clean install of ZC, then copied it as a backup, so now I can copy it and fire it up as a new clean server as many times as I need.

Yes, I have a way to set up a test site. Let me try that and see what happens.

8 Feb 2012, 8:46 PM
#35
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Fresh install 1.3.9h
Fresh install StockByAttributes_1.4.13_with_my_stock_id_MOD_1.0.0

Only changes I made to the mod were the SAVE button fix mentioned here and the quotes fix mentioned in post #30.

Started the product with 0 qty in stock (in the product listing), added the qty in SBA to each size variant.

Getting the exact same results as before. Out of stock in cart and only showing parent model #.

Cart is installed on the same server as the other cart, so the environment is the same.

Made no changes to the cart configuration (stock out of the box setup) whatsoever other than to show qty in stock in the cart.

Was hoping it would work so I would know it was a possible mod conflict. Now I'm at a complete loss as to what it could possibly be.

8 Feb 2012, 10:32 PM
#36
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Boggled:

Fresh install 1.3.9h
Fresh install StockByAttributes_1.4.13_with_my_stock_id_MOD_1.0.0

Only changes I made to the mod were the SAVE button fix mentioned here and the quotes fix mentioned in post #30.

Started the product with 0 qty in stock (in the product listing), added the qty in SBA to each size variant.

Getting the exact same results as before. Out of stock in cart and only showing parent model #.

Cart is installed on the same server as the other cart, so the environment is the same.

Made no changes to the cart configuration (stock out of the box setup) whatsoever other than to show qty in stock in the cart.

Was hoping it would work so I would know it was a possible mod conflict. Now I'm at a complete loss as to what it could possibly be.

I thought I had included the save button fix? I'm not sure what it could be... I am using Windows Server, I wonder if it's PHP interpreter acts differently... The routines that are supposed to determine if a product has attributes and return the model if not are in the function_lookups file. The first part looks for attributes, if no, returns the model, then the last few do about the same thing. My PHP ver. is 5.3.8 for Windows.

8 Feb 2012, 10:49 PM
#37
boggled avatar

boggled

Zen Follower

Join Date:
Mar 2006
Location:
Tennessee
Posts:
286
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

rhuseby:

I thought I had included the save button fix? I'm not sure what it could be... I am using Windows Server, I wonder if it's PHP interpreter acts differently... The routines that are supposed to determine if a product has attributes and return the model if not are in the function_lookups file. The first part looks for attributes, if no, returns the model, then the last few do about the same thing. My PHP ver. is 5.3.8 for Windows.

Don't know if any of this will make a difference, but this is what I have it running on:

Server OS: Linux 2.6.38.7
Database: MySQL 5.1.56
HTTP Server: Apache
PHP Version: 5.2.17 (Zend: 2.2.0)
PHP Memory Limit: 256M
PHP Safe Mode: Off

8 Feb 2012, 10:54 PM
#38
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Boggled:

Fresh install StockByAttributes_1.4.13_with_my_stock_id_MOD_1.0.0

1.0.1 is available for download, it includes the out of stock problem I ran into if you want to try it. Also my funtion doesn't determine quantity on hand the original SBA function still handles that. It seems like a stock check somewhere isn't working, even if my_stock_id isn't working you should get the correct quantity on hand. You could try the original StockByAttributes mod and see if it works, then compare it's files to mine.

8 Feb 2012, 10:56 PM
#39
rhuseby avatar

rhuseby

New Zenner

Join Date:
Nov 2011
Location:
Atlanta, GA
Posts:
44
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Boggled:

Don't know if any of this will make a difference, but this is what I have it running on:

Server OS: Linux 2.6.38.7
Database: MySQL 5.1.56
HTTP Server: Apache
PHP Version: 5.2.17 (Zend: 2.2.0)
PHP Memory Limit: 256M
PHP Safe Mode: Off

Might be the older PHP... :unsure:

9 Feb 2012, 2:43 AM
#40
rooster_cogbern avatar

rooster_cogbern

New Zenner

Join Date:
Jan 2012
Posts:
10
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

Not sure if this fits your particular problem, but I thought I might have the same problem... with the "out of stock", however, I found that if you choose a configuration on the webstore that you have not assigned a variant combination to.. it will show out of stock. (see attachements)

So basically, once you have created a variant to your products using Products with Attributes Stock.. you have to account for every variant combination with a quantity and my_stock_id.

If that isn't it.. try commenting out the lines 111-113 in /templates/YOUR TEMPLATE/ tpl_shopping_cart_default.php

so change starting at line 108:

  echo '<ul>';
    reset($product['attributes']);
    foreach ($product['attributes'] as $option => $value) {
        $product_options_name = $value['products_options_name'];
        $product_options_name_array = explode(":", $product_options_name);
        $product_options_name = $product_options_name_array[0];
?>

to:

  echo '<ul>';
    reset($product['attributes']);
    foreach ($product['attributes'] as $option => $value) {
        //$product_options_name = $value['products_options_name'];
        //$product_options_name_array = explode(":", $product_options_name);
        //$product_options_name = $product_options_name_array[0];
?>

I compared rhuseby's tpl_shopping_cart_default.php to mine and that was the only difference. Not sure why mine didn't have that code.. as posted earlier, I just hack..

Good luck.

Rooster