Zen Cart Logo
Forums / All Other Contributions/Addons / Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Views: 658,719

Results 981 to 1,000 of 3,609
29 Nov 2010, 12:27 PM
#981
sailsport avatar

sailsport

New Zenner

Join Date:
Jul 2010
Posts:
10
Plugin Contributions:
0

Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Just a quick note that in 4.11 there was a minor bug that you won't notice if you do not use table prefixes and I just loaded up 4.12 and this buglet is still there.

Admin/includes/classes/product_with_attributes_stock.php

line 227 has the table name hard coded

$sql = "UPDATE products_with_attributes_stock SET quantity = '$value' WHERE products_with_attributes_stock.stock_id =$id LIMIT 1";

instead of

$sql = "UPDATE ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK." SET quantity = '$value' WHERE ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.".stock_id =$id LIMIT 1";

Also,has anyone managed to add SKUs/EANS etc to Stock by Attribute, it would appear slightly tricky due to the denormalised structure, having just a single stock_by_attribute table, with the comma delimited list of attributes, rather than 2 tables, e.g. stock_by_attribute and stock_by_attribute_item, then it would perhaps be simpler to extend the'item' table to have additional columns?

29 Nov 2010, 2:16 PM
#982
sailsport avatar

sailsport

New Zenner

Join Date:
Jul 2010
Posts:
10
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Same hard code problem and fix on line 30 of products_with_attributes_stock_ajax.php

BTW adding SKU and Barcode wasn't as tricky as I thought. I made a fairly rudimentary addition to the table / code to store these values. Obviously getting the data off the database will depend where I want to use these fields. and I haven't looked at that yet :-)

29 Nov 2010, 5:11 PM
#983
artrat avatar

artrat

New Zenner

Join Date:
Aug 2007
Location:
NY
Posts:
26
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

sailsport:

Admin/includes/classes/product_with_attributes_stock.php

line 227 has the table name hard coded

$sql = "UPDATE products_with_attributes_stock SET quantity = '$value' WHERE products_with_attributes_stock.stock_id =$id LIMIT 1";

instead of

$sql = "UPDATE ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK." SET quantity = '$value' WHERE ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.".stock_id =$id LIMIT 1";
:bigups: Thank you thank you THANK YOU!!!

i'm seeing two more issues with this:
one i have not seen the the image named: ajax-loader2.gif in any of the versions i have downloaded. Which zip package has that? is called for during the search, on the admin/products_with_attributes_stock.php page.

also,
when the products_with_attributes_stock.php page first loads in the admin, the save buttons have no links at all until i first press the search button. odd. is that how it is supossed to work?

thanks

30 Nov 2010, 11:50 PM
#984
cheemeiw avatar

cheemeiw

New Zenner

Join Date:
Nov 2010
Posts:
2
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

I'm working with Zen Cart version 1.3.9f and have the first add-on of StockByAttributes_WITH-Table-Filter1.6 installed for that version. Then I got this error below and have tried to change the sql file following your forum reco but it is not working, I believe I might have made some mistakes here. I’ve searched high and low and for days but couldn’t figure this out.

Error:
1146 Table 'babynkid_zenc375.zen_products_with_attributes_stock' doesn't exist
in:
[select * from zen_products_with_attributes_stock where products_id = 1 and stock_attributes="1"]
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.

Changes made on sql file highlighted in red:
CREATE TABLE zen_products_with_attributes_stock (
stock_id INT NOT NULL AUTO_INCREMENT ,
products_id INT NOT NULL ,
stock_attributes VARCHAR( 255 ) NOT NULL ,
quantity FLOAT NOT NULL ,
PRIMARY KEY ( stock_id )
);

INSERT INTO configuration (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order,
last_modified, date_added, use_function, set_function)
VALUES ('Show available stock level in cart when less than order', 'STOCK_SHOW_LOW_IN_CART', 'false',
'When customer places more items in cart than are available, show the available amount on the shopping cart page:',
'9',
'6',
NULL,
now(),
NULL,
"zen_cfg_select_option(array('true', 'false'),"
);
/****************************Additional Databse command BELOW ********************************************************
michael mcinally [email protected]
heavily modified version BELOW to allow inserting "ALL" attributes at once
also should probably run this SQL command as well:
*************************************************************************************/
ALTER TABLE zen_products_with_attributes_stock ADD UNIQUE products_id_stock_attributes (products_id, stock_attributes);

Appreciate very much for your help.:cry:

30 Nov 2010, 11:59 PM
#985
cheemeiw avatar

cheemeiw

New Zenner

Join Date:
Nov 2010
Posts:
2
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

I'm working with Zen Cart version 1.3.9f and have the first add-on of StockByAttributes_WITH-Table-Filter1.6 installed for that version. Then I got this error below and have tried to change the sql file following your forum reco but it is not working, I believe I might have made some mistakes here. I’ve searched high and low and for days but couldn’t figure this out.

Error:
1146 Table 'babynkid_zenc375.zen_products_with_attributes_stock' doesn't exist
in:
[select * from zen_products_with_attributes_stock where products_id = 1 and stock_attributes="1"]
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.

Changes made on sql file highlighted in red:
CREATE TABLE zen_products_with_attributes_stock (
stock_id INT NOT NULL AUTO_INCREMENT ,
products_id INT NOT NULL ,
stock_attributes VARCHAR( 255 ) NOT NULL ,
quantity FLOAT NOT NULL ,
PRIMARY KEY ( stock_id )
);

INSERT INTO configuration (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order,
last_modified, date_added, use_function, set_function)
VALUES ('Show available stock level in cart when less than order', 'STOCK_SHOW_LOW_IN_CART', 'false',
'When customer places more items in cart than are available, show the available amount on the shopping cart page:',
'9',
'6',
NULL,
now(),
NULL,
"zen_cfg_select_option(array('true', 'false'),"
);
/****************************Additional Databse command BELOW ********************************************************
michael mcinally [email protected]
heavily modified version BELOW to allow inserting "ALL" attributes at once
also should probably run this SQL command as well:
*************************************************************************************/
ALTER TABLE zen_products_with_attributes_stock ADD UNIQUE products_id_stock_attributes (products_id, stock_attributes);

Appreciate very much on your help:cry:

4 Dec 2010, 9:31 AM
#986
sailsport avatar

sailsport

New Zenner

Join Date:
Jul 2010
Posts:
10
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

ArtRat:

:bigups: Thank you thank you THANK YOU!!!

also,
when the products_with_attributes_stock.php page first loads in the admin, the save buttons have no links at all until i first press the search button. odd. is that how it is supossed to work?

thanks

Just to let you know I get the same issue on my live & test systems, just I never noticed as in practice I always search first.

6 Dec 2010, 3:44 PM
#987
mermaidlisa avatar

mermaidlisa

New Zenner

Join Date:
Dec 2009
Location:
Singapore
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Hi,

I want to say thank so much for this awesome module. I've installed it on my zen cart v1.3.9h, and met a little problem.

I have a product with different colors with different levels of stock:

  • Black (3 pieces)
  • White (5 pieces)
  • Gold (3 pieces)

Settings under Config --> Stock
Check stock level: True
Substract stock: True
Allow checkout: false
Show available stock level in cart when less than order: true

I tested different situations and found that, when I added 5 pieces of Black into cart, and then 3 pieces of White, there was "out of stock" message for BOTH products, and the stock availability was, of course 0 for both of them. Even that I still had 5 White!

And the weird thing is that, when I changed the quantity of Black (which was the first item added to cart) to 3, and changed White to 6. The error message only showed for White, NOT Black!

Anyone has this same problem? Please me how I could fix this. Thank you so much!!

lisa

6 Dec 2010, 4:55 PM
#988
scrat avatar

scrat

Zen Follower

Join Date:
Dec 2005
Posts:
451
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mermaidlisaAs a matter of interest what values appear in the database for these products in the table : products_with_attributes_stock in the field : stock_attributes.

As I was experiencing a similar problem, and this would tell if it is the same, the order is very important for the comma separated values.

6 Dec 2010, 5:25 PM
#989
mermaidlisa avatar

mermaidlisa

New Zenner

Join Date:
Dec 2009
Location:
Singapore
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

@ Scrat: Currently, the stock levels for my demo product are 0, 3, 0, 7. And their stock_attributes shown in the database are 8, 7, 9, 10 respectively.

What's the meaning of stock_attributes by the way? Sorry I'm really new to this

6 Dec 2010, 8:40 PM
#990
scrat avatar

scrat

Zen Follower

Join Date:
Dec 2005
Posts:
451
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mermaidlisa So you only have one 'stock_attribute' per
product: ie

stock_id,stock_attribute,qty
num,8, 0
num,7,3
num,9,0
num,10,7

Its not the same issue I had by the sounds of it.

Have you 'Sync Quantities' your stocks to product !

'stock_attrubute' is the reference of your attribute product_attributes_id in the products_attributes table.

6 Dec 2010, 8:58 PM
#991
natty avatar

natty

New Zenner

Join Date:
Dec 2008
Posts:
65
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Hi fellow zenners

I have a problem on my store. I have now twice had a customer order out of stock items putting the stock level to -1

I have the setting to not allow out of stock checkouts

I have 1.3.9h zencart - updated from 1.3.9d and Stock by Attributes ver 1-4.12
I should note that I was on 1.3.9d when the first one came last week. I then updated everyhing and it happened again just now.

Something else I have noticed. If you add a product which is out of stock, the cart displays the warning it is out of stock. If you then add another in stock item it will display this as out of stock until you remove the out of stock product.

Anyone else getting this and can anyone help me resolve this?

Kind regards
Natty

7 Dec 2010, 9:35 AM
#992
mermaidlisa avatar

mermaidlisa

New Zenner

Join Date:
Dec 2009
Location:
Singapore
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Scrat:

mermaidlisa So you only have one 'stock_attribute' per
product: ie

Its not the same issue I had by the sounds of it.

Have you 'Sync Quantities' your stocks to product !

'stock_attrubute' is the reference of your attribute product_attributes_id in the products_attributes table.

Yeah I have 1 stock_attribute per attribute. my table looks like this.

stock_id, product_id, stock_attribute, quantity, sort
7, 59, 8 , 0, 0
3 , 59 , 7 , 3 , 0
5 , 59 , 9 , 0 , 0
6 , 59 , 10, 7 , 0

I have synced the quantities as well. So you have more than 1 stock_attribute per attribute? What is the issue that you have?

7 Dec 2010, 1:25 PM
#993
yuki avatar

yuki

New Zenner

Join Date:
Dec 2010
Location:
Jap
Posts:
2
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Hi guys,

Firstly, I appreciated for providing such a nice MOD,

My site v1.38a working wonderful.

Now I found a small bug as described here

In Shopping Cart, during shopping on zencart before loged in,

case ok

  1. product within a stock
  2. product with out of stock

Only No.2 shows error message as expected

case NG-1

  1. product with out of stock
  2. product within a stock

BOTH shows error. No.2 should not be an error.

case NG-2

  1. product within a stock
  2. product with out of stock
  3. product within a stock

NO.2 & NO.3 shows error. No.3 should not be an error

case NG-3

  1. product with out of stock
  2. product within a stock
  3. product within a stock

All product show error

I think it is clear there is a little bug for kind of "Array" coding?

I have no found this bug on v.1.4.11
after upgraded v.1.4.12 It happens.

Any idea?

Yuki....:oops:

7 Dec 2010, 2:31 PM
#994
mermaidlisa avatar

mermaidlisa

New Zenner

Join Date:
Dec 2009
Location:
Singapore
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

yuki:

Hi guys,

Firstly, I appreciated for providing such a nice MOD,

My site v1.38a working wonderful.

Now I found a small bug as described here

In Shopping Cart, during shopping on zencart before loged in,

case ok

  1. product within a stock
  2. product with out of stock

Only No.2 shows error message as expected

case NG-1

  1. product with out of stock
  2. product within a stock

BOTH shows error. No.2 should not be an error.

case NG-2

  1. product within a stock
  2. product with out of stock
  3. product within a stock

NO.2 & NO.3 shows error. No.3 should not be an error

case NG-3

  1. product with out of stock
  2. product within a stock
  3. product within a stock

All product show error

I think it is clear there is a little bug for kind of "Array" coding?

I have no found this bug on v.1.4.11
after upgraded v.1.4.12 It happens.

Any idea?

Yuki....:oops:

yes, this is exactly what happens :cry:. please please help us fix the bug!!

7 Dec 2010, 3:24 PM
#995
yuki avatar

yuki

New Zenner

Join Date:
Dec 2010
Location:
Jap
Posts:
2
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

huhuhu,

So you are.

Please let me add one more little thing,

compare to 1.4.11 Attribute control is far improved, THANKS!

But case below,

When products in shopping cart,

  1. Product with no Attribute or options with out of stock

After latest MOD patched, product like above stop showing error message of out of stock.

Could you check if that happens ???

Yuki,:oops:

7 Dec 2010, 6:39 PM
#996
mermaidlisa avatar

mermaidlisa

New Zenner

Join Date:
Dec 2009
Location:
Singapore
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

yuki:

huhuhu,

So you are.

Please let me add one more little thing,

compare to 1.4.11 Attribute control is far improved, THANKS!

But case below,

When products in shopping cart,

  1. Product with no Attribute or options with out of stock

After latest MOD patched, product like above stop showing error message of out of stock.

Could you check if that happens ???

Yuki,:oops:

YES!! Exactly! I didn't notice this until you pointed out :shocking:

And I can't proceed to the next step either. When I try to click "Continue", nothing happened

8 Dec 2010, 7:04 AM
#997
sportbiker avatar

sportbiker

Zen Follower

Join Date:
Aug 2008
Location:
Southern California
Posts:
127
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Zen Cart Version 1.3.8
Stock by Attributes Version 1.4.12 (nov 13 2010)

In short, I've installed the module, but I'm having a problem I can't figure out. Example: I have four sizes of socks through the "Add Quantity for Product Variant". I set inventory level on one size to zero, so it backorders. Fair enough. However, the other items in the shopping cart (hats, boots) also suddenly go to backorder status as well.

Any tips would be greatly appreciated. I see this question came up once before in this thread with no answer.

I doubt it matters for the purpose of this question, but if it does, my client doesn't really care at all about tracking real-world inventory levels. They simply want to use this mod to control items they know are out of stock so the customer is immediately informed through the checkout process. And yes, they still want the customer to be able to order the item, but just inform them that it's out of stock.

Thanks in advance!

15 Dec 2010, 7:29 AM
#998
mermaidlisa avatar

mermaidlisa

New Zenner

Join Date:
Dec 2009
Location:
Singapore
Posts:
27
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

mermaidlisa:

YES!! Exactly! I didn't notice this until you pointed out :shocking:

And I can't proceed to the next step either. When I try to click "Continue", nothing happened

any news about the "out-of-stock" bug yet? please please help us :cry:

31 Dec 2010, 6:08 PM
#999
abran1984 avatar

abran1984

New Zenner

Join Date:
Apr 2008
Location:
Lancaster, CA
Posts:
58
Plugin Contributions:
0

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

yuki:

Hi guys,

Firstly, I appreciated for providing such a nice MOD,

My site v1.38a working wonderful.

Now I found a small bug as described here

In Shopping Cart, during shopping on zencart before loged in,

case ok

  1. product within a stock
  2. product with out of stock

Only No.2 shows error message as expected

case NG-1

  1. product with out of stock
  2. product within a stock

BOTH shows error. No.2 should not be an error.

case NG-2

  1. product within a stock
  2. product with out of stock
  3. product within a stock

NO.2 & NO.3 shows error. No.3 should not be an error

case NG-3

  1. product with out of stock
  2. product within a stock
  3. product within a stock

All product show error

I think it is clear there is a little bug for kind of "Array" coding?

I have no found this bug on v.1.4.11
after upgraded v.1.4.12 It happens.

Any idea?

Yuki....:oops:
A client of mine noticed this bug, and I was tasked to fix it.

You only need to add two lines of code to one of the files included in the addon package.

  1. Open up /includes/modules/pages/shopping_cart/header_php.php
  2. Around line #137, you should see this line:
  • if (zen_not_null($stock_check))
  1. Add this line right before the line you found in step #2
  • $flagStockCheck = NULL;
  1. Around line #172, you should see this line:
  • $productArray[$i] = array(...
  1. Add an array element and value like this:
  • 'stockAvailable'=>$stockAvailable,

That should fix the issue with products below out of stock items showing up as out of stock when they aren't. It should also make the available stock quantities show up like they are supposed to.

I hope this helped you out. :)

31 Dec 2010, 11:16 PM
#1000
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Stock by Attribute v4.0 addon for v1.3.5-1.3.9

Can you clarify what it is you are suggesting to add/do in the steps I highlighted below.. are we adding the code in step 5 above, below, or as a replacement to the code in step 4??

abran1984:

A client of mine noticed this bug, and I was tasked to fix it.

You only need to add two lines of code to one of the files included in the addon package.

  1. Open up /includes/modules/pages/shopping_cart/header_php.php
  1. Around line #137, you should see this line:
  1. if (zen_not_null($stock_check))
  1. Add this line right before the line you found in step #2
  1. $flagStockCheck = NULL;
  1. Around line #172, you should see this line:
  1. $productArray[$i] = array(...
  1. Add an array element and value like this:
  1. 'stockAvailable'=>$stockAvailable,

That should fix the issue with products below out of stock items showing up as out of stock when they aren't. It should also make the available stock quantities show up like they are supposed to.

I hope this helped you out. :)