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: 660,384

Results 3,461 to 3,480 of 3,609
21 Sep 2022, 4:03 PM
#3461
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

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

mc12345678:

Follow my signature link. I should make it easier, but... ;) while I'm not directly associated with the Zen Cart project, I'm sure those who support it more directly as an alternative would appreciate the support instead. The choice is always in those of the community.

Update...
I just re-installed on a fresh site and all appears good.
I did not run the SQL script. After running it on the previous, it appears to be good, but the attributes are duplicating and I am sure it has to do w/ that drop down option since it's not doing the same on the other. No error logs either.

I noticed that it does not have the inventory counts next to the attributes and only says out of stock next to items with no count entry. I am sure it's a configuration option.. I am going to check the thread.
Thanks again for your help

21 Sep 2022, 6:40 PM
#3462
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

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

chuckrey:

Update...
I just re-installed on a fresh site and all appears good.
I did not run the SQL script. After running it on the previous, it appears to be good, but the attributes are duplicating and I am sure it has to do w/ that drop down option since it's not doing the same on the other. No error logs either.

I noticed that it does not have the inventory counts next to the attributes and only says out of stock next to items with no count entry. I am sure it's a configuration option.. I am going to check the thread.
Thanks again for your help

Ok, so I have searched this thread for the solution but I am not finding the solution....
How do I get the quantities to display on the product info page when using the checkbox option? I can see the drop down works, but nothing except the "Out of Stock" Option when using the checkbox for Option Type. I apologize if I am beating a dead horse, but I am not finding the answer.

Has anyone had any luck with styling the counts and "Out of Stock" wording? I would like it to stand out more..

Thanks... anyone???

22 Sep 2022, 7:39 PM
#3463
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

chuckrey:

Ok, so I have searched this thread for the solution but I am not finding the solution....
How do I get the quantities to display on the product info page when using the checkbox option? I can see the drop down works, but nothing except the "Out of Stock" Option when using the checkbox for Option Type. I apologize if I am beating a dead horse, but I am not finding the answer.

Has anyone had any luck with styling the counts and "Out of Stock" wording? I would like it to stand out more..

Thanks... anyone???

So the checkbox count is not sobering that had yet been incorporated to the base code of SBA. There may be those that have incorporated it. I can see though in my minds eye that it would be possible through the notifier/observer system. Alternatively am Ajax call could be used (plan to implement such in the future). For dependent attributes I would suggest that last route. For your situation the data doesn't necessarily need to update on the fly.

As to the wording, that generally depends on how the wording is presented and what is presenting the out of stock statement. Zen Cart has an out of stock presentation and dynamic dropdowns also offers verbiage. For Zen Cart, there are images and there are words. Accessing a page that shows the undesirable content or that which is to be modified would help those of the forum to help. If it ends up being a Zen Cart modification, then suggest beginning a new thread or searching to identify the forum thread(s) that relate.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

22 Sep 2022, 8:07 PM
#3464
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

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

mc12345678:

So the checkbox count is not sobering that had yet been incorporated to the base code of SBA. There may be those that have incorporated it. I can see though in my minds eye that it would be possible through the notifier/observer system. Alternatively am Ajax call could be used (plan to implement such in the future). For dependent attributes I would suggest that last route. For your situation the data doesn't necessarily need to update on the fly.

As to the wording, that generally depends on how the wording is presented and what is presenting the out of stock statement. Zen Cart has an out of stock presentation and dynamic dropdowns also offers verbiage. For Zen Cart, there are images and there are words. Accessing a page that shows the undesirable content or that which is to be modified would help those of the forum to help. If it ends up being a Zen Cart modification, then suggest beginning a new thread or searching to identify the forum thread(s) that relate.

Okay, I will see if I can find or figure out a way to make it work. I assumed the verbage of out of stock and/or counts had a separate tag to style, but it appears not. I will see what I can come up with and post my efforts for feedback of those interested.

Thanks again.

27 Sep 2022, 10:17 AM
#3465
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

chuckrey:

Okay, I will see if I can find or figure out a way to make it work. I assumed the verbage of out of stock and/or counts had a separate tag to style, but it appears not. I will see what I can come up with and post my efforts for feedback of those interested.

Thanks again.

Did you ever figure out why the original site was having issue in the admin when attempting to add variants?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

12 Oct 2022, 7:25 PM
#3466
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

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

mc12345678:

Did you ever figure out why the original site was having issue in the admin when attempting to add variants?

Sorry for the delayed response. I did not, I decided to use the 2nd site. I can only imagine that I may have misplaced files when originally moving em over. I kept getting variant duplicates over and over where they would actually accumulate. The 2nd site seems to be working great so far. Thanks again.

14 Oct 2022, 6:55 PM
#3467
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

chuckrey:

Sorry for the delayed response. I did not, I decided to use the 2nd site. I can only imagine that I may have misplaced files when originally moving em over. I kept getting variant duplicates over and over where they would actually accumulate. The 2nd site seems to be working great so far. Thanks again.

Just a thought, if able to compare the files between the two sites, could determine if that was the cause. I realize that's a matter of time and effort.

Personally, I'd like to be able to know that cause so that could maybe identify a way to prevent or provide indication of how to resolve if someone else has that happen. Inquiring minds want to know. :smile:

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Oct 2022, 8:58 PM
#3468
chuckrey avatar

chuckrey

Zen Follower

Join Date:
Aug 2020
Location:
Richarson
Posts:
160
Plugin Contributions:
0

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

mc12345678:

Just a thought, if able to compare the files between the two sites, could determine if that was the cause. I realize that's a matter of time and effort.

Personally, I'd like to be able to know that cause so that could maybe identify a way to prevent or provide indication of how to resolve if someone else has that happen. Inquiring minds want to know. :smile:

Okay, not a problem.
Any idea where to start? I have an issue with the variants duplicating and changes not processing after they were made on the SBA / catalog page.

14 Oct 2022, 11:29 PM
#3469
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

chuckrey:

Okay, not a problem.
Any idea where to start? I have an issue with the variants duplicating and changes not processing after they were made on the SBA / catalog page.

Well, with the tools I have, I would just literally compare the two sites against each other and within the tool tell it to ignore files that are the same. Whatever is left is a difference. From there may have to identify why the difference exists, but if the difference is not directly related to sba, I would initially ignore the difference. If the difference looks like an sba file, then suss out why there is that difference....

A lot of words to say find the differences between the two sites and evaluate why the difference and its impact.

Also, for clarity, is the issue described on the old site only or both?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

9 Jan 2023, 9:22 PM
#3470
frumious avatar

frumious

New Zenner

Join Date:
Jun 2020
Location:
Scotland
Posts:
11
Plugin Contributions:
0

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

Is SBA still compatible with the latest ZC 1.5.8 ??

9 Jan 2023, 10:35 PM
#3471
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

frumious:

Is SBA still compatible with the latest ZC 1.5.8 ??

So far. Has there been an issue when tested on your development site?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

15 Jan 2023, 8:10 PM
#3472
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

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

I've encountered an issue when testing the github version on a new installation of Zen Cart 1.5.8

If i go to the admin page Catalog>Products with Attributes Stock (aka SBA)I get an SQL error warning.

Error log shows

PHP Fatal error: 1060:Duplicate column name 'products_model' :: SELECT count(*) as totalttt FROM (SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, p.products_model FROM zen_products_attributes pa, zen_products_description pd, zen_products p WHERE pd.language_id=1 AND pa.products_id = pd.products_id AND pa.products_id = p.products_id  ORDER BY p.products_model ) countresults ==> (as called by) /Users/dev/Sites/localhost/sbatest/SBAAdin/includes/classes/split_page_results.php on line 220 <== in /Users/dev/Sites/localhost/sbatest/includes/classes/db/mysql/query_factory.php on line 667.

The count query seems to be built using ```
private function numberRows(string $sql)

where the content of $sql is

SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, p.products_model FROM zen_products_attributes pa, zen_products_description pd, zen_products p WHERE pd.language_id=1 AND pa.products_id = pd.products_id AND pa.products_id = p.products_id ORDER BY p.products_model

and yet the sql query built in admin/includes/classes/products_with_attributes_stock.php at line 348 is

$query_products = "SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, " . $search_order_by . " FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p WHERE pd.language_id=" . (int)$language_id . " AND pa.products_id = pd.products_id AND pa.products_id = p.products_id " . $w . " ORDER BY " . $search_order_by . " " . $SearchRange;


It seems that it is adding the order by content back into the main query.

It's not the first time I have seen this since beginning testing on 1.5.8 as I had an instance on the front end last week where adding p.products_model to a query (can't recall which one at the moment) resulted in the same error being logged on the store side. I discovered that it was writing the sort by fields to the query used for count. 
This may be a bug in ZC core as I can't see any need to add additional fields other than what already existed in a query.

Peerhaps some form of check is required so that it doesn't lead to duplicate fields being used in the count query that gets built.

Zen Cart developer since 2009 — Zen Cart Solutions
Ecommerce development, integrations & automation — Junction Solutions

16 Jan 2023, 1:24 AM
#3473
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

strelitzia:

I've encountered an issue when testing the github version on a new installation of Zen Cart 1.5.8

If i go to the admin page Catalog>Products with Attributes Stock (aka SBA)I get an SQL error warning.

Error log shows

PHP Fatal error: 1060:Duplicate column name 'products_model' :: SELECT count(*) as totalttt FROM (SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, p.products_model FROM zen_products_attributes pa, zen_products_description pd, zen_products p WHERE pd.language_id=1 AND pa.products_id = pd.products_id AND pa.products_id = p.products_id ORDER BY p.products_model ) countresults ==> (as called by) /Users/dev/Sites/localhost/sbatest/SBAAdin/includes/classes/split_page_results.php on line 220 <== in /Users/dev/Sites/localhost/sbatest/includes/classes/db/mysql/query_factory.php on line 667.

> 
> The count query seems to be built using ```
private function numberRows(string $sql)
```in admin/includes/classes/split_page_results.php
> where the content of $sql is
> ```
SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, p.products_model FROM zen_products_attributes pa, zen_products_description pd, zen_products p WHERE pd.language_id=1 AND pa.products_id = pd.products_id AND pa.products_id = p.products_id ORDER BY p.products_model

and yet the sql query built in admin/includes/classes/products_with_attributes_stock.php at line 348 is

$query_products = "SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, " . $search_order_by . " FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p WHERE pd.language_id=" . (int)$language_id . " AND pa.products_id = pd.products_id AND pa.products_id = p.products_id " . $w . " ORDER BY " . $search_order_by . " " . $SearchRange;

> 
> It seems that it is adding the order by content back into the main query.
> 
> It's not the first time I have seen this since beginning testing on 1.5.8 as I had an instance on the front end last week where adding p.products_model to a query (can't recall which one at the moment) resulted in the same error being logged on the store side. I discovered that it was writing the sort by fields to the query used for count. 
> This may be a bug in ZC core as I can't see any need to add additional fields other than what already existed in a query.
> 
> Peerhaps some form of check is required so that it doesn't lead to duplicate fields being used in the count query that gets built.

I have a fix for this.  Doing some final testing as iwhen the same fix was applied against the possibility of remnant entries in the sba table might exist, the response was not as expected or desired.  I'm trying to determine a test case to force the expected response.

The solution though to the above is not exactly what I would like to have to include, but it accomplished a few things. One it ensures that the query results include the field(s) necessary to support more stringent mysql server requirements, that the results are in the same sequence as they have been in the past (other than possibly having a duplicate of a necessary field,  and it generally prevents creating a query that doesn't return any values, though it looks like someone would have to modify the code to create that condition. 

I expect to have the solution to the identified issue along with a fix to a minor issue within a few hours as I have something else to address. In the mean time. 

Thank you for identifying this issue that had not existed in previous Zen Cart versions.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

16 Jan 2023, 2:52 PM
#3474
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

Several hours ago I pushed a commit to the master branch to address this issue. The operation of the split page code has been modified away from what has historically been suggested which now requires the associated query to be "right". Historically, the double up of result fields was not a problem; however, now it causes an issue to be raised. This may be why the other discussed query/page had an issue.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Jan 2023, 6:25 PM
#3475
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

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

I've noticed that the 1_5_6 admin directory has modifications to attributes_controller.php, invoice.php, orders.php and packing slip.php and yet the 1_5_7 and 1_5_8 directories only modify packing slip.php.

Are the modifications no longer required on 1.5.7 and 1.5.8, or were they inadvertently omitted from the relevant module directories?

Zen Cart developer since 2009 — Zen Cart Solutions
Ecommerce development, integrations & automation — Junction Solutions

17 Jan 2023, 9:50 PM
#3476
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

strelitzia:

I've noticed that the 1_5_6 admin directory has modifications to attributes_controller.php, invoice.php, orders.php and packing slip.php and yet the 1_5_7 and 1_5_8 directories only modify packing slip.php.

Are the modifications no longer required on 1.5.7 and 1.5.8, or were they inadvertently omitted from the relevant module directories?

The addition of notifiers in those more recent versions negated the need to incorporate modifications directly to those files. The associated actions are addressed in the observer(s).

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

17 Jan 2023, 11:24 PM
#3477
strelitzia avatar

strelitzia

Totally Zenned

Join Date:
Nov 2005
Location:
France
Posts:
588
Plugin Contributions:
1

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

I'm getting the following error logged when trying to add to cart

[18-Jan-2023 00:10:40 Europe/Paris] PHP Fatal error:  Uncaught Error: Cannot access protected property shoppingCart::$display_debug_messages in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php:364
Stack trace:
#0 /Users/steph/Sites/localhost/tudorrose/includes/main_cart_actions.php(30): include()
#1 /Users/steph/Sites/localhost/tudorrose/includes/init_includes/init_cart_handler.php(42): require('/Users/steph/Si...')
#2 /Users/steph/Sites/localhost/tudorrose/includes/autoload_func.php(40): require_once('/Users/steph/Si...')
#3 /Users/steph/Sites/localhost/tudorrose/includes/application_top.php(237): require('/Users/steph/Si...')
#4 /Users/steph/Sites/localhost/tudorrose/index.php(25): require('/Users/steph/Si...')
#5 {main}
  thrown in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php on line 364

[18-Jan-2023 00:10:40 Europe/Paris] Request URI: /index.php?main_page=product_info&cPath=1_2254_2255&products_id=12239&number_of_uploads=0&action=add_product, IP address: ::1
--> PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$display_debug_messages in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php:364
Stack trace:
#0 /Users/steph/Sites/localhost/tudorrose/includes/main_cart_actions.php(30): include()
#1 /Users/steph/Sites/localhost/tudorrose/includes/init_includes/init_cart_handler.php(42): require('/Users/steph/Si...')
#2 /Users/steph/Sites/localhost/tudorrose/includes/autoload_func.php(40): require_once('/Users/steph/Si...')
#3 /Users/steph/Sites/localhost/tudorrose/includes/application_top.php(237): require('/Users/steph/Si...')
#4 /Users/steph/Sites/localhost/tudorrose/index.php(25): require('/Users/steph/Si...')
#5 {main}
  thrown in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php on line 364.

Any suggestions?

Zen Cart developer since 2009 — Zen Cart Solutions
Ecommerce development, integrations & automation — Junction Solutions

18 Jan 2023, 2:41 AM
#3478
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

strelitzia:

I'm getting the following error logged when trying to add to cart

[18-Jan-2023 00:10:40 Europe/Paris] PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$display_debug_messages in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php:364
Stack trace:
#0 /Users/steph/Sites/localhost/tudorrose/includes/main_cart_actions.php(30): include()
#1 /Users/steph/Sites/localhost/tudorrose/includes/init_includes/init_cart_handler.php(42): require('/Users/steph/Si...')
#2 /Users/steph/Sites/localhost/tudorrose/includes/autoload_func.php(40): require_once('/Users/steph/Si...')
#3 /Users/steph/Sites/localhost/tudorrose/includes/application_top.php(237): require('/Users/steph/Si...')
#4 /Users/steph/Sites/localhost/tudorrose/index.php(25): require('/Users/steph/Si...')
#5 {main}
thrown in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php on line 364

[18-Jan-2023 00:10:40 Europe/Paris] Request URI: /index.php?main_page=product_info&cPath=1_2254_2255&products_id=12239&number_of_uploads=0&action=add_product, IP address: ::1
--> PHP Fatal error: Uncaught Error: Cannot access protected property shoppingCart::$display_debug_messages in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php:364
Stack trace:
#0 /Users/steph/Sites/localhost/tudorrose/includes/main_cart_actions.php(30): include()
#1 /Users/steph/Sites/localhost/tudorrose/includes/init_includes/init_cart_handler.php(42): require('/Users/steph/Si...')
#2 /Users/steph/Sites/localhost/tudorrose/includes/autoload_func.php(40): require_once('/Users/steph/Si...')
#3 /Users/steph/Sites/localhost/tudorrose/includes/application_top.php(237): require('/Users/steph/Si...')
#4 /Users/steph/Sites/localhost/tudorrose/index.php(25): require('/Users/steph/Si...')
#5 {main}
thrown in /Users/steph/Sites/localhost/tudorrose/includes/extra_cart_actions/stock_by_attributes.php on line 364.

> 
> Any suggestions?

Not in love with my solution, but it works. Will post that shortly. While reviewing logs, also identified some other minor issues that got logged in my testing yesterday.  That will be a separate correction if not multiple separate ones.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

18 Jan 2023, 4:25 AM
#3479
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 love with my solution, but it works. Will post that shortly. While reviewing logs, also identified some other minor issues that got logged in my testing yesterday. That will be a separate correction if not multiple separate ones.

First commit pushed. Able to add product to the cart.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

12 Feb 2023, 3:17 PM
#3480
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

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

my apologies if you've already addressed this but it's so basic. After uploading files, the catalog still works but the admin is showing a 500 error. Now granted this server is driving me crazy and this might not be typical but there is no error log to track this. v1.5.8, php 8.1

The full-time Zen Cart Guru. WizTech4ZC.com
New template for 2.0 viewable here: 2.0 Demo