Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
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?
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
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 :-)
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
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
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
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 <mcinallym@picassofish.com>
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:
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
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 <mcinallym@picassofish.com>
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:
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Quote:
Originally Posted by
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.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
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
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
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.
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
@ 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
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
mermaidlisa So you only have one 'stock_attribute' per
product: ie
Quote:
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.