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 1 to 20 of 87
22 Jan 2012, 4:39 PM
#1
rhuseby avatar

rhuseby

New Zenner

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

StockByAttributes with my stock id MOD 1.0.0

This thread is setup to discuss the addon StockByAttributes with my stock id MOD 1.0.0. I will monitor this thread and help out if I can. I your welcome comments and suggestions or further modifications that will improve the functionality of Stock by Attributes. Our collaboration of ideas is what make Zen Cart a great ecommerce solution!

:cheers:

26 Jan 2012, 6:37 PM
#3
kawaii avatar

kawaii

New Zenner

Join Date:
Oct 2011
Posts:
5
Plugin Contributions:
0

Re: StockByAttributes with my stock id MOD 1.0.0

hi i tried installing this module however now each time we try adding a product to our shopping cart we are given this error message

1364 Field 'my_stock_id' doesn't have a default value
in:
[insert into customers_basket (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('2', '578:c5c7fb3fb7af803b572d551b0aba3f83', '5', '20120127')]

27 Jan 2012, 12:22 AM
#4
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

kawaii:

hi i tried installing this module however now each time we try adding a product to our shopping cart we are given this error message

1364 Field 'my_stock_id' doesn't have a default value
in:
[insert into customers_basket (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('2', '578:c5c7fb3fb7af803b572d551b0aba3f83', '5', '20120127')]

Are you sure you replaced the file:
"store-root"/includes/classes/shopping_cart.php

This file should be adding the value that it's looking for...

    if ($product->RecordCount()<=0) {
      $sql = "insert into " . TABLE_CUSTOMERS_BASKET . "
                            (customers_id, products_id, customers_basket_quantity,
                             customers_basket_date_added, my_stock_id)
                             values ('" . (int)$_SESSION['customer_id'] . "', '" . zen_db_input($products_id) . "', '" .
      $qty . "', '" . date('Ymd') . "', '" . $my_stock_id . "')"; // rhuseby: (my_stock_id MOD)

      $db->Execute($sql);
28 Jan 2012, 8:38 PM
#5
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

rhuseby - new to ZC and have 1.5.0 installed. Downloaded SBA w/ SI Mod and followed your instructions.. but getting a HTTP 500 error after I login to the site. My guess is that this mod is not compatible.. but wanted to double check. Thanks,

Rooster

29 Jan 2012, 2:42 PM
#6
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

rooster_cogbern:

rhuseby - new to ZC and have 1.5.0 installed. Downloaded SBA w/ SI Mod and followed your instructions.. but getting a HTTP 500 error after I login to the site. My guess is that this mod is not compatible.. but wanted to double check. Thanks,

Rooster

:no:No, it was written for 1.3.9, I don't think the base MOD Stock By Attributes has been ported to work with 1.5.0...

30 Jan 2012, 11:19 PM
#7
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

rhuseby,

After much tinkering and hacking, I think I got SBA working for 1.5.0.. well, I can modify stock attributes.. still working to show the MyStockID.. but a little more hacking I should get it. Wasn't too hard, just looked at the code adds for the 6 main files and added it to my 1.5.0 files. Also needed to add the page in admin_pages in MySQL.

That being said, curious if you would know an easy way to turn-off the stock attributes for some of the attributes. If I leave it blank, it won't accept the change.

Thanks,

Rooster

31 Jan 2012, 1:59 PM
#8
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

Not sure I follow what you're asking... A product only has attributes if you assign them. Are you working with demo data? I typically don't install the demo data and start with a clean database.

31 Jan 2012, 7:28 PM
#9
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

It might help if I explained what I am looking to do. My client is a wheel mfg. for road and mountain bikes. We are creating a web shopping cart for his US dealers. Our products can be customized, but are shipped from our suppliers in a pre-configured style.. which is how his accounting software tracks it. So, if I had 20 sets of wheels for item A and 0 on hand for item B, I need to show that I have 20 sets of wheels that can be configured as either A or B.

So your my_stock_id is perfect for representing the SKU# which needs to be identified based on the attributes choosen for the configuration.

The problem.. is actually using the SBA.. because I need the product to have attributes that can be configured to represent a SKU, but the stock needs to be tracked at the product level.

What I am thinking of doing is creating a "Track by stock" flag that will enable/disable the stock for each particular attribute.. but still allow me to use the my_stock_id MOD.

I think that it is probably the best course of action, since your MOD is built into the SBA.

So, my question is, (A) Would this course be the best and (B) if so, in general terms, how would you approach it?

Thanks -

Rooster

1 Feb 2012, 4:42 PM
#10
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 think that would be what you would have to do since SBA is specifically for having quantity for each variant. You could turn off the stock check, set all the variants to zero and add the quantity in the zen cart product area. I'm assuming it would still subtract quantity at the product level when something is purchased. You could maybe pay someone to write what you really need, not me I'm not a "real" programmer, more of a hack. When I was looking for custom work I thought "That Software Guy" looked like a good choice...

3 Feb 2012, 6:37 PM
#11
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 have corrected one issue since uploading this mod. Explaination and fix are posted here:
http://www.zen-cart.com/forum/showpost.php?p=1096222&postcount=1408

Submitted ver. 1.0.1 that includes this fix... :smile:

8 Feb 2012, 2:08 AM
#12
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

Just finished installing this on 1.3.9h cart. Fresh install cart, but with several other mods.

Added an item with 8 sizes and 8 color attributes.

I tried to add a qty of 20 Gloss Black model #F1-A (left sizes set on ALL).
When I clicked submit I got the following error:

1054 Unknown column 'F1-A' in 'field list'
in:
[insert into products_with_attributes_stock (products_id,stock_attributes,quantity,my_stock_id) values (1,"10,18,19,7",20,F1-A) ON DUPLICATE KEY UPDATE stock_attributes = "10,18,19,7", quantity = 20]
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.

Any idea what I might have done wrong or what might be causing this?

8 Feb 2012, 3:34 AM
#13
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

Boggled:

Just finished installing this on 1.3.9h cart. Fresh install cart, but with several other mods.

Added an item with 8 sizes and 8 color attributes.

I tried to add a qty of 20 Gloss Black model #F1-A (left sizes set on ALL).
When I clicked submit I got the following error:

Any idea what I might have done wrong or what might be causing this?
Boggled,

Did you run the SQL scripts that added the "my_stock_id" column in the 'products_with_attributes_stock' table?

8 Feb 2012, 3:39 AM
#14
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

Hi,

Yes, I ran the SQL file that came with the mod named stock_attribute_my_stock_id.sql.
I even did it a second time, thinking maybe I had missed doing that. (It's been a long day! lol )

Thanks! :)

8 Feb 2012, 2:10 PM
#15
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:

Just finished installing this on 1.3.9h cart. Fresh install cart, but with several other mods.

Added an item with 8 sizes and 8 color attributes.

I tried to add a qty of 20 Gloss Black model #F1-A (left sizes set on ALL).
When I clicked submit I got the following error:

Any idea what I might have done wrong or what might be causing this?

So all sizes use the same part number? I set the field my_stock_id to not allow duplicates. You could use MYSQL admin to set the field to allow duplicates, but I would suggest having a unique part number for every variant...

8 Feb 2012, 2:13 PM
#16
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

rooster_cogbern:

rhuseby,

After much tinkering and hacking, I think I got SBA working for 1.5.0.. well, I can modify stock attributes.. still working to show the MyStockID.. but a little more hacking I should get it. Wasn't too hard, just looked at the code adds for the 6 main files and added it to my 1.5.0 files. Also needed to add the page in admin_pages in MySQL.

That being said, curious if you would know an easy way to turn-off the stock attributes for some of the attributes. If I leave it blank, it won't accept the change.

Thanks,

Rooster

Did you get it working on v1.5.0?

8 Feb 2012, 2:52 PM
#17
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:

So all sizes use the same part number? I set the field my_stock_id to not allow duplicates. You could use MYSQL admin to set the field to allow duplicates, but I would suggest having a unique part number for every variant...

On this particular item all sizes use the same part number, but other products don't.

I tried doing just XS Gloss Black F1-A-XS and now I get this error:

1054 Unknown column 'F1' in 'field list'
in:
[insert into products_with_attributes_stock (products_id,stock_attributes,quantity,my_stock_id) values (1,"7,10,18,19",5,F1-A-XS)]
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.

I could live with adding a size identifier on each combination, but are they ALL going to show up in the dropdown boxes?

8 Feb 2012, 3:09 PM
#18
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:

On this particular item all sizes use the same part number, but other products don't.

I tried doing just XS Gloss Black F1-A-XS and now I get this error:

I could live with adding a size identifier on each combination, but are they ALL going to show up in the dropdown boxes?

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

8 Feb 2012, 3:24 PM
#19
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

rhuseby:

Did you get it working on v1.5.0?
Yes - wasn't too difficult. I manually went through your mod and added the code to my original php files. (after making backups of course) Basically inserting the code around the v.1.5.0.. and testing as I went.

As you mentioned earlier, hacking is much easier than coming up with it on your own.

BTW, still looking to add the Include/Exclude flag for Stock Quantity. Had asked the Software Guy, but he passed. Might take it to the original SBA thread(s) and ask if anyone has a mock up/ and or willing to send me a PM to folks that might be interested.

8 Feb 2012, 3:39 PM
#20
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 may need to change the code, try quoting the part number:
"F1-A-XS"

That worked. :)