-
Re: Stocks by attributes
I sometimes get confused as to where a prefix would go.
This sql patch from the latest SBA update. Is this sql code ok to use for a cart that uses no prefix? The configure file shows no prefix is in use.
PHP Code:
CREATE TABLE 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 ,
sort INT 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'),"
),
('Display Images in Admin', 'STOCK_SHOW_IMAGE', 'false',
'Display image thumbnails on Products With Attributes Stock page? (warning, setting this to true can severly slow the loading of this page):',
'9',
'6',
NULL,
now(),
NULL,
"zen_cfg_select_option(array('true', 'false'),"
);
-
Re: Stocks by attributes
I am installing SBA 1.4.12 on a test cart 139h with a prefix of zen_
I installed the sql patch as provided in admin > tools > install sql patches and the table insertion appears to go well.
PHP Code:
Query Results:
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 , sort INT NOT NULL , PRIMARY KEY ( stock_id ) );
INSERT INTO zen_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')," ), ('Display Images in Admin', 'STOCK_SHOW_IMAGE', 'false', 'Display image thumbnails on Products With Attributes Stock page? (warning, setting this to true can severly slow the loading of this page):', '9', '6', NULL, now(), NULL, "zen_cfg_select_option(array('true', 'false')," );
phpmyadmin shows the table: zen_products_with_attributes_stock is there
The problem I run into is this:
When stock by attributes is applied to a product it works fine but if I try to update product stock amounts in bulk on the stock by attributes main page and click the save button I get this error message
PHP Code:
1146 Table 'myusername_databasename.products_with_attributes_stock' doesn't exist
in:
[UPDATE products_with_attributes_stock SET quantity = '125' WHERE products_with_attributes_stock.stock_id =1 LIMIT 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.
any ideas why this is happening? Could it be the code in one or more of the files needs to have the prefix added?
-
Re: Stocks by attributes
ok I went through the files and added the prefix zen_ to line 227
PHP Code:
$sql = "UPDATE zen_products_with_attributes_stock SET quantity = '$value' WHERE zen_products_with_attributes_stock.stock_id =$id LIMIT 1";
This seems to have fixed the bulk update problem. Unless I run into an unforseen consequence.
While this (seems) to work I can't imagine this is the correct fix because if I applied this to the package to install elsewhere...well, not everyone has the same prefix.
Am I on the right track.
Can anyone comment on this?
Does this error happen to anyone else?
-
Re: Stocks by attributes
well it would be a good idea to state which file I edited wouldn't it
zc_admin/includes/classes/products_with_attributes_stock.php
-
Re: Stocks by attributes
Better would be
PHP Code:
$sql = "UPDATE " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " SET quantity = '$value' WHERE stock_id =$id LIMIT 1";
for the reason you said.
-
Re: Stocks by attributes
Quote:
Originally Posted by
kuroi
Better would be
PHP Code:
$sql = "UPDATE " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " SET quantity = '$value' WHERE stock_id =$id LIMIT 1";
for the reason you said.
Thank you very much!!
That did the trick.
-
Re: Stocks by attributes
one last thing:
The link for, Sync All Quantities. When this link is clicked, the stock for all items is changed to 0. Is this supposed to happen?
That could be a problem for anyone who does know the results.
-
Re: Stocks by attributes
Hello Guys,
My name is Joćo Raposo, I'm new to Zen Cart, I am using the Zen Cart to install a new page for my company but I have one problem.
I had read so much threads and I only see user Siezer talking about what I want but I can't speak it so...
I would like too now if someone can change this add-on Stock by attributes to have a check box on each general attributes (Ex. Color, Size,etc...) to allow or not allow to insert stock on stock attributes to that general attribute.
This is because I had some attributes that I don't want to include with stock option. (Ex. Number of printings, Number of printing colors,etc...).
This is possible? Can some one help me?
Best Regards for all...
Joćo Raposo
Marinha Grande, Portugal
-
Re: Stocks by attributes
-
Re: Stocks by attributes
Hello everybody,
I'm trying the SBA module (thanks for the job done) with ZC version 1.3.9 f
I have this issue if a customer add several products in the shopping cart:
If the FIRST product added is in stock everything works ok.
If the FIRST product added is out of stock all the other products added later are marked '***' out of stock even if they are in stock.
Could it be a bug? Am i the only one with this problem?
Thanks in advance