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,376

Results 2,281 to 2,300 of 3,609
30 Aug 2015, 8:15 AM
#2281
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

Is there a way to get the products name to show in the downloadable tableSBAdata ? If there is ,can somebody tell me how to do it please ?

30 Aug 2015, 2:06 PM
#2282
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

cefyn:

Is there a way to get the products name to show in the downloadable tableSBAdata ? If there is ,can somebody tell me how to do it please ?

Referring to the export option that is available from the configuration->Stock By Attributes menu?

I haven't looked at that section of code recently to verify everything works as expected and what it would take to add that column on to the export and not affect the reverse import... I believe that the column is included in a similar function of EasyPopulate v4 more intended to manage stock of existing variants, but I thought product name was included...

Anyways if someone else doesn't get back to you with the how to add product name to the export, I'll take a look.

30 Aug 2015, 8:08 PM
#2283
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

Thanks for replying. Yes , that's what I'm referring to. I've found it more reliable than EP4 for accurately updating attribute quantities , just that it's tedious to be looking for each products model no.

30 Aug 2015, 8:32 PM
#2284
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

cefyn:

Thanks for replying. Yes , that's what I'm referring to. I've found it more reliable than EP4 for accurately updating attribute quantities , just that it's tedious to be looking for each products model no.

Sorry to focus on the specific terminology here, but based on the conversation it seems to me that the "reliability and accuracy" part of the issue is on the operator not the software. Until just now, no one has commented requesting any other sort method for the export/importof SBA quantities in EP4. While the issue of adding the name to the import/export file of SBA remains to be resolved for this case, there is now an item to address in EP4.

7 Sep 2015, 8:40 PM
#2285
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

My question is about the custom id. Using zen cart 1.5.4 and stock by attribute 1.5.4. The custom id shows on invoice , email , order history . If I search for a product in the search boxes available , category/product search ,
stock by attribute/ search , the product id ,product name , and product model , will all locate the product.
Is there a way to have the admin search use the SBA customid to find a product ? Thanks.

8 Sep 2015, 12:14 AM
#2286
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

cefyn:

My question is about the custom id. Using zen cart 1.5.4 and stock by attribute 1.5.4. The custom id shows on invoice , email , order history . If I search for a product in the search boxes available , category/product search ,
stock by attribute/ search , the product id ,product name , and product model , will all locate the product.
Is there a way to have the admin search use the SBA customid to find a product ? Thanks.

Haven't tred/developed yet, but around lines 2s0 and 2f0 of admin/includes/modules/category_product_listing.php there appears to be a comparison of entered search content against various fields in the database... This is where it seems that the customid for SBA could be factored in.

9 Sep 2015, 11:22 AM
#2287
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

I think at least admin/includes/modules/product/collect_info and admin/includes/modules/product/preview_info will also have to be changed, and probably some other files as well -by somebody who understands php,mysql,and the zencart relational database -which somebody is not me. If I want to go any further with this I will have to pay to get some custom coding done , I reckon , thanks.

9 Sep 2015, 11:39 AM
#2288
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

cefyn:

I think at least admin/includes/modules/product/collect_info and admin/includes/modules/product/preview_info will also have to be changed, and probably some other files as well -by somebody who understands php,mysql,and the zencart relational database -which somebody is not me. If I want to go any further with this I will have to pay to get some custom coding done , I reckon , thanks.

Why again (though really the first time asking) do you think that the product collection and storage files need touching to support search on the customid that is stored/captured in the catalog->SBA menu?

10 Sep 2015, 8:51 PM
#2289
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

I was looking at this and copying it's structure
https://www.zen-cart.com/downloads.php?do=file&id=442.
It's an example of a new product identifier being successfully installed and made available to search.
When I did this in admin/includes/modules/category_product_listing
$products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
p.products_image, p.products_price, p.products_date_added,
p.products_last_modified, p.products_date_available,
p.products_status, p2c.categories_id,
p.products_model,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
p.products_upc, pas.customid,
p.products_quantity_order_max, p.products_sort_order,
p.master_categories_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c, "
. TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas
where p.products_id = pd.products_id
and p.products_id = pas.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and (p.products_id = p2c.products_id
and p.master_categories_id = p2c.categories_id)
and (
pd.products_name like '%" . zen_db_input($_GET['search']) . " %'
or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
or p.products_id = '%" . zen_db_input($_GET['search']) . "%'
or p.products_upc = '%" . zen_db_input($_GET['search']) . "%'
or pas.customid = '%" . zen_db_input($_GET['search']) . "%'
or p.products_model = '%" . zen_db_input($_GET['search']) . " % ')" .
$order_by);

} else {
  $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
                                   p.products_image, p.products_price, p.products_date_added,
                                   p.products_last_modified, p.products_date_available,
                                   p.products_status, p.products_model,
                                   p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                   p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,

p.products_upc, pas.customid,
p.products_quantity_order_max, p.products_sort_order
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas
where p.products_id = pd.products_id
and pas.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id
and p2c.categories_id = '" . (int)$current_category_id . "'" .
$order_by);
}
although no errors are produced search still won't find the product by it's uniqueid.However I did similar changes to preview_info and collect_info and it still doesn't work, so I'm missing a relationship somewhere .

10 Sep 2015, 11:04 PM
#2290
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

Not in front of a computer, but unless every product in your store is also tracked by attributes, my guess is the product not stocked by attributes is no longer locateable by search.

For one thing the SBA table needs to be left joined on the query. But then if a search is performed on a sba tracked item on a field not in the sba table for a product tracked by sba, then one row for each variant of the product will be returned. Pair this with the second query returns the customid (when not doing a search) and if it does so for some purpose of display then would want to do the same thing in the search query.

My thought though and I still need to run the query through a database test, would be to either apply distinct to the first (search) query, left join the sba table on products_id, apply a like instead of = on the search, and remove pas.customid from the second query, but duplicate the above to it as well...

Otherwise, might add an additional query ahead of these two such that the sba table is searched, when it has a positve result of a product_id, then feed that into the search queryresult as one of the where comparisons.

Just a thought...

11 Sep 2015, 9:41 AM
#2291
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

mc12345678:

Not in front of a computer, but unless every product in your store is also tracked by attributes, my guess is the product not stocked by attributes is no longer locateable by search.

For one thing the SBA table needs to be left joined on the query. But then if a search is performed on a sba tracked item on a field not in the sba table for a product tracked by sba, then one row for each variant of the product will be returned. Pair this with the second query returns the customid (when not doing a search) and if it does so for some purpose of display then would want to do the same thing in the search query.

My thought though and I still need to run the query through a database test, would be to either apply distinct to the first (search) query, left join the sba table on products_id, apply a like instead of = on the search, and remove pas.customid from the second query, but duplicate the above to it as well...

Otherwise, might add an additional query ahead of these two such that the sba table is searched, when it has a positve result of a product_id, then feed that into the search queryresult as one of the where comparisons.

Just a thought...

So my eyes certainly deceived me... The pas.customid was in both queries...

Here for your specific situation is how I would rewrite this query... Mind you the products_upc field is not standard to ZC, so if/when this modification is incorporated, that field/others are likely to not be included with SBA out-of-the box.

$products_query_raw = ("select DISTINCT p.products_type, p.products_id, pd.products_name, p.products_quantity,
                                       p.products_image, p.products_price, p.products_date_added,
                                       p.products_last_modified, p.products_date_available,
                                       p.products_status, p2c.categories_id,
                                       p.products_model,
                                       p.products_quantity_order_min,  p.products_quantity_order_units, p.products_priced_by_attribute,
                                       p.product_is_free,  p.product_is_call, p.products_quantity_mixed,  p.product_is_always_free_shipping,
p.products_upc, pas.customid,
                                       p.products_quantity_order_max, p.products_sort_order,
                                       p.master_categories_id
                                from " . TABLE_PRODUCTS . " p LEFT JOIN "
                                       . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas on (pas.products_id = p.products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
                                       . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, "
                                       . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas
                                where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                and (p.products_id = p2c.products_id
                                and p.master_categories_id = p2c.categories_id)
                                and (
                                pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
                                or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
                                or p.products_id = '%" . zen_db_input($_GET['search']) . "%'
                                or p.products_upc = '%" . zen_db_input($_GET['search']) . "%'
                                or pas.customid like '%" . zen_db_input($_GET['search']) . "%'
                                or p.products_model = '%" . zen_db_input($_GET['search']) . "%')" .
                                $order_by);

    } else {
      $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
                                       p.products_image, p.products_price, p.products_date_added,
                                       p.products_last_modified, p.products_date_available,
                                       p.products_status, p.products_model,
                                       p.products_quantity_order_min,  p.products_quantity_order_units, p.products_priced_by_attribute,
                                       p.product_is_free,  p.product_is_call, p.products_quantity_mixed,  p.product_is_always_free_shipping,
p.products_upc, pas.customid,
                                       p.products_quantity_order_max, p.products_sort_order
                                from " . TABLE_PRODUCTS . " p LEFT JOIN "
                                       . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas on (pas.products_id = p.products_id), " .  TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . "  p2c, " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas
                                where p.products_id = pd.products_id
                               and pas.products_id = p.products_id
                                and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                and p.products_id = p2c.products_id
                                and p2c.categories_id = '" . (int)$current_category_id . "'" .
                                $order_by);
    }

The above will produce results that will list all variants of a product when either listing the products in a category or when searching on a value that is not in the customid of the sba variant(s). The returned data has an additional field (pas.customid) that if not used should be removed to restore the "normal" returned dataset but searchable by the customid. If the returned pas.customid is kept in the returned data, then suggest changing up the row's display action as the normal product_info page has no direct relatonship with the tracked SBA quantities.

Btw, I too had some trouble using the search function with the original posted code, but found there were some spaces whether intially entered or some odd posting fluke known to occasionally happen I do not know, but the above worked in a sql query.

11 Sep 2015, 11:00 PM
#2292
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

Now you're being too kind mc , any spaces in the original code are entirely due to an inaccurate and unreliable operator guessing what the code should be .
Your amendments have it working just as you say, and the next thing for me to try and do is to change the rows display action. Thank you (once again) for giving so generously of your time and expertise . Thank you also for encouraging me to look for a solution here . Zen Cart rocks .

12 Sep 2015, 9:33 AM
#2293
cefyn avatar

cefyn

New Zenner

Join Date:
May 2007
Posts:
87
Plugin Contributions:
1

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

In case anyone else finds this useful,I found the above , as is, was giving me table alias errors. I am using:

$products_query_raw = ("select DISTINCT p.products_type, p.products_id, pd.products_name, p.products_quantity,
p.products_image, p.products_price, p.products_date_added,
p.products_last_modified, p.products_date_available,
p.products_status, p2c.categories_id,
p.products_model,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping,
p.products_upc, pas.customid,
p.products_quantity_order_max, p.products_sort_order,
p.master_categories_id
from " . TABLE_PRODUCTS . " p LEFT JOIN "
. TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas on (pas.products_id = p.products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, "
. TABLE_PRODUCTS_TO_CATEGORIES . " p2c

                            where p.products_id = pd.products_id

and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and (p.products_id = p2c.products_id
and p.master_categories_id = p2c.categories_id)
and (
pd.products_name like '%" . zen_db_input($_GET['search']) . "%'
or pd.products_description like '%" . zen_db_input($_GET['search']) . "%'
or p.products_id = '%" . zen_db_input($_GET['search']) . "%'
or p.products_upc = '%" . zen_db_input($_GET['search']) . "%'
or pas.customid like '%" . zen_db_input($_GET['search']) . "%'
or p.products_model = '%" . zen_db_input($_GET['search']) . "%')" .
$order_by);

} else {
  $products_query_raw = ("select p.products_type, p.products_id, pd.products_name, p.products_quantity,
                                   p.products_image, p.products_price, p.products_date_added,
                                   p.products_last_modified, p.products_date_available,
                                   p.products_status, p.products_model,
                                   p.products_quantity_order_min,  p.products_quantity_order_units, p.products_priced_by_attribute,
                                   p.product_is_free,  p.product_is_call, p.products_quantity_mixed,  p.product_is_always_free_shipping,

p.products_upc, pas.customid,
p.products_quantity_order_max, p.products_sort_order
from " . TABLE_PRODUCTS . " p LEFT JOIN "
. TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas on (pas.products_id = p.products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
where p.products_id = pd.products_id
and pas.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_id = p2c.products_id
and p2c.categories_id = '" . (int)$current_category_id . "'" .
$order_by);
}

16 Sep 2015, 1:17 PM
#2294
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

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

I am having a problem with this plugin and I know I have done something, again, wrong but please can you help?

I have installed as per the instructions and then ran stock_by_attr_install.php. Selected full/upgrade DB install. All was fine.

However, I had a problem with my shop so I went back to stock_by_attr_install.php and selected & ran remove all from the DB. Now this is where it all goes wrong. The problem I had was not caused by the full/upgrade DB install so, as I thought, ran full/upgrade DB install again. Now I am getting the error message 'WARNING: An Error occurred, please refresh the page and try again.'

I have tried to do a restore of the DB but that is throwing up > Error

SQL query:

--
-- Table structure for table ecs_address_book

DROP TABLE IF EXISTS ecs_address_book;

MySQL said: Documentation
#1046 - No database selected

So I am stumped their. Is it possible to "pick" out the DB changes myself to see what is going on? If so what are added to the DB?

16 Sep 2015, 2:01 PM
#2295
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

How about the error message generated by trying to do the install again? The other issue is related to the file made for the backup not to this module.

See the following for more guidance: http://www.zen-cart.com/content.php?124-blank-page

16 Sep 2015, 4:13 PM
#2296
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

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

mc12345678:

How about the error message generated by trying to do the install again? The other issue is related to the file made for the backup not to this module.

See the following for more guidance: http://www.zen-cart.com/content.php?124-blank-page

As requested

[16-Sep-2015 17:09:48 Europe/London] #1 trigger_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:155]
#2 queryFactory->show_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:132]
#3 queryFactory->set_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:262]
#4 queryFactory->Execute() called at [/homepages/20/d503465712/htdocs/shops/ecs/backoffice/stock_by_attr_install.php:682]
#5 insertDynDropdownsConfiguration() called at [/homepages/20/d503465712/htdocs/shops/ecs/backoffice/stock_by_attr_install.php:2272]

[16-Sep-2015 17:09:48 Europe/London] PHP Fatal error: 1062:Duplicate entry 'PRODINFO_ATTRIBUTE_DYNAMIC_STATUS' for key 'unq_config_key_zen' :: INSERT INTO `ecs_configuration` (configuration_title, configuration_key, configuration_value, 
configuration_description, configuration_group_id, sort_order, 
date_added, use_function, set_function) 
VALUES 
('Enable Dynamic Dropdowns', 'PRODINFO_ATTRIBUTE_DYNAMIC_STATUS', '2', 'Selects status of using this portion of the SBA plugin (Dynamic Dropdowns).', 50, 10, now(), NULL, 'zen_cfg_select_drop_down(array(array(\'id\'=>\'0\', \'text\'=>\'Off\'), array(\'id\'=>\'1\', \'text''=>\'On for All SBA Tracked\'), array(\'id\'=>\'2\', \'text''=>\'On for Multi-Attribute Only\'), array(\'id\'=>\'3\', \'text''=>\'On for Single-Attribute Only\'), ),'),
('Product Info Single Attribute Display Plugin', 'PRODINFO_ATTRIBUTE_PLUGIN_SINGLE', 'multiple_dropdowns', 'The plugin used for displaying attributes on the product information page.', 50, 20, now(), NULL, 'zen_cfg_select_option(array(\'single_radioset\', \'single_dropdown\',\'multiple_dropdowns\',\'sequenced_dropdowns\',\'sba_sequenced_dropdowns\'),'),
('Product Info Multiple Attribute Display Plugin', 'PRODINFO_ATTRIBUTE_PLUGIN_MULTI', 'sba_sequenced_dropdowns', 'The plugin used for displaying attributes on the product information page.', 50, 30, now(), NULL, 'zen_cfg_select_option(array(\'single_radioset\', \'single_dropdown\',\'multiple_dropdowns\',\'sequenced_dropdowns\',\'sba_sequenced_dropdowns\'),'),
('Use ZC default HTML Attribute Tags', 'SBA_ZC_DEFAULT', 'true', 'Controls whether to use ZC HTML tags around attributes or to use the Dynamic Dropdown Version of the tags to support modifications made by others over the years but also compatibility with other ZC plugins.<br /><br />Options:<br />true (Default)<br />false.', 50, 40, now(), NULL, 'zen_cfg_select_option(array(\'true\', \'false\'),'),
('Show Out of Stock Attributes', 'PRODINFO_ATTRIBUTE_SHOW_OUT_OF_STOCK', 'True', 'Controls the display of out of stock attributes.', 50, 50, now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'),'),
('Mark Out of Stock Attributes', 'PRODINFO_ATTRIBUTE_MARK_OUT_OF_STOCK', 'Right', 'Controls how out of stock attributes are marked as out of stock.', 50, 60, now(), NULL, 'zen_cfg_select_option(array(\'None\', \'Right\', \'Left\'),'),
('Display Out of Stock Message Line', 'PRODINFO_ATTRIBUTE_OUT_OF_STOCK_MSGLINE', 'True', 'Controls the display of a message line indicating an out of stock attributes is selected.', 50, 70, now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'),'),
('Prevent Adding Out of Stock to Cart', 'PRODINFO_ATTRIBUTE_NO_ADD_OUT_OF_STOCK', 'True', 'Prevents adding an out of stock attribute combination to the cart.', 50, 80, now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'),'),
('SBA Number of Records to Displayed', 'STOCK_SET_SBA_NUMRECORDS', '25', 
'Number of records to show on page:',
50, 60, now(), NULL, NULL),
('Display Javascript Popup for Out-of-Stock Selection', 'PRODINFO_ATTRIBUTE_POPUP_OUT_OF_STOCK', 'True', 'Controls whether to display or not the message for when a products attribute is out-of-stock.', 50, 90, now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'),')
; ==> (as called by) /homepages/20/d503465712/htdocs/shops/ecs/backoffice/stock_by_attr_install.php on line 682 <== in /homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php on line 155
16 Sep 2015, 4:42 PM
#2297
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

Welp, looks like when adding new options to the Dynamiic Dropdown menu in function insertDynDropdownsConfigurationMenu, equivalent remove code was not added to the install file in the function removeDynDropdownsConfiguration.

As to the other issue somewhat depends on how you are tryng to upload it. If in phpmyadmin, need to first select the database to which it is to apply then upload/import.

16 Sep 2015, 6:44 PM
#2298
adb34 avatar

adb34

Totally Zenned

Join Date:
Mar 2008
Location:
Brampton, Cumbria, United Kingdom, United Kingdom
Posts:
825
Plugin Contributions:
0

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

mc12345678:

Welp, looks like when adding new options to the Dynamiic Dropdown menu in function insertDynDropdownsConfigurationMenu, equivalent remove code was not added to the install file in the function removeDynDropdownsConfiguration.

As to the other issue somewhat depends on how you are tryng to upload it. If in phpmyadmin, need to first select the database to which it is to apply then upload/import.
Does this mean that the data is still in the DB? Also if this is the case or not, why when I click on catalog -> Stock By Attribute (SBA), at the bottom of the page after Sync All Quantities I have the message WARNING: An Error occurred, please refresh the page and try again.

The debug files are;> [16-Sep-2015 19:41:05 Europe/London] #1 trigger_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:155]

#2 queryFactory->show_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:132]
#3 queryFactory->set_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:262]
#4 queryFactory->Execute() called at [/homepages/20/d503465712/htdocs/shops/ecs/admin/includes/classes/products_with_attributes_stock.php:284]
#5 products_with_attributes_stock->displayFilteredRows() called at [/homepages/20/d503465712/htdocs/shops/ecs/admin/products_with_attributes_stock.php:730]

[16-Sep-2015 19:41:05 Europe/London] PHP Fatal error: 1146:Table 'db588038315.ecs_products_with_attributes_stock' doesn't exist :: select * from ecs_products_with_attributes_stock where products_id="529"
order by sort ASC; ==> (as called by) /homepages/20/d503465712/htdocs/shops/ecs/admin/includes/classes/products_with_attributes_stock.php on line 284 <== in /homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php on line 155> [16-Sep-2015 19:41:02 Europe/London] #1 trigger_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:155]
#2 queryFactory->show_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:132]
#3 queryFactory->set_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:262]
#4 queryFactory->Execute() called at [/homepages/20/d503465712/htdocs/shops/ecs/admin/includes/classes/products_with_attributes_stock.php:96]
#5 products_with_attributes_stock->update_all_parent_products_stock() called at [/homepages/20/d503465712/htdocs/shops/ecs/admin/products_with_attributes_stock.php:425]

[16-Sep-2015 19:41:02 Europe/London] PHP Fatal error: 1146:Table 'db588038315.ecs_products_with_attributes_stock' doesn't exist :: select sum(quantity) as quantity, products_id from ecs_products_with_attributes_stock where products_id = 529 ==> (as called by) /homepages/20/d503465712/htdocs/shops/ecs/admin/includes/classes/products_with_attributes_stock.php on line 96 <== in /homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php on line 155> [16-Sep-2015 19:40:58 Europe/London] #1 trigger_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:155]
#2 queryFactory->show_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:132]
#3 queryFactory->set_error() called at [/homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php:262]
#4 queryFactory->Execute() called at [/homepages/20/d503465712/htdocs/shops/ecs/admin/includes/classes/products_with_attributes_stock.php:284]
#5 products_with_attributes_stock->displayFilteredRows() called at [/homepages/20/d503465712/htdocs/shops/ecs/admin/products_with_attributes_stock.php:730]

[16-Sep-2015 19:40:58 Europe/London] PHP Fatal error: 1146:Table 'db588038315.ecs_products_with_attributes_stock' doesn't exist :: select * from ecs_products_with_attributes_stock where products_id="529"
order by sort ASC; ==> (as called by) /homepages/20/d503465712/htdocs/shops/ecs/admin/includes/classes/products_with_attributes_stock.php on line 284 <== in /homepages/20/d503465712/htdocs/shops/ecs/includes/classes/db/mysql/query_factory.php on line 155

16 Sep 2015, 7:23 PM
#2299
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

No, what it means is that when the remove was performed, the code did everything it was programmed to do; however, there were three keys that had been added that were not incorporated into the remove process. Therefore, the keys remain in the database. Further, the install has not been written to allow such failures, but instead to provide an error like what you provided. As a result of the error, program execution of the installation stopped dead in its tracks and therefore, the table has not been recreated which is why this latest error is seen. So… Below is the code to incorporate into the removeDynDropdownsConfiguration function inside of admin/stock_by_attr_install.php (in SBA version 1.5.4 this is around line 113) I would suggest adding the code below (three sets of lines) after this line:

array_push($resultMmessage, '• Deleted STOCK_SET_SBA_NUMRECORDS ' . $msg);

The following three sets of lines need to be added into the function removeDynDropdownsConfiguration()

 $sql = "DELETE IGNORE FROM `".TABLE_CONFIGURATION."` WHERE `configuration_key` = 'PRODINFO_ATTRIBUTE_DYNAMIC_STATUS'";
 $db->Execute($sql);
 if($db->error){ 
  $msg = ' Error Message: ' . $db->error;
 }
 array_push($resultMmessage, '• Deleted PRODINFO_ATTRIBUTE_DYNAMIC_STATUS  ' . $msg);

 $sql = "DELETE IGNORE FROM `".TABLE_CONFIGURATION."` WHERE `configuration_key` = 'SBA_ZC_DEFAULT'";
 $db->Execute($sql);
 if($db->error){ 
  $msg = ' Error Message: ' . $db->error;
 }
 array_push($resultMmessage, '• Deleted SBA_ZC_DEFAULT ' . $msg);

 $sql = "DELETE IGNORE FROM `".TABLE_CONFIGURATION."` WHERE `configuration_key` = 'PRODINFO_ATTRIBUTE_POPUP_OUT_OF_STOCK'";
 $db->Execute($sql);
 if($db->error){ 
  $msg = ' Error Message: ' . $db->error;
 }
 array_push($resultMmessage, '• Deleted PRODINFO_ATTRIBUTE_POPUP_OUT_OF_STOCK ' . $msg);

After adding this code, if you uninstall again and then reinstall, it should reinstall successfully… Otherwise, one could place the following code in the install SQL patches window found in the admin panel under tools:

DELETE IGNORE FROM `configuration` WHERE `configuration_key` = 'PRODINFO_ATTRIBUTE_DYNAMIC_STATUS';
DELETE IGNORE FROM `configuration` WHERE `configuration_key` = 'SBA_ZC_DEFAULT';
DELETE IGNORE FROM `configuration` WHERE `configuration_key` = 'PRODINFO_ATTRIBUTE_POPUP_OUT_OF_STOCK';

And then be able to install again; however, without the above additional code then a subsequent removal will result in the same condition again until the code can be updated on github.

16 Sep 2015, 7:46 PM
#2300
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

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

FYI, the repository for SBA 1.5.4 (compatible with ZC 1.5.3 and ZC 1.5.4) has been updated with the above code. It will be a bit for SBA 1.5.3 to be updated to suit as there are possibly other improvements to incorporate and it is getting to the point where it seems that the two versions can to some extent be merged into a single package as the overlap with core/templated ZC files is relatively low and from there it is a lot easier to keep the software up-to-date for all applicable versions...