-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
zamzom
So far so good.
Thank you mc12345678 for your quick attention and neat corrections.
I will keep reporting other issues when I come accross.
Few more things I recently encountered:
Now, the search functions in the admin/products_with_attributes_stock page. However, if the search results are more than one page, next page button does not work. It takes you to the full list of products' second page. I coudn't go into the reason of that because I have more important issues I have to fix first, but I am suspecting that it is due to POSTed values again.
Another thing I have noticed; SBA makes modifications in functions_lookups.php file in two functions:
zen_get_products_stock
zen_check_stock
PHP Code:
/**
* functions_lookups.php
* Lookup Functions for various core activities related to countries, prices, products, product types, etc
*
* @package functions
* @copyright Copyright 2003-2016 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: Author: mc12345678 Tue Feb 2 16:23:08 2016 -0500 Modified in v1.5.5 $
*
* Stock by Attributes 1.5.4 15-12-21 mc12345678
*/
Nevertheless, it seems in ZC 1.5.8 these functions are moved into functions_products.php and a notifier mechanism is incorporated.
I wonder if these modifications can be carried there as is?
Regarding the logs of display of items meeting the search criteria when navigating to another page:
I was able to duplicate the issue using the Zen Cart default product and found a solution. I tested by searching for product with the letter e. I was presented more than one page of product when using the sba default of 25 items per screen.
Navigating to another page using either the dropdown or next page resulted in going to the selected page but included product that didn't have the letter e.
The cause is that the call to display the links does not include the parameters associated with filtering, sorting or the like.
That information should be included/added to the fourth parameter of the displaylinks method of the splitPageResults class object in a way to respect the page change and omission of any other parameter that should not apply in a page change.
An update is to follow along with the previous changes being more discreet.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
is image swap still working in this new version from github with zen 1.5.6c
installed but no swapping
have 1 product 1 attribute field 2 options sba tracked and sba simple dropdown
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
jimmie
is image swap still working in this new version from github with zen 1.5.6c
installed but no swapping
have 1 product 1 attribute field 2 options sba tracked and sba simple dropdown
It wasn't purposefully removed if that's of any consolation. There are a number of reasons why it may not be operational on the specific site or even just the one page. It involves javascript so aspects of the page must be evaluated to ensure all things align sufficiently.
Considerations:
Is the javascript option value trigger sent to the browser.
Is there javascript code associated with doing the swap in the html code?
Does the page pass html validation?
Are there javascript errors when loading the page?
Is there other javascript/jQuery code successfully executing on page load? If so, what is it doing that might be interfering?
Again, no the functionality was not purposefully removed, might even be a configuration switch not being set to support image swap.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
I've come across an issue where attempting to update a custom id via admin causes an Error 500 result when attempting to save the update.
Site is running ZC 1.5.8 with SBA version 1.5.4 taken from GitHub in the last 4 weeks.
Can you replicate this issue?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
strelitzia
I've come across an issue where attempting to update a custom id via admin causes an Error 500 result when attempting to save the update.
Site is running ZC 1.5.8 with SBA version 1.5.4 taken from GitHub in the last 4 weeks.
Can you replicate this issue?
The logged error is
[14-Apr-2023 01:31:00 Europe/Paris] Request URI: /admintest/index.php?cmd=products_with_attributes_stock_ajax&save=1&pid=12863, IP address: ::1
--> PHP Fatal error: Uncaught Error: Call to protected method queryFactory::getBindVarValue() from context 'products_with_attributes_stock' in /Users/dev/Sites/localhost/trose/admintest/includes/classes/products_with_attributes_stock.php:918
Stack trace:
#0 /Users/dev/Sites/localhost/trose/admintest/products_with_attributes_stock_ajax.php(30): products_with_attributes_stock->saveAttrib()
#1 /Users/dev/Sites/localhost/trose/admintest/index.php(11): require('/Users/steph/Si...')
#2 {main}
thrown in /Users/dev/Sites/localhost/trose/admintest/includes/classes/products_with_attributes_stock.php on line 918.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
strelitzia
The logged error is
[14-Apr-2023 01:31:00 Europe/Paris] Request URI: /admintest/index.php?cmd=products_with_attributes_stock_ajax&save=1&pid=12863, IP address: ::1
--> PHP Fatal error: Uncaught Error: Call to protected method queryFactory::getBindVarValue() from context 'products_with_attributes_stock' in /Users/dev/Sites/localhost/trose/admintest/includes/classes/products_with_attributes_stock.php:918
Stack trace:
#0 /Users/dev/Sites/localhost/trose/admintest/products_with_attributes_stock_ajax.php(30): products_with_attributes_stock->saveAttrib()
#1 /Users/dev/Sites/localhost/trose/admintest/index.php(11): require('/Users/steph/Si...')
#2 {main}
thrown in /Users/dev/Sites/localhost/trose/admintest/includes/classes/products_with_attributes_stock.php on line 918.
That was an issue discussed a few posts back. Resolved in the github repo currently available. I pushed updates a few days ago to address all of the recently identified issues.
That log btw is alerting to the fact that a method within the class has become a little more "hidden" (protected) from being accessed by just anything.
See this post and the one quoted in it for the discussion: https://www.zen-cart.com/showthread....38#post1393538
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
That was an issue discussed a few posts back. Resolved in the github repo currently available. I pushed updates a few days ago to address all of the recently identified issues.
Thanks McNumbers. I'll update the site with the latest GitHub repo files and retest. If I get any further issues I'll let you know.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
strelitzia
Thanks McNumbers. I'll update the site with the latest GitHub repo files and retest. If I get any further issues I'll let you know.
Much appreciated.
-
Not working in PHP 7.4.3
I tried to install SBA on my test installation, and get this error message:
[27-May-2023 09:38:40 America/New_York] PHP Fatal error: Cannot redeclare zen_output_string() (previously declared in C:\wamp64\www\newnaturals\ADMIN\includes\functions\general.php:39) in C:\wamp64\www\newnaturals\includes\functions\functions_general_shared.php on line 40
[27-May-2023 09:38:40 America/New_York] PHP Stack trace:
[27-May-2023 09:38:40 America/New_York] PHP 1. {main}() C:\wamp64\www\newnaturals\ADMIN\index.php:0
[27-May-2023 09:38:40 America/New_York] PHP 2. require() C:\wamp64\www\newnaturals\ADMIN\index.php:11
[27-May-2023 09:38:40 America/New_York] PHP 3. require() C:\wamp64\www\newnaturals\ADMIN\orders.php:12
[27-May-2023 09:38:40 America/New_York] PHP 4. require() C:\wamp64\www\newnaturals\ADMIN\includes\application_top.php:37
[27-May-2023 09:38:40 America/New_York] PHP 5. require_once() C:\wamp64\www\newnaturals\includes\autoload_func.php:37
[27-May-2023 09:38:40 America/New_York] Request URI: /newnaturals/ADMIN/index.php?cmd=orders, IP address: 127.0.0.1
--> PHP Fatal error: Cannot redeclare zen_output_string() (previously declared in C:\wamp64\www\newnaturals\ADMIN\includes\functions\general.php:39) in C:\wamp64\www\newnaturals\includes\functions\functions_general_shared.php on line 40.
I'm running PHP 7.4.3 on the test installation, and can't downgrade without going back to an earlier version of wamp, which I'm reluctant to do. Are you aware of any issues with the plugin and this version of PHP?
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
HeleneWallis
I tried to install SBA on my test installation, and get this error message:
Code:
[27-May-2023 09:38:40 America/New_York] PHP Fatal error: Cannot redeclare zen_output_string() (previously declared in C:\wamp64\www\newnaturals\ADMIN\includes\functions\general.php:39) in C:\wamp64\www\newnaturals\includes\functions\functions_general_shared.php on line 40
[27-May-2023 09:38:40 America/New_York] PHP Stack trace:
[27-May-2023 09:38:40 America/New_York] PHP 1. {main}() C:\wamp64\www\newnaturals\ADMIN\index.php:0
[27-May-2023 09:38:40 America/New_York] PHP 2. require() C:\wamp64\www\newnaturals\ADMIN\index.php:11
[27-May-2023 09:38:40 America/New_York] PHP 3. require() C:\wamp64\www\newnaturals\ADMIN\orders.php:12
[27-May-2023 09:38:40 America/New_York] PHP 4. require() C:\wamp64\www\newnaturals\ADMIN\includes\application_top.php:37
[27-May-2023 09:38:40 America/New_York] PHP 5. require_once() C:\wamp64\www\newnaturals\includes\autoload_func.php:37
[27-May-2023 09:38:40 America/New_York] Request URI: /newnaturals/ADMIN/index.php?cmd=orders, IP address: 127.0.0.1
--> PHP Fatal error: Cannot redeclare zen_output_string() (previously declared in C:\wamp64\www\newnaturals\ADMIN\includes\functions\general.php:39) in C:\wamp64\www\newnaturals\includes\functions\functions_general_shared.php on line 40.
I'm running PHP 7.4.3 on the test installation, and can't downgrade without going back to an earlier version of wamp, which I'm reluctant to do. Are you aware of any issues with the plugin and this version of PHP?
What is the origin of the installed version? That obtained from github doesn't cause this issue when only the software for the plug in and the associated Zen Cart version are installed.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
HeleneWallis
I tried to install SBA on my test installation, and get this error message:
[27-May-2023 09:38:40 America/New_York] PHP Fatal error: Cannot redeclare zen_output_string() (previously declared in C:\wamp64\www\newnaturals\ADMIN\includes\functions\general.php:39) in C:\wamp64\www\newnaturals\includes\functions\functions_general_shared.php on line 40
[27-May-2023 09:38:40 America/New_York] PHP Stack trace:
[27-May-2023 09:38:40 America/New_York] PHP 1. {main}() C:\wamp64\www\newnaturals\ADMIN\index.php:0
[27-May-2023 09:38:40 America/New_York] PHP 2. require() C:\wamp64\www\newnaturals\ADMIN\index.php:11
[27-May-2023 09:38:40 America/New_York] PHP 3. require() C:\wamp64\www\newnaturals\ADMIN\orders.php:12
[27-May-2023 09:38:40 America/New_York] PHP 4. require() C:\wamp64\www\newnaturals\ADMIN\includes\application_top.php:37
[27-May-2023 09:38:40 America/New_York] PHP 5. require_once() C:\wamp64\www\newnaturals\includes\autoload_func.php:37
[27-May-2023 09:38:40 America/New_York] Request URI: /newnaturals/ADMIN/index.php?cmd=orders, IP address: 127.0.0.1
--> PHP Fatal error: Cannot redeclare zen_output_string() (previously declared in C:\wamp64\www\newnaturals\ADMIN\includes\functions\general.php:39) in C:\wamp64\www\newnaturals\includes\functions\functions_general_shared.php on line 40.
I'm running PHP 7.4.3 on the test installation, and can't downgrade without going back to an earlier version of wamp, which I'm reluctant to do. Are you aware of any issues with the plugin and this version of PHP?
I believe I've located the problem, and it's not related to the PHP version. The version of \ADMIN\includes\functions\general.php that's in the current SBA download does contain the zen_output_string declaration at line 39, plus several others that are duplicated, and which turn up if you comment out the first one. I restored the original general.php file from the 1.5.7d download and the SBA installation appears to be installing and working correctly.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
What is the origin of the installed version? That obtained from github doesn't cause this issue when only the software for the plug in and the associated Zen Cart version are installed.
I installed the version that's currently in the plugin section of this site.
-
1 Attachment(s)
Re: Not working in PHP 7.4.3
The other thing I've encountered is that not all the configuration options are showing up. Mine stops at "Show Notice of Combining Cart on Login." So I can't get to where you edit attribute quantities. No errors on this.
Attachment 20304
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
HeleneWallis
The other thing I've encountered is that not all the configuration options are showing up. Mine stops at "Show Notice of Combining Cart on Login." So I can't get to where you edit attribute quantities. No errors on this.
Attachment 20304
That among other things would be related to using that very outdated version. The github version, depending on the Zen Cart version has little to no file touches and even then only dependent on the need of additional features offered by SBA.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
That among other things would be related to using that very outdated version. The github version, depending on the Zen Cart version has little to no file touches and even then only dependent on the need of additional features offered by SBA.
I used the button labeled 'Download Latest' simply for convenience. But I suspect many people don't have any idea how to pick things up from Github, since there doesn't appear to be a complete package available there. Please correct me if I'm wrong about that.
I'll uninstall what I have now and reinstall the latest, but is there any reason the latest can't be available direct from the plugin page? Is it because of the differences in files between Zencart versions?
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
HeleneWallis
I used the button labeled 'Download Latest' simply for convenience. But I suspect many people don't have any idea how to pick things up from Github, since there doesn't appear to be a complete package available there. Please correct me if I'm wrong about that.
I'll uninstall what I have now and reinstall the latest, but is there any reason the latest can't be available direct from the plugin page? Is it because of the differences in files between Zencart versions?
Never mind the above, I'm brain dead today. I had already downloaded the zip file for the latest from Github, got interrupted and forgot that I'd done it.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
HeleneWallis
I used the button labeled 'Download Latest' simply for convenience. But I suspect many people don't have any idea how to pick things up from Github, since there doesn't appear to be a complete package available there. Please correct me if I'm wrong about that.
I'll uninstall what I have now and reinstall the latest, but is there any reason the latest can't be available direct from the plugin page? Is it because of the differences in files between Zencart versions?
Nope, it's because I haven't devoted the time necessary to create instructions that fully describe the capability, usage, installation, and removal. The package on github is complete (sans the same instruction), the difference is that Zen Cart has been further developed to not require file changes previously considered necessary.
The plug-in from that zip file is functional for all Zen Cart 1.5.x versions for which there is a version sub directory. Installation is by the use of the base includes and the base ADMIN directories followed by the files of the Zen Cart version subdirectory of the servers version. In all cars if a file in the zip exists on the server, then should merge in the sba related modifications.
-
Re: Not working in PHP 7.4.3
I am curious to know if anyone has been able to use this plugin with the checkbox option yet for the 1.5.? Thank you!
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
chuckrey
I am curious to know if anyone has been able to use this plugin with the checkbox option yet for the 1.5.? Thank you!
And I'm curious if the question is asked because tried and failed or if to determine whether to try or not?
There are/were cases implemented, but use of check boxes may/may not be the optimum option. Would suggest describing your use case, if you don't mind.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
And I'm curious if the question is asked because tried and failed or if to determine whether to try or not?
There are/were cases implemented, but use of check boxes may/may not be the optimum option. Would suggest describing your use case, if you don't mind.
Products are furniture and more often then not multiple options must be chosen and check boxes would give a quick glance of all products to see what is in stock. Drop downs as I understand it will require them having to click each box to see the inventory count. So someone may want a 5 piece bedroom set and they may select 4 items then find the 5th item is out of stock which would then cause them to search for another item. As to the question of whether I have attempted to do myself.. I looked at the files and code and it is beyond my level of knowledge to make it happen. I will give it another look, but thought if someone made it work already, they could give me some direction as to where to look.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
chuckrey
Products are furniture and more often then not multiple options must be chosen and check boxes would give a quick glance of all products to see what is in stock. Drop downs as I understand it will require them having to click each box to see the inventory count. So someone may want a 5 piece bedroom set and they may select 4 items then find the 5th item is out of stock which would then cause them to search for another item. As to the question of whether I have attempted to do myself.. I looked at the files and code and it is beyond my level of knowledge to make it happen. I will give it another look, but thought if someone made it work already, they could give me some direction as to where to look.
Is the combination of the five items the only way that they can be combined or is each item in its own quantity?
Stock quantities associated with attributes basically is either all selections together makes a product, or each selection has its own stock. There is one caveat available in that an attribute(s) can be assigned as unlimited, basically
-
Re: Not working in PHP 7.4.3
Each item would have it's own count/quantity. Some people will buy a bedroom set with 1 nightstand or 2. Some people want a chest others do not, etc.. King bed or queen bed. I have considered not using attributes and using the inventory counts and placing each item separately, but it's not ideal.
Thanks for asking.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
chuckrey
Each item would have it's own count/quantity. Some people will buy a bedroom set with 1 nightstand or 2. Some people want a chest others do not, etc.. King bed or queen bed. I have considered not using attributes and using the inventory counts and placing each item separately, but it's not ideal.
Thanks for asking.
To that then I question if a check box would be appropriate.
A check box allows multiple items to be selected within a single group. Basically someone would be able to check every item that is or was part of a single product and not be prevented from doing so until submitting the product to the cart.
Back to the original discussion of a drop-down box or not, not saying should definitely use such, but I'm not seeing how check boxes accomplish your goal. Even with this software, that each attribute would have its own quantity and the value in one attribute could be used in the value of another means that there is some stock management that will need to be done or programed for it to work best for the store front.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
To that then I question if a check box would be appropriate.
A check box allows multiple items to be selected within a single group. Basically someone would be able to check every item that is or was part of a single product and not be prevented from doing so until submitting the product to the cart.
Back to the original discussion of a drop-down box or not, not saying should definitely use such, but I'm not seeing how check boxes accomplish your goal. Even with this software, that each attribute would have its own quantity and the value in one attribute could be used in the value of another means that there is some stock management that will need to be done or programed for it to work best for the store front.
Yes, I understand completely that point of view. The attributes are not really part of a single item as much as they are part of a group. My hope was to be able to show counts without having to click each item to see the count. No doubt drop down works from a functional standpoint just as well and that is sounding like the route I will need to go. Thank you so much for your input and helping to thing things through. I greatly appreciate your knowledge.
-
Re: Not working in PHP 7.4.3
Question regarding inventory count on the product listing page. I am using 1.5.4 SBA.
Utilizing SBA Drop Down for attributes..
The inventory counts are adding up the total amount of items available I placed in the attributes. Is there a way to have the total count on the product listing page display the lowest count item instead?
For example. I have a sectional with 2 pieces to it, a right side and a left side. That equates to 1 sectional. However, it displays 2 sectionals on the product listing page because there is 1 left side and 1 right side. I would prefer that it display 1 count. Even if there was 1 left side and 0 right sides. I would prefer it display out of stock as there would not be a complete sectional in stock.
I hope that makes sense, I searched through the posts, but struggled to find an answer, sorry if I missed it. Thank you!
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
chuckrey
Question regarding inventory count on the product listing page. I am using 1.5.4 SBA.
Utilizing SBA Drop Down for attributes..
The inventory counts are adding up the total amount of items available I placed in the attributes. Is there a way to have the total count on the product listing page display the lowest count item instead?
For example. I have a sectional with 2 pieces to it, a right side and a left side. That equates to 1 sectional. However, it displays 2 sectionals on the product listing page because there is 1 left side and 1 right side. I would prefer that it display 1 count. Even if there was 1 left side and 0 right sides. I would prefer it display out of stock as there would not be a complete sectional in stock.
I hope that makes sense, I searched through the posts, but struggled to find an answer, sorry if I missed it. Thank you!
So there are basically two sets of counts. One is for total product, the other is for count of attributes. To display that you have the ability to sell just one item, regardless the number of attributes, then the total product quantity (shown on the admin->product info page) should be set to one. Then your attribute quantity set to your desired quantity.
Here's where some mental gymnastics come into play. Namely that the ability to add a product to the cart may be impeded if the total quantity or whatever selected attribute(s) have a quantity of zero. Also, in the sba admin screen, if the total product is not equal to the sum of the attribute quantity, you should see an indicator of which side has more quantity and also be offered the opportunity to balance the quantity. That balance changes the total quantity of the base product. Ahem, meaning that is a back door way to make the above adjustment to the total quantity of the base product...
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
So there are basically two sets of counts. One is for total product, the other is for count of attributes. To display that you have the ability to sell just one item, regardless the number of attributes, then the total product quantity (shown on the admin->product info page) should be set to one. Then your attribute quantity set to your desired quantity.
Here's where some mental gymnastics come into play. Namely that the ability to add a product to the cart may be impeded if the total quantity or whatever selected attribute(s) have a quantity of zero. Also, in the sba admin screen, if the total product is not equal to the sum of the attribute quantity, you should see an indicator of which side has more quantity and also be offered the opportunity to balance the quantity. That balance changes the total quantity of the base product. Ahem, meaning that is a back door way to make the above adjustment to the total quantity of the base product...
Okay, so I can make the adjustment on the SBA admin to display the desired amt on the base product. Got it. Thank you...
Another question that I just noticed which is a HUGE impact on whether I can use this plugin...
The website is a wholesale distributor that sells to retail stores exclusively. Therefore the customers must login to view prices, other wise it is set to login to view prices. I noticed that the attribute prices whether logged in or not are displayed. Is there a way to turn it off so it can be displayed ONLY when logged in?
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
chuckrey
Okay, so I can make the adjustment on the SBA admin to display the desired amt on the base product. Got it. Thank you...
Another question that I just noticed which is a HUGE impact on whether I can use this plugin...
The website is a wholesale distributor that sells to retail stores exclusively. Therefore the customers must login to view prices, other wise it is set to login to view prices. I noticed that the attribute prices whether logged in or not are displayed. Is there a way to turn it off so it can be displayed ONLY when logged in?
I just found out why it is displaying when not logged in. When I have 2 different option names displayed for one product, it displays the price. It also does not display the attribute names, counts or anything for the 2nd option name values. I will have to use one option name instead of multiple.
-
Re: Not working in PHP 7.4.3
Using 1.5.4
Moving along and hit a glitch.... I am trying to use the "import" function. After checking to see if the quantities have been updated, nothing has changed... So I checked the log and saw this: [15-Jun-2023 18:41:09 UTC] PHP Fatal error: Cannot declare class products_with_attributes_stock, because the name is already in use in /home/xxxxx/public_html/xxxadminxx/includes/classes/products_with_attributes_stock.php on line 0..
I found a mention on Github but due to my limited to nearly zero knowledge of coding, I am confused....
The process I took was to upload the file named: "tableSBAdata.csv" to the backups folder in admin then go to import and submit.... I have hundreds of items to upload so manual updating is unfortunately not an option. I did search the thread w/ keywords of "import" and "bulk" then did an online search and that is where I found the Github mention.
Help please...... Thanks yet again.....
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
chuckrey
Using 1.5.4
Moving along and hit a glitch.... I am trying to use the "import" function. After checking to see if the quantities have been updated, nothing has changed... So I checked the log and saw this: [15-Jun-2023 18:41:09 UTC] PHP Fatal error: Cannot declare class products_with_attributes_stock, because the name is already in use in /home/xxxxx/public_html/xxxadminxx/includes/classes/products_with_attributes_stock.php on line 0..
I found a mention on Github but due to my limited to nearly zero knowledge of coding, I am confused....
The process I took was to upload the file named: "tableSBAdata.csv" to the backups folder in admin then go to import and submit.... I have hundreds of items to upload so manual updating is unfortunately not an option. I did search the thread w/ keywords of "import" and "bulk" then did an online search and that is where I found the Github mention.
Help please...... Thanks yet again.....
From my perspective, getting the sba import feature to fully operate was to much, so an import feature was instead incorporated into easy populate version 4 (EP4).
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
From my perspective, getting the sba import feature to fully operate was to much, so an import feature was instead incorporated into easy populate version 4 (EP4).
Okay, looks like: Detailed Stock By Attributes Data (detailed multi-line)...... I will go that route.....
Thanks.
-
Re: Not working in PHP 7.4.3
I recently upgraded from 1.5.7 to 1.5.8 and started receiving the following error whenever a search is done in SBA Search. I went back to 1.5.7 and it did not have the error. Then I tried upgrading for the second time with new douwn loads etc. and the error repeated. It appears the error is in 1.5.8.
Has anyone else experienced the error?
SBA Error
Product ID Search
[21-Jul-2023 21:20:31 UTC] Request URI: /shop_new/flinG-zvG-sKips/index.php?cmd=products_with_attributes_stock&page=1&search_order_by=products_id, IP address: 69.137.114.242, Language id 1
#1 trigger_error() called at [/includes/classes/db/mysql/query_factory.php:667]
#2 queryFactory->show_error() called at [/includes/classes/db/mysql/query_factory.php:634]
#3 queryFactory->set_error() called at [/includes/classes/db/mysql/query_factory.php:275]
#4 queryFactory->Execute() called at [/flinG-zvG-sKips/includes/classes/split_page_results.php:220]
#5 splitPageResults->numberRows() called at [/flinG-zvG-sKips/includes/classes/split_page_results.php:131]
#6 splitPageResults->__construct() called at [/flinG-zvG-sKips/includes/classes/products_with_attributes_stock.php:389]
#7 products_with_attributes_stock->displayFilteredRows() called at [/flinG-zvG-sKips/products_with_attributes_stock.php:1506]
#8 require(/flinG-zvG-sKips/products_with_attributes_stock.php) called at [/flinG-zvG-sKips/index.php:11]
--> PHP Fatal error: 1060:Duplicate column name 'products_id' :: SELECT count(*) as total 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_id FROM products_attributes pa INNER JOIN products_description pd ON (pa.products_id = pd.products_id) INNER JOIN products p ON (pa.products_id = p.products_id) WHERE pd.language_id=1 ORDER BY p.products_id ) countresults ==> (as called by) /flinG-zvG-sKips/includes/classes/split_page_results.php on line 220 <== in /includes/classes/db/mysql/query_factory.php on line 667.
-
Re: Not working in PHP 7.4.3
There's a combination of reasons for the error now occurring in Zen cart 1.5.8, but not before. I thought I had sufficiently addressed such issues, but looking at the code and the message log posted, I clearly see that I had not.
I'm not yet sure I consider this the most efficient or best solution, but it works to address the problem.
In admin/includes/classes/products_with_attributes_stock.php at line 366, change it from:
Code:
if ($fieldsKey !== false) {
To:
Code:
if ($fieldsKey !== false || 'products_id' === substr($fieldsKey, strpos($fieldsKey, '.') + 1)) {
The issue ultimately is in the situation that occurred, the products_id was used as a search option, as well the products_attributes table's products_id is used as a returned value. In the loop of the above code, the expectation was to remove one of them from the query, but the existing logic doesn't support that.
Part of a goal solution is to revisit why the product_attributes table products_id is used so that may be able to eliminate that as a problem. It's been so long since this section of code was developed I don't yet recall why that specifically is used and I haven't looked at it as part of this solution. Just wanted to fix the observed problem at least temporarily.
Thank you for reporting this issue.
-
Re: Not working in PHP 7.4.3
Still have the same problem.
When entering the Product_ID in the search box.
WARNING: An Error occurred, please let us know! If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you entered valid data.
Then an error log is created.
[24-Jul-2023 12:17:13 UTC] Request URI: /shop_new/XlinG-zvZ-sBips/index.php?cmd=products_with_attributes_stock&page=1&search_order_by=products_id, IP address: 174.212.102.144, Language id 1
#1 trigger_error() called at [/includes/classes/db/mysql/query_factory.php:667]
#2 queryFactory->show_error() called at [/includes/classes/db/mysql/query_factory.php:634]
#3 queryFactory->set_error() called at [/includes/classes/db/mysql/query_factory.php:275]
#4 queryFactory->Execute() called at [/deleted/includes/classes/split_page_results.php:220]
#5 splitPageResults->numberRows() called at [/Deleted/includes/classes/split_page_results.php:131]
#6 splitPageResults->__construct() called at [/XlinG-zvZ-sBips/includes/classes/products_with_attributes_stock.php:389]
#7 products_with_attributes_stock->displayFilteredRows() called at [/Deleted/products_with_attributes_stock.php:1532]
#8 require(/XlinG-zvZ-sBips/products_with_attributes_stock.php) called at [/Deleted/index.php:11]
--> PHP Fatal error: 1060:Duplicate column name 'products_id' :: SELECT count(*) as total 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_id FROM products_attributes pa INNER JOIN products_description pd ON (pa.products_id = pd.products_id) INNER JOIN products p ON (pa.products_id = p.products_id) WHERE pd.language_id=1 ORDER BY p.products_id ) countresults ==> (as called by) /XlinG-zvZ-sBips/includes/classes/split_page_results.php on line 220 <== in /includes/classes/db/mysql/query_factory.php on line 667.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
mc12345678
There's a combination of reasons for the error now occurring in Zen cart 1.5.8, but not before. I thought I had sufficiently addressed such issues, but looking at the code and the message log posted, I clearly see that I had not.
I'm not yet sure I consider this the most efficient or best solution, but it works to address the problem.
In admin/includes/classes/products_with_attributes_stock.php at line 366, change it from:
Code:
if ($fieldsKey !== false) {
To:
Code:
if ($fieldsKey !== false || 'products_id' === substr($fieldsKey, strpos($fieldsKey, '.') + 1)) {
The issue ultimately is in the situation that occurred, the products_id was used as a search option, as well the products_attributes table's products_id is used as a returned value. In the loop of the above code, the expectation was to remove one of them from the query, but the existing logic doesn't support that.
Part of a goal solution is to revisit why the product_attributes table products_id is used so that may be able to eliminate that as a problem. It's been so long since this section of code was developed I don't yet recall why that specifically is used and I haven't looked at it as part of this solution. Just wanted to fix the observed problem at least temporarily.
Thank you for reporting this issue.
rather than doing it this way, could one not simply change line 352 to p.products_id? i think it would be simpler. ie:
Code:
//from
$retFields = array(
'pa.products_id',
'pd.products_name',
'p.products_quantity',
'p.products_model',
'p.products_image',
'p.products_type',
'p.master_categories_id',
);
//to
$retFields = array(
'p.products_id',
'pd.products_name',
'p.products_quantity',
'p.products_model',
'p.products_image',
'p.products_type',
'p.master_categories_id',
);
i think that should work.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
carlwhat
rather than doing it this way, could one not simply change line 352 to p.products_id? i think it would be simpler. ie:
Code:
//from
$retFields = array(
'pa.products_id',
'pd.products_name',
'p.products_quantity',
'p.products_model',
'p.products_image',
'p.products_type',
'p.master_categories_id',
);
//to
$retFields = array(
'p.products_id',
'pd.products_name',
'p.products_quantity',
'p.products_model',
'p.products_image',
'p.products_type',
'p.master_categories_id',
);
i think that should work.
Your method solved the bug.
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
jodean
Your method solved the bug.
:thumbsup:
-
Re: Not working in PHP 7.4.3
Quote:
Originally Posted by
jodean
Your method solved the bug.
Of course, it is/was one of many potential solutions to the reported issue.
Even still, there's an unresolved issue that was identified by this reporting. But, if happy with the results then will seek to resolve at a later date to further address what is desired in this area of code. I know I don't like the current results, but I can still get what I need.
-
SBA Select List (Dropdown) Basic
Current version 1.5.7b
Using 1 option name with "SBA Select List (Dropdown) Basic" and I would like to rearrange how the quantity and price show in the dropdown. Current order is option value + stock qty + price. Would like to have it read option value + price + stock qty.
Pretty sure I need to edit class.products_with_attributes_stock.php not sure where. Any guidance would be appreciated.
Thanks
-
Re: SBA Select List (Dropdown) Basic
Last question, then I have a lot of other work to do.
How do I set "No, Do not show Quantity Box" in EP?
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
gemohler
Last question, then I have a lot of other work to do.
How do I set "No, Do not show Quantity Box" in EP?
Question is more applicable for the EP4 thread; however, the specific products table field to "not show the quantity box" is: products_qty_box_status
That field can be added to your export/import of EP4 fields by updating the user defined fields within the configuration. In your import/export file, the field will be shown as: v_products_qty_box_status; however, the user defined fields should just identify the field as it is listed in the products table: products_qty_box_status
Then, setting that value to 0 will prevent the display of the quantity box on the product information page (when considering a Zen Cart standard/base template). Templates could be designed that exclude this feature/capability so if such is not working in your cart, then please attempt to use one of the Zen Cart default templates for testing and discovering where the problem is.
In a standard Zen Cart template, the same effect can be made by restricting the maximum product quantity to 1. Note though that these two characteristics may operate differently throughout the store. For example, having a product quantity of only 1 being added from the product information page, means that for each add to the cart only a quantity of 1 is added, but the total quantity at checkout could exceed 1. Limiting a maximum product quantity to 1 is expected to prevent the cart from having any quantity larger than 1 meaning ultimately checkout of that product can be of only a quantity of 1. (While not necessarily easily done in the base code, if a partial quantity of the product can be incorporated, then the expectation of having a maximum quantity of 1 is that at no time could any portion of a quantity added to the existing amount expected to be able to exceed 1.)
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
lsde
Current version 1.5.7b
Using 1 option name with "SBA Select List (Dropdown) Basic" and I would like to rearrange how the quantity and price show in the dropdown. Current order is option value + stock qty + price. Would like to have it read option value + price + stock qty.
Pretty sure I need to edit class.products_with_attributes_stock.php not sure where. Any guidance would be appreciated.
Thanks
lsde, I apologize for two things, one in attempting to create my post about the quantity box, I lost what I had researched and begun creating to answer your question, two is that I had not completed that response in a more timely manner.
Basically, the stock quantity text is generated and incorporated in $PWA_STOCK_QTY within includes/classes/observers/class.products_with_attributes_stock.php.
The "safest" way that I see to resequence the data so that the newly added stock quantity does not appear in other potentially undesirable areas, would be to add an additional notifier to your copy of includes/modules/YOUR_TEMPLATE/attributes.php after this code group:
Code:
$zco_notifier->notify('NOTIFY_ATTRIBUTES_MODULE_ORIGINAL_PRICE', $products_options->fields, $products_options_array, $products_options_display_price, $data_properties);
$products_options_array[count($products_options_array) - 1]['text'] .= $products_options_display_price;
to look something like this:
Code:
$zco_notifier->notify('NOTIFY_ATTRIBUTES_MODULE_ORIGINAL_PRICE', $products_options->fields, $products_options_array, $products_options_display_price, $data_properties);
$products_options_array[count($products_options_array) - 1]['text'] .= $products_options_display_price;
$zco_notifier->notify('NOTIFY_ATTRIBUTES_MODULE_AFTER_ORIGINAL_PRICE', $products_options->fields, $products_options_array, $data_properties);
The reason is this: The developers and associated code maintainers have merged in the price to the notifier: NOTIFY_ATTRIBUTES_MODULE_ORIGINAL_PRICE, such that if $products_options_display_price is modified to include your desired stock quantity at the end, it will impact later usage of that variable. Further there is no notifier before the next addition of text to $products_options_array[nth_value]['text'] to force/guarantee that the quantity would be the next value added because weight information is possibly the next content to be added to that array value. Then if weight information isn't added, the next existing code opportunity is to use the observer: NOTIFY_ATTRIBUTES_MODULE_BEFORE_ASSEMBLE_OUTPUTS with a forced global in that observer to update that text or for specifically observing about 'SBA Select List' to do similar in the observer for NOTIFY_ATTRIBUTES_MODULE_DEFAULT_SWITCH (again recognizing that this addition would be after any expected addition of weight related text).
If the text is added directly to the price related information, then note that $products_options_details and $products_options_details_noname will each also include that additional information and that there are unevaluated downstream affects of that additional content.
-
Re: SBA Select List (Dropdown) Basic
Is there a simple switch to disable a selected attribute being shown as the product image in the shopping cart?
I didn't see anything in admin for it so if I missed it, either I'm losing the plot or I need to update the prescription on my glasses!
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
strelitzia
Is there a simple switch to disable a selected attribute being shown as the product image in the shopping cart?
I didn't see anything in admin for it so if I missed it, either I'm losing the plot or I need to update the prescription on my glasses!
To confirm terminology and request, it's OK to swap the image on the product page, but not on the shopping cart page? Is that the request?
-
Re: SBA Select List (Dropdown) Basic
I don't need to swap images on either page. The attribute images are simply a graphical display of nicotine strength in e-liquids. The same attribute images are used across all products so disabling image swap completely would be the preferred method.
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
strelitzia
I don't need to swap images on either page. The attribute images are simply a graphical display of nicotine strength in e-liquids. The same attribute images are used across all products so disabling image swap completely would be the preferred method.
Then yes, SBA Display Attributes Images set to 0 would accomplish not swapping. That configuration setting should have been added to configuration->Stock during install/upgrade.
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
mc12345678
Then yes, SBA Display Attributes Images set to 0 would accomplish not swapping. That configuration setting should have been added to configuration->Stock during install/upgrade.
And therein lies the problem. As it was an image related change I was looking under the 'Images' configuration options. TBH it never even occurred to me to look under 'Stock'.
Thanks for the quick response mcnumbers
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
strelitzia
And therein lies the problem. As it was an image related change I was looking under the 'Images' configuration options. TBH it never even occurred to me to look under 'Stock'.
Thanks for the quick response mcnumbers
In development when there was a lot spoken about configuration listing assignment, tried to keep as much in one place as reasonably possible. Haven't gone back to revisit and not sure what additional value to users there would be.
Had toyed with idea of a unique configuration menu just for SBA, a separate admin page, mixing into default areas, etc... sorry about the confusion caused in this case, but glad to help!
-
Re: SBA Select List (Dropdown) Basic
[ZC v1.5.8][Bootstrap v3.5.0]
I have a problem of image swapping on the product info page for Bootstrap template.
When I switch to other templates, e.g. Classic Contemporary Green or Responsive Classic Template, image swapping works fine.
I have the hunch that it is due to includes/modules/bootstrap/attributes.php
because on an earlier version of this file (later overwritten) mc12345678 wrote in the info-header:
Code:
* attributes module
*
* Prepares attributes content for rendering in the template system
* Prepares HTML for input fields with required uniqueness so template can display them as needed and keep collected data in proper fields
*
* @package modules
* @copyright Copyright 2003-2018 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: mc12345678 Fri Nov 9 21:03:09 2018 -0500 Modified in v1.5.6 $
*
* Stock by Attributes 1.5.4 : mc12345678 16-01-02
* Attribute image replaces main product image on selecting attribute mc12345678 16-12-09
* Incorporated to support ZC 1.5.1 and up when using SBA.
So, obviously it is needed for image swapping.
However, there are far too many changes in the attributes file that I do not know where to start.
Is there any adapted version of the bootstrap's or can anyone guide me what essential changes to make in the attributes.php ?
-
Re: SBA Select List (Dropdown) Basic
I don't recall at what version of Zen Cart, but at that point which includes 1.5.8 (back to some version) the attributes file did not require override. The base 1.5.8 version is sufficient. Further the Javascript/jquery involved does not override the associated actions.
My suggestion would be to consider inspecting your page(s) for html and/or Javascript validation. The template may not validate and cause swap issues. Another may be that expected tags may have been altered.
As normally is presented in the posting tips, for others to independently see the on page issues, an example link should be given. If another page works within the same template then that should be shared as well. Of course break it up as necessary to prevent indexing or that sort of web action.
Then lastly, suggest identifying versions of things installed.
-
Re: SBA Select List (Dropdown) Basic
[ZC v1.5.8][Bootstrap v3.5.0][SBA v4.0]
Unfortunately I can not share a link, coz it is yet running on a localhost.
The versions of modules I use are in the upper part of my message.
I have checked for mistakes by a validator; the only important mistake i got is SBA_ProductImage id tag being repeated:
Quote:
Validator message export for "https://localhost/":
Generated by CSS HTML Validator Professional 2024/v24.0100 (
https://htmlval.com/)
1. Error in line 754 at character 194: The "id" attribute value "SBA_ProductImage" has already been used in this document in a <img> tag that starts in line 719. An element's "id" value must be unique within the document. An element cannot have an "id" attribute that has already been used. Note that "id" values are treated as being case-sensitive.
2. Error in line 765 at character 151: The "id" attribute value "SBA_ProductImage" has already been used in this document in a <img> tag that starts in line 719. An element's "id" value must be unique within the document. An element cannot have an "id" attribute that has already been used. Note that "id" values are treated as being case-sensitive.
I bet, this is the tag being used by the javascript for an image swap, so it sounded important to me.
This is probably because in includes/templates/bootstrap/templates/tpl_product_info_display.php in the <-- Main Product Image --> section there is a call to includes/templates/bootstrap/templates/tpl_modules_main_product_image.php and then from there to includes/modules/main_product_image.php which has a notifer to 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME' which is observed by includes/classes/observers/auto.pwas_imageswap.php and hence in the first call to zen_image function ' id="SBA_ProductImage" ' is added to the images HTML output.
However also in tpl_product_info_display.php in the <-- Additional Product Images --> section there is a call to includes/templates/bootstrap/modalboxes/tpl_bootstrap_images.php which has an include to main_product_image.php and again SBA_ProductImage gets appended twice more to html image output.
Now, this I have overcome by stoping the observation of 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME' after the first occurance of 'NOTIFY_OPTIMIZE_IMAGE' (html image output). Does it sound right?
In includes/classes/observers/auto.pwas_imageswap.php after around line 53 I add the detach statement:
PHP Code:
$parameters .= ' id="SBA_ProductImage" ';
$this->detach($this, array('NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_START'));
thus no other SBA_ProductImage id tag is added to the images.
Now, this is not even the tip of the iceberg. There are a lot more changes/modifications needed in the bootstrap template files so that an image swap may succeed. Most important of all, the javascript part which is supposed to do the imageswap is not appended.
In order to separate the focus, I will discuss/consult in the following posts.
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
zamzom
[ZC v1.5.8][Bootstrap v3.5.0][SBA v4.0]
Unfortunately I can not share a link, coz it is yet running on a localhost.
The versions of modules I use are in the upper part of my message.
I have checked for mistakes by a validator; the only important mistake i got is SBA_ProductImage id tag being repeated:
I bet, this is the tag being used by the javascript for an image swap, so it sounded important to me.
This is probably because in includes/templates/bootstrap/templates/tpl_product_info_display.php in the <-- Main Product Image --> section there is a call to includes/templates/bootstrap/templates/tpl_modules_main_product_image.php and then from there to includes/modules/main_product_image.php which has a notifer to 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME' which is observed by includes/classes/observers/auto.pwas_imageswap.php and hence in the first call to zen_image function ' id="SBA_ProductImage" ' is added to the images HTML output.
However also in tpl_product_info_display.php in the <-- Additional Product Images --> section there is a call to includes/templates/bootstrap/modalboxes/tpl_bootstrap_images.php which has an include to main_product_image.php and again SBA_ProductImage gets appended twice more to html image output.
Now, this I have overcome by stoping the observation of 'NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_FILENAME' after the first occurance of 'NOTIFY_OPTIMIZE_IMAGE' (html image output). Does it sound right?
In includes/classes/observers/auto.pwas_imageswap.php after around line 53 I add the detach statement:
PHP Code:
$parameters .= ' id="SBA_ProductImage" ';
$this->detach($this, array('NOTIFY_MODULES_MAIN_PRODUCT_IMAGE_START'));
thus no other SBA_ProductImage id tag is added to the images.
Now, this is not even the tip of the iceberg. There are a lot more changes/modifications needed in the bootstrap template files so that an image swap may succeed. Most important of all, the javascript part which is supposed to do the imageswap is not appended.
In order to separate the focus, I will discuss/consult in the following posts.
There's a number of ways to address the situation. Detaching after the first occurrence can be an appropriate solution, though I personally find this designed loop to be troubling where such an observer is effectively reused.
So what are some other ways to address/handle this? What I am thinking of doing is implementing a class internal counter that accounts for the number of times that a particular notifier is called. In this way, a modicum of control could be maintained about what is and what is not executed within a notifier. By detaching, the observer is ignored completely as compared to being entered but a quantity of action bypassed. Sure maybe an observer should only be tracked by a used/not used condition instead of them going down a "how many times have you been called" counter. Each has its place and need though I may implement one type throughout it all.
-
Re: SBA Select List (Dropdown) Basic
Quote:
Originally Posted by
mc12345678
There's a number of ways to address the situation. Detaching after the first occurrence can be an appropriate solution, though I personally find this designed loop to be troubling where such an observer is effectively reused.
So what are some other ways to address/handle this? What I am thinking of doing is implementing a class internal counter that accounts for the number of times that a particular notifier is called. In this way, a modicum of control could be maintained about what is and what is not executed within a notifier. By detaching, the observer is ignored completely as compared to being entered but a quantity of action bypassed. Sure maybe an observer should only be tracked by a used/not used condition instead of them going down a "how many times have you been called" counter. Each has its place and need though I may implement one type throughout it all.
Yes, I agree, therefore in fact I have been also along the same path of thinking and I have given up detaching the observer, because there are other images need to be swapped, too. I have not posted about it in here, since things are not completely working yet. But since you mentioned, here is what I have done:
Changes in auto.pwas_imageswap.php
1- I have added a new variable to count occurances of SBA_ProductImage (around after line #17)
PHP Code:
private $MainImage;
private $image_no; // Add underscore image no
function __construct() {
$image_no =0; // Reset image no
$attachNotifier = array();
2-I have changed the parameters variable as follows (around line #56)
PHP Code:
$parameters .= ' id="SBA_ProductImage_' . strval(++$this->image_no) . '" '; // Modified to add underscore number
This creates id tags such as SBA_ProductImage_1, SBA_ProductImage_2 etc. for each occurance.
But then, since the javascript is looking for SBA_ProductImage id tag to replace the image, I needed to change the
includes/classes/class.products_with_attributes_class_stock.php as follows (changes are on those lines where SBA_ProductImage occurs)
PHP Code:
function zen_draw_pull_down_menu_SBAmod($name, $values, $default = '', $parameters = '', $required = false, $disable = array(), $options_menu_images = null) {
// global $template_dir;
$tmp_attribID = trim($name, 'id[]');//used to get the select ID reference to be used in jquery
$field = '';
if (defined('SBA_SHOW_IMAGE_ON_PRODUCT_INFO') && SBA_SHOW_IMAGE_ON_PRODUCT_INFO != '0' && !empty($_GET['products_id']) && $this->zen_product_is_sba($_GET['products_id']))
{
$field = /*'<script ' . *//*src="'.DIR_WS_TEMPLATES . $template_dir . '/jscript/jquery-1.10.2.min.js"*//* '></script> */
'<script type="text/javascript">
$(function(){
$("#attrib-'.$tmp_attribID.'").change(function(){
if (typeof $(this).find(":selected").attr("data-src") == "undefined") {
$("[id^=\'SBA_ProductImage_\']").attr("src", "'; // This is the end of the assignment to $field before the below
if (isset($options_menu_images) && is_array($options_menu_images) && (isset($options_menu_images['product_image']) || array_key_exists('product_image', $options_menu_images))) {
if ($options_menu_images['product_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1'
or $options_menu_images['product_image'] == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$field .= DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
} else {
$field .= $options_menu_images['product_image'];
}
} else {
if (PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
$field .= DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
}
}
$field .= '");
} else {
$("[id^=\'SBA_ProductImage_\']").attr("src", $(this).find(":selected").attr("data-src"));
}
if (typeof $("#productMainImage") != "undefined") {
if (typeof $("#productMainImage a[href]") != "undefined") {
$("#productMainImage a[href]").attr("href",$("#SBA_ProductImage_1").attr("src"));
}
}
});
});
</script>';
}
So, it will replace all images no matter what is after the underscore.
I am not good in PHP, but particularly bad in javascript, and I found this solution on StackOverflow. Does it look good? It works fine though.
-
Re: SBA Select List (Dropdown) Basic
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
how do i fix this warning
[28-Mar-2024 21:32:23 UTC] Request URI: /Returns, IP address: 44.222.104.49
#1 products_with_attributes_stock->catalogCustomID() called at [/var/www/clients/client1/web3/web/includes/classes/observers/class.pwas_customid.php:32]
#2 pwas_customid->updateNotifyHeaderEndAccountHistoryInfo() called at [/var/www/clients/client1/web3/web/includes/classes/class.base.php:103]
#3 base->notify() called at [/var/www/clients/client1/web3/web/includes/modules/pages/returns_request/header_php.php:74]
#4 require(/var/www/clients/client1/web3/web/includes/modules/pages/returns_request/header_php.php) called at [/var/www/clients/client1/web3/web/index.php:36]
--> PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client1/web3/web/includes/classes/observers/class.products_with_attributes_stock.php on line 1612.
and here is line 1612 from file
Code:
foreach ($productArray as $i => &$productsI) {
$customid[$i] = '';
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
jimmie
how do i fix this warning
[28-Mar-2024 21:32:23 UTC] Request URI: /Returns, IP address: 44.222.104.49
#1 products_with_attributes_stock->catalogCustomID() called at [/var/www/clients/client1/web3/web/includes/classes/observers/class.pwas_customid.php:32]
#2 pwas_customid->updateNotifyHeaderEndAccountHistoryInfo() called at [/var/www/clients/client1/web3/web/includes/classes/class.base.php:103]
#3 base->notify() called at [/var/www/clients/client1/web3/web/includes/modules/pages/returns_request/header_php.php:74]
#4 require(/var/www/clients/client1/web3/web/includes/modules/pages/returns_request/header_php.php) called at [/var/www/clients/client1/web3/web/index.php:36]
--> PHP Warning: Invalid argument supplied for foreach() in /var/www/clients/client1/web3/web/includes/classes/observers/class.products_with_attributes_stock.php on line 1612.
and here is line 1612 from file
Code:
foreach ($productArray as $i => &$productsI) {
$customid[$i] = '';
Could you post the contents of includes/modules/pages/returns_request/header_php.php?
It appears that the code is "misusing" or not properly initiating the process to fully support reuse of the notifier associated with account history information...
While, the code may be "the same" as a possibility, perhaps the avenue to arrive there is not equivalent. When looking at the code for includes/modules/pages/account_history_info/header_php.php, there are a number of "early out" operations to ensure that processing continues successfully and as expected for arriving on that page.
Reviewing the order class initiation (__construct) at least in ZC 1.5.8, the result is at least an array of product even if that is an empty array. Provided the product member is an array, there should be no issue with attempting execution of that foreach loop. It just wouldn't do any action if it was empty. That said, I see in the order class initiation there are also two additional notifiers either of which may have been called and modified the data being returned... That could be an indicator of the situation's cause.
Based on the warning message, it appears that $order is initiated (not null), otherwise there would be an issue within observer class.pwas_customid.php at line 32 with attempting to access a null variable or accessing a member that does not exist $order->products. These issues do not arise and instead $order->products appears to not be an array, though the warning doesn't identify what type of variable it is (null, false, or something else). There may also be other information in that particular log that points to one or more of the above issues, but I have to assume that the entire log was provided.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
here you go, also forgot to mention im using zen version 1.56c
Code:
<?php
/**
*
* @package page
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: J_Schilz for Integrated COWOA - 14 April 2007
*/
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_HISTORY_INFO');
$_SESSION['navigation']->set_snapshot();
if ($_SESSION['customer_id']) {
zen_redirect(zen_href_link(FILENAME_ACCOUNT_HISTORY, 'action=returns_request', 'SSL'));
}
if (!isset($_POST['order_id']) || (isset($_POST['order_id']) && !is_numeric($_POST['order_id'])))
$errorInvalidID=TRUE;
$query_email_address = trim($_POST['query_email_address']);
if(!isset($query_email_address) || zen_validate_email($query_email_address) == false)
$errorInvalidEmail=TRUE;
if(!$errorInvalidID && !$errorInvalidEmail)
{
$customer_info_query = "SELECT customers_email_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country,
billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country
FROM " . TABLE_ORDERS . "
WHERE orders_id = :ordersID";
$customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_POST['order_id'], 'integer');
$customer_info = $db->Execute($customer_info_query);
if (isset($query_email_address) && $customer_info->fields['customers_email_address'] != $query_email_address && $customer_info->fields['customers_email_address'] != $query_email_address . '.')
$errorNoMatch=TRUE;
else
{
$statuses_query = "SELECT os.orders_status_name, osh.date_added, osh.comments
FROM " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh
WHERE osh.orders_id = :ordersID
AND osh.orders_status_id = os.orders_status_id
AND os.language_id = :languagesID
AND osh.customer_notified >= 0
ORDER BY osh.date_added";
$statuses_query = $db->bindVars($statuses_query, ':ordersID', $_POST['order_id'], 'integer');
$statuses_query = $db->bindVars($statuses_query, ':languagesID', $_SESSION['languages_id'], 'integer');
$statuses = $db->Execute($statuses_query);
while (!$statuses->EOF) {
$statusArray[] = array('date_added'=>$statuses->fields['date_added'],
'orders_status_name'=>$statuses->fields['orders_status_name'],
'comments'=>$statuses->fields['comments']);
$statuses->MoveNext();
}
require(DIR_WS_CLASSES . 'order.php');
$order = new order($_POST['order_id']);
}
}
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_ACCOUNT_HISTORY_INFO');
?>
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
jimmie
here you go, also forgot to mention im using zen version 1.56c
Code:
<?php
/**
*
* @package page
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: J_Schilz for Integrated COWOA - 14 April 2007
*/
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_HISTORY_INFO');
$_SESSION['navigation']->set_snapshot();
if ($_SESSION['customer_id']) {
zen_redirect(zen_href_link(FILENAME_ACCOUNT_HISTORY, 'action=returns_request', 'SSL'));
}
if (!isset($_POST['order_id']) || (isset($_POST['order_id']) && !is_numeric($_POST['order_id'])))
$errorInvalidID=TRUE;
$query_email_address = trim($_POST['query_email_address']);
if(!isset($query_email_address) || zen_validate_email($query_email_address) == false)
$errorInvalidEmail=TRUE;
if(!$errorInvalidID && !$errorInvalidEmail)
{
$customer_info_query = "SELECT customers_email_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country,
billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country
FROM " . TABLE_ORDERS . "
WHERE orders_id = :ordersID";
$customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_POST['order_id'], 'integer');
$customer_info = $db->Execute($customer_info_query);
if (isset($query_email_address) && $customer_info->fields['customers_email_address'] != $query_email_address && $customer_info->fields['customers_email_address'] != $query_email_address . '.')
$errorNoMatch=TRUE;
else
{
$statuses_query = "SELECT os.orders_status_name, osh.date_added, osh.comments
FROM " . TABLE_ORDERS_STATUS . " os, " . TABLE_ORDERS_STATUS_HISTORY . " osh
WHERE osh.orders_id = :ordersID
AND osh.orders_status_id = os.orders_status_id
AND os.language_id = :languagesID
AND osh.customer_notified >= 0
ORDER BY osh.date_added";
$statuses_query = $db->bindVars($statuses_query, ':ordersID', $_POST['order_id'], 'integer');
$statuses_query = $db->bindVars($statuses_query, ':languagesID', $_SESSION['languages_id'], 'integer');
$statuses = $db->Execute($statuses_query);
while (!$statuses->EOF) {
$statusArray[] = array('date_added'=>$statuses->fields['date_added'],
'orders_status_name'=>$statuses->fields['orders_status_name'],
'comments'=>$statuses->fields['comments']);
$statuses->MoveNext();
}
require(DIR_WS_CLASSES . 'order.php');
$order = new order($_POST['order_id']);
}
}
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_ACCOUNT_HISTORY_INFO');
?>
Not sure why a portion of the code is/was written the way it was; however, may I suggest trying the below code in place of what is there? Have to test it though also. A major difference is that I added execution/generation of an order, though it will get populated with what is in the shopping cart if some of the entered data is incorrect. I don't know the impact of the $order variable being populated like that, though the notifier(s) being reused like they are is not a great idea, especially because of the condition it creates.
Code:
<?php
/**
*
* @package page
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: J_Schilz for Integrated COWOA - 14 April 2007 edited by mc12345678 2024-03-30
*/
// This should be first line of the script:
$zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_HISTORY_INFO');
$_SESSION['navigation']->set_snapshot();
// if logged in then go to account history
if (!empty($_SESSION['customer_id'])) {
zen_redirect(zen_href_link(FILENAME_ACCOUNT_HISTORY, 'action=returns_request', 'SSL'));
}
if (!isset($errorInvalidID)) {
$errorInvalidID = false;
}
if (!isset($errorInvalidEmail)) {
$errorInvalidEmail = false;
}
if (!isset($_POST['order_id']) || (isset($_POST['order_id']) && !is_numeric($_POST['order_id']))) {
$errorInvalidID=TRUE; // Really should initiate this; however, it may already have a value.
}
$query_email_address = isset($_POST['query_email_address']) ? trim($_POST['query_email_address']) : null;
if(!isset($query_email_address) || zen_validate_email($query_email_address) == false) {
$errorInvalidEmail=TRUE; // Really should initiate this; however, it may already have a value.
}
require_once(DIR_WS_CLASSES . 'order.php');
if (!isset($statusArray) || !is_array($statusArray)) {
$statusArray = array();
}
// No issues identified, continue processing
if(empty($errorInvalidID) && empty($errorInvalidEmail))
{
$customer_info_query = "SELECT customers_email_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country,
billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country
FROM " . TABLE_ORDERS . "
WHERE orders_id = :ordersID";
$customer_info_query = $db->bindVars($customer_info_query, ':ordersID', $_POST['order_id'], 'integer');
$customer_info = $db->Execute($customer_info_query, 1);
if (isset($query_email_address) && $customer_info->fields['customers_email_address'] != $query_email_address && $customer_info->fields['customers_email_address'] != $query_email_address . '.') {
$errorNoMatch=TRUE; // Really should initiate this; however, it may already have a value.
$order = new order();
} else
{
$statuses_query = "SELECT os.orders_status_name, osh.date_added, osh.comments
FROM " . TABLE_ORDERS_STATUS . " os
INNER JOIN " . TABLE_ORDERS_STATUS_HISTORY . " osh ON (osh.orders_status_id = os.orders_status_id)
WHERE osh.orders_id = :ordersID
AND os.language_id = :languagesID
AND osh.customer_notified >= 0
ORDER BY osh.date_added";
$statuses_query = $db->bindVars($statuses_query, ':ordersID', $_POST['order_id'], 'integer');
$statuses_query = $db->bindVars($statuses_query, ':languagesID', $_SESSION['languages_id'], 'integer');
$statuses = $db->Execute($statuses_query);
while (!$statuses->EOF) {
$statusArray[] = array(
'date_added'=>$statuses->fields['date_added'],
'orders_status_name'=>$statuses->fields['orders_status_name'],
'comments'=>$statuses->fields['comments'],
);
$statuses->MoveNext();
}
// require(DIR_WS_CLASSES . 'order.php');
$order = new order($_POST['order_id']);
}
} else {
$order = new order();
}
require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_ACCOUNT_HISTORY_INFO');
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
So does ZC2.0.0 have the stock by attribute built in, or is this still necessary? And will this work with 2.0.0?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
pegasuspublishing
So does ZC2.0.0 have the stock by attribute built in, or is this still necessary? And will this work with 2.0.0?
Not built in still based on the idea that not everyone needs our wants attribute stock control. Also I haven't tried it yet, but don't (yet) know of anything preventing its operation.
Reporting of one's own experience would help others/all.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Not built in still based on the idea that not everyone needs our wants attribute stock control. Also I haven't tried it yet, but don't (yet) know of anything preventing its operation.
Reporting of one's own experience would help others/all.
I'm going to guess not compatible with 2.0.0. Uploading files causes entire site to crash with 500 error. Both admin (so install script cannot be run) and storefront.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Not built in still based on the idea that not everyone needs our wants attribute stock control. Also I haven't tried it yet, but don't (yet) know of anything preventing its operation.
Reporting of one's own experience would help others/all.
So I'm guessing not compatible with 2.0.0. Copying files (prior to installation) results in 500 error taking both admin and storefront down.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
pegasuspublishing
So I'm guessing not compatible with 2.0.0. Copying files (prior to installation) results in 500 error taking both admin and storefront down.
Which files were loaded? Have a feeling that not the ones from github where would suggest using the 1.5.8 files etc for the version specific files.
Otherwise please provide error log info while obscuring admin directory information.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Which files were loaded? Have a feeling that not the ones from github where would suggest using the 1.5.8 files etc for the version specific files.
Otherwise please provide error log info while obscuring admin directory information.
FYI, I applied the functional changes of the github version for 1.5.8 against a new 2.0.0 system and other than the admin menus generating deprecation messages once per session, had no issue with installation. I didn't attempt full configuration, but that's to follow after incorporating the appropriate admin header calls in the admin screens.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Hi I am getting closer to launching this plugin on a live site and have been testing on a temporary url. My plan is to cross reference my QB data base w/ the SBA data base each day as products are replenished almost daily and sold daily. In addition to the existing products in the database, there will be new products added to the inventory that were not previously in the database. This requires a manual addition in ZC w/ attributes. I may be missing something and I apologize if I am. Is there a way to add products to the SBA database individually (sometimes there is only 1 brand new product added) without having to shuffle the entire sba database? For some reason, when I process the "Add product attributes that are NOT display-only", it duplicates all the pre-existing data within SBA forcing me to remove the data and re-add. Ideally, I would like to be able to add the one or two products to ZC then add just those products to the SBA data.
I am using 1.5.8a, Responsive template. url is pfcfurnitureindustries.com..... I apologize if this has been addressed, I struggled to find it by search in the thread search option. Thank you so much the plugin in great.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
chuckrey
Hi I am getting closer to launching this plugin on a live site and have been testing on a temporary url. My plan is to cross reference my QB data base w/ the SBA data base each day as products are replenished almost daily and sold daily. In addition to the existing products in the database, there will be new products added to the inventory that were not previously in the database. This requires a manual addition in ZC w/ attributes. I may be missing something and I apologize if I am. Is there a way to add products to the SBA database individually (sometimes there is only 1 brand new product added) without having to shuffle the entire sba database? For some reason, when I process the "Add product attributes that are NOT display-only", it duplicates all the pre-existing data within SBA forcing me to remove the data and re-add. Ideally, I would like to be able to add the one or two products to ZC then add just those products to the SBA data.
I am using 1.5.8a, Responsive template. url is pfcfurnitureindustries.com..... I apologize if this has been addressed, I struggled to find it by search in the thread search option. Thank you so much the plugin in great.
I have no recollection of quite a similar question being asked. Please allow me to try to describe what I understand so that can help identify one or more ways to address the issue(s).
A) Have an "established" store that is using SBA to track product that have attributes.
B) Have a method of adding product to the store.
C) The method to add product to the store occasionally includes product that have attributes.
D) The method of adding product with attributes to the store includes product not previously tracked by SBA.
E) Want to be able to address new product with attributes by making it accessible to SBA for stock control of attribute related product.
So far so good?
Then, a few things come to mind as questions:
1) Does the addition of product with attributes include product already assigned to SBA and have you worked through the associated stock management? (Either adding the quantity to be addressed or make the available quantity whatever is being imported?)
2) Do product transition from having attributes to not having attributes? (This is like deleting the attribute(s) from a specific product. I'm not necessarily referring to the addition of product that do not have attributes, though there may be an offshoot from that discussion/answer.)
3) Does the addition of product with attributes necessarily generate a new attribute off of an existing product already tracked by SBA? (E.g., Large colored shirts now have a newly available color.)
4) How many user selectable attributes (option names) are to be assigned to a product? (E.g. T-shirt of a given (fixed) size with (selectable) colors [One option name: color] or perhaps T-shirt of multiple (selectable) sizes available in multiple (selectable) colors [two option names: size and color]).
As to the query that was executed in the SBA Configuration area ("Add product attributes that are NOT display-only"). That (and other) queries were written with a specific task in mind and were generally hard coded for consideration against the entire database. BUT... I have heard of others adding their own set of queries or as originally developed/commented by Pottery House, to modify them to perform a desired operation.
I would generally discourage revising the existing functionality and instead add one or more new options to accomplish the task. At least in this way existing functionality would remain as seen necessary to perform and updates would be "easier". If you do go with the addition of one or more new queries, post either here or in github, notifiers could be added into the code to better support such modification and support removing your changes from the plugin's code.
So, yes, though I have not today reviewed the operation of the "Add product attributes that are NOT display-only" selection, it does not surprise me that the result is duplication of existing SBA variants, mostly because the statement doesn't say: "Add new product attributes that are NOT display-only" or "Add product attributes that are NOT display-only AND do NOT exist" or some variation of a similar statement. Basically, what that feature does is go through all product, if the product has attributes and the attributes are not display-only, then that combination is added. Again, as I recall there is no comparison/evaluation against the existing SBA variants.
Further, as to more "user" controlled addition of variants, unfortunately, I haven't created an alternate "external" method I trust to be consistently properly executed. I say that because as more functionality/features are available, database integrity becomes ever more important and dependent on proper configuration of the input file/correlation that can easily be corrupted by user input. Import of incorrectly typed text could cause generation of data across multiple tables, potentially requiring significant rework/revision to correct all of the involved tables (Product options, product options values, product option values to product options, products attributes, SBA variant table to name a few). Basically, there's so many potential problems that I have only approached that operation on a case-by-case basis with each being very unique and specific. The above original question, to me, seems manageable depending on answers to the questions.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
I have no recollection of quite a similar question being asked. Please allow me to try to describe what I understand so that can help identify one or more ways to address the issue(s).
A) Have an "established" store that is using SBA to track product that have attributes.
B) Have a method of adding product to the store.
C) The method to add product to the store occasionally includes product that have attributes.
D) The method of adding product with attributes to the store includes product not previously tracked by SBA.
E) Want to be able to address new product with attributes by making it accessible to SBA for stock control of attribute related product.
So far so good?
Then, a few things come to mind as questions:
1) Does the addition of product with attributes include product already assigned to SBA and have you worked through the associated stock management? (Either adding the quantity to be addressed or make the available quantity whatever is being imported?)
2) Do product transition from having attributes to not having attributes? (This is like deleting the attribute(s) from a specific product. I'm not necessarily referring to the addition of product that do not have attributes, though there may be an offshoot from that discussion/answer.)
3) Does the addition of product with attributes necessarily generate a new attribute off of an existing product already tracked by SBA? (E.g., Large colored shirts now have a newly available color.)
4) How many user selectable attributes (option names) are to be assigned to a product? (E.g. T-shirt of a given (fixed) size with (selectable) colors [One option name: color] or perhaps T-shirt of multiple (selectable) sizes available in multiple (selectable) colors [two option names: size and color]).
As to the query that was executed in the SBA Configuration area ("Add product attributes that are NOT display-only"). That (and other) queries were written with a specific task in mind and were generally hard coded for consideration against the entire database. BUT... I have heard of others adding their own set of queries or as originally developed/commented by Pottery House, to modify them to perform a desired operation.
I would generally discourage revising the existing functionality and instead add one or more new options to accomplish the task. At least in this way existing functionality would remain as seen necessary to perform and updates would be "easier". If you do go with the addition of one or more new queries, post either here or in github, notifiers could be added into the code to better support such modification and support removing your changes from the plugin's code.
So, yes, though I have not today reviewed the operation of the "Add product attributes that are NOT display-only" selection, it does not surprise me that the result is duplication of existing SBA variants, mostly because the statement doesn't say: "Add new product attributes that are NOT display-only" or "Add product attributes that are NOT display-only AND do NOT exist" or some variation of a similar statement. Basically, what that feature does is go through all product, if the product has attributes and the attributes are not display-only, then that combination is added. Again, as I recall there is no comparison/evaluation against the existing SBA variants.
Further, as to more "user" controlled addition of variants, unfortunately, I haven't created an alternate "external" method I trust to be consistently properly executed. I say that because as more functionality/features are available, database integrity becomes ever more important and dependent on proper configuration of the input file/correlation that can easily be corrupted by user input. Import of incorrectly typed text could cause generation of data across multiple tables, potentially requiring significant rework/revision to correct all of the involved tables (Product options, product options values, product option values to product options, products attributes, SBA variant table to name a few). Basically, there's so many potential problems that I have only approached that operation on a case-by-case basis with each being very unique and specific. The above original question, to me, seems manageable depending on answers to the questions.
Thanks very much for your response....
With respect to A thru E. I enter all products as attributes specifically to track inventory. I do this because I want to streamline the process of updating inventory daily via EP (SBA Detailed). Any new products added never have SBA previously associated with them as they are a new product with new attributes that did not previously exist on the website. This brings me to the challenge of needing to associate the new product with SBA. Currently I am finding that I need to use the function "Remove all entries from the PAS Table" (to avoid the duplication of SBA entries) then use the "Add product attributes that are NOT display-only" to re-associate all attributes w/ SBA (including the brand new product(s) added). Once re-associated, I then need to reprocess the EP SBA Detailed to re-add the custom ID's and inventory counts. Once that is done, I will then add the custom ID and inventory for the newly added product(s).
I guess what I was looking for or hoping I missed it somewhere was the ability to skip removal of the PAS table function and simply associate the newly added product(s) that include attributes with SBA alone without having to take down all and then rebuild.
I use the display only function for a drop down statement that says "View Options" w/ the drop down function (there are actually customers who don't know to click on the drop down). I also use the display only for a group price as the group price is not tracked as inventory but displays the price if they want to purchase as a group. In my case they are purchasing sofa and loveseat or dining groups. If a customer wants to purchase the sofa only, they can, but most customers want to purchase both sofa and loveseat, therefore the group price is displayed.
I hope this makes sense and thank you so much for your response and attention, I really like the plugin and it's exactly what I need for this website.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
chuckrey
Thanks very much for your response....
With respect to A thru E. I enter all products as attributes specifically to track inventory. I do this because I want to streamline the process of updating inventory daily via EP (SBA Detailed). Any new products added never have SBA previously associated with them as they are a new product with new attributes that did not previously exist on the website. This brings me to the challenge of needing to associate the new product with SBA. Currently I am finding that I need to use the function "Remove all entries from the PAS Table" (to avoid the duplication of SBA entries) then use the "Add product attributes that are NOT display-only" to re-associate all attributes w/ SBA (including the brand new product(s) added). Once re-associated, I then need to reprocess the EP SBA Detailed to re-add the custom ID's and inventory counts. Once that is done, I will then add the custom ID and inventory for the newly added product(s).
I guess what I was looking for or hoping I missed it somewhere was the ability to skip removal of the PAS table function and simply associate the newly added product(s) that include attributes with SBA alone without having to take down all and then rebuild.
I use the display only function for a drop down statement that says "View Options" w/ the drop down function (there are actually customers who don't know to click on the drop down). I also use the display only for a group price as the group price is not tracked as inventory but displays the price if they want to purchase as a group. In my case they are purchasing sofa and loveseat or dining groups. If a customer wants to purchase the sofa only, they can, but most customers want to purchase both sofa and loveseat, therefore the group price is displayed.
I hope this makes sense and thank you so much for your response and attention, I really like the plugin and it's exactly what I need for this website.
Ok, so hopefully this wasn't a waste of time. I specifically asked 5 questions to be able to understand if what I (have/was going) produced would meet your needs. I'm sure it will help someone, but the goal is/was to address your specific issue.
I have created a query that works similar to the existing "Add product attributes that are NOT display-only", except instead of adding "ALL" such product attributes, it only adds those that are not already captured in your database.
WARNING!!!!!!!!! USER BEWARE!!!!!!!
For those that use combinations of attributes (two or more option names for a single product where stock depends on selecting a combination of the option values).....
Tracking both attribute combinations and individual attributes on a given product will generally result in undesirable operations/capabilities... If you really want your store to work that way, please feel free; however, the majority of users will either want attribute combinations on a product or single attribute value selections even if across multiple option names....
You can incorporate this query/code by incorporating the following github commit:
Adds all new product/attribute pairs for single attribute not yet in SBA · mc12345678/Stock_By_Attributes_Combined@f068c27 (github.com)
https://github.com/mc12345678/Stock_...80d61301e14600
Unfortunately, I didn't yet determine a good notifier to be able to further incorporate similar code, but also see I have some other changes to incorporate but haven't yet...
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Ok, so hopefully this wasn't a waste of time. I specifically asked 5 questions to be able to understand if what I (have/was going) produced would meet your needs. I'm sure it will help someone, but the goal is/was to address your specific issue.
I have created a query that works similar to the existing "Add product attributes that are NOT display-only", except instead of adding "ALL" such product attributes, it only adds those that are not already captured in your database.
WARNING!!!!!!!!! USER BEWARE!!!!!!!
For those that use combinations of attributes (two or more option names for a single product where stock depends on selecting a combination of the option values).....
Tracking both attribute combinations and individual attributes on a given product will generally result in undesirable operations/capabilities... If you really want your store to work that way, please feel free; however, the majority of users will either want attribute combinations on a product or single attribute value selections even if across multiple option names....
You can incorporate this query/code by incorporating the following github commit:
Adds all new product/attribute pairs for single attribute not yet in SBA · mc12345678/Stock_By_Attributes_Combined@f068c27 (github.com)
https://github.com/mc12345678/Stock_...80d61301e14600
Unfortunately, I didn't yet determine a good notifier to be able to further incorporate similar code, but also see I have some other changes to incorporate but haven't yet...
I will give the query/code a run and see how it works out and report it back.
I will address your questions individually as originally asked for the benefit of others..
A) Have an "established" store that is using SBA to track product that have attributes. - There is an existing store that is established on the live url (pfcind.com), however I am using an temporary url (pfcfurnitureindustries.com) to incorporate SBA. Once testing and implementation is complete the migration will move forward.
B) Have a method of adding product to the store. - Yes, my method of adding products to the store is via Easy Populate when I have several. Otherwise, I will use the built in Categories/Products route to add products.
C) The method to add product to the store occasionally includes product that have attributes. - The method I am using will always include attributes even when there is only 1 product. We receive many calls to question inventory and to have the inventory count via the same process of going to the attributes will be less confusing for customers and sales staff.
D) The method of adding product with attributes to the store includes product not previously tracked by SBA. - Yes, every product added will be new and therefore is not yet being tracked via SBA
E) Want to be able to address new product with attributes by making it accessible to SBA for stock control of attribute related product. - Yes, this is the end goal. I want to be able to track every product and every attribute via SBA tracking.
Thank you very much
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Ok, so hopefully this wasn't a waste of time. I specifically asked 5 questions to be able to understand if what I (have/was going) produced would meet your needs. I'm sure it will help someone, but the goal is/was to address your specific issue.
I have created a query that works similar to the existing "Add product attributes that are NOT display-only", except instead of adding "ALL" such product attributes, it only adds those that are not already captured in your database.
WARNING!!!!!!!!! USER BEWARE!!!!!!!
For those that use combinations of attributes (two or more option names for a single product where stock depends on selecting a combination of the option values).....
Tracking both attribute combinations and individual attributes on a given product will generally result in undesirable operations/capabilities... If you really want your store to work that way, please feel free; however, the majority of users will either want attribute combinations on a product or single attribute value selections even if across multiple option names....
You can incorporate this query/code by incorporating the following github commit:
Adds all new product/attribute pairs for single attribute not yet in SBA · mc12345678/Stock_By_Attributes_Combined@f068c27 (github.com)
https://github.com/mc12345678/Stock_...80d61301e14600
Unfortunately, I didn't yet determine a good notifier to be able to further incorporate similar code, but also see I have some other changes to incorporate but haven't yet...
Update:
I added the query to the install file but ran into a couple of issues. I checked the error log and found the following:
[22-May-2024 10:59:54 UTC] Request URI: /index.php?main_page=product_info&cPath=189_191&products_id=2750, IP address: xxx.xx.xxx.xx, Language id 1
#1 products_with_attributes_stock->updateNotifyAttributesModuleStartOptionsLoop() called at [/home/xxxxxxxx/public_html/includes/classes/traits/NotifierManager.php:87]
#2 base->notify() called at [/home/xxxxxxxx/public_html/includes/modules/attributes.php:148]
#3 require(/home/mypfctim/public_html/includes/modules/attributes.php) called at [/home/xxxxxxxx/public_html/includes/modules/pages/product_info/main_template_vars.php:50]
#4 require(/home/xxxxxxxx/public_html/includes/modules/pages/product_info/main_template_vars.php) called at [/home/xxxxxxxx/public_html/includes/templates/responsive_classic/common/tpl_main_page.php:178]
#5 require(/home/xxxxxxxx/public_html/includes/templates/responsive_classic/common/tpl_main_page.php) called at [/home/xxxxxxxx/public_html/index.php:94]
--> PHP Warning: Use of undefined constant PRODUCTS_OPTIONS_TYPE_SELECT_SBA - assumed 'PRODUCTS_OPTIONS_TYPE_SELECT_SBA' (this will throw an Error in a future version of PHP) in /home/xxxxxxxx/public_html/includes/classes/observers/class.products_with_attributes_stock.php on line 689.
I did receive syntax error warnings at the following lines:
@@ -2723,6 +2823,7 @@ function displayOptionalSQL(){
<option value="runOptionalSQL4" title="Only add the product attributes that are NOT display-only">Add product attributes that are NOT display-only</option>
<option value="runOptionalSQL5" title="Remove the product attributes that are ONLY read-only">Remove product attributes that are ONLY read-only</option>
<option value="runOptionalSQL6" title="Ensure availability and operation of PRODUCTS_OPTIONS_TYPE_SELECT, UPLOAD_PREFIX, and TEXT_PREFIX or if dropdowns do not appear">Restore visibility of Dropdowns</option>
<option value="runOptionalSQL7" title="Add ALL new single attribute NOT display only product to SBA table">Add ALL new product attributes that are NOT display only</option>
<option value="updatePASfieldPAC" title="Update Unique Combo field">Update Unique Combo field</option>
<option value="truncatePAStable" title="WARNING: This will COMPLETLY EMPTY the Product with Attribute Stock Table!">Remove ALL entries from the PAS Table</option>
@@ -2838,6 +2939,11 @@ function displayOptionalSQL(){
verifyProductOptionsTypes();
case 'runOptionalSQL7';
case 'runOptionalAllToSBA';
I also noticed the following has a colon instead of a semi-colon and am not sure if that was intentional
case 'runOptionalAllToSBA':
case 'runOptionalSQL7':
Again, I really appreciate your help and time.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
So I found out a way to add attributes to the SBA data by utilizing the "Add Quantity for product variant" If I enter a number in the quantity for all it will add the attributes for me. I had not noticed that link before and after trying a couple of options it worked. I think this will work just fine for my purpose.
@MC12345678. Can you please send me a link where I can buy you a coffee or lunch for your efforts? Thank you..
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
chuckrey
Update:
I added the query to the install file but ran into a couple of issues. I checked the error log and found the following:
[22-May-2024 10:59:54 UTC] Request URI: /index.php?main_page=product_info&cPath=189_191&products_id=2750, IP address: xxx.xx.xxx.xx, Language id 1
#1 products_with_attributes_stock->updateNotifyAttributesModuleStartOptionsLoop() called at [/home/xxxxxxxx/public_html/includes/classes/traits/NotifierManager.php:87]
#2 base->notify() called at [/home/xxxxxxxx/public_html/includes/modules/attributes.php:148]
#3 require(/home/mypfctim/public_html/includes/modules/attributes.php) called at [/home/xxxxxxxx/public_html/includes/modules/pages/product_info/main_template_vars.php:50]
#4 require(/home/xxxxxxxx/public_html/includes/modules/pages/product_info/main_template_vars.php) called at [/home/xxxxxxxx/public_html/includes/templates/responsive_classic/common/tpl_main_page.php:178]
#5 require(/home/xxxxxxxx/public_html/includes/templates/responsive_classic/common/tpl_main_page.php) called at [/home/xxxxxxxx/public_html/index.php:94]
--> PHP Warning: Use of undefined constant PRODUCTS_OPTIONS_TYPE_SELECT_SBA - assumed 'PRODUCTS_OPTIONS_TYPE_SELECT_SBA' (this will throw an Error in a future version of PHP) in /home/xxxxxxxx/public_html/includes/classes/observers/class.products_with_attributes_stock.php on line 689.
I did receive syntax error warnings at the following lines:
@@ -2723,6 +2823,7 @@ function displayOptionalSQL(){
<option value="runOptionalSQL4" title="Only add the product attributes that are NOT display-only">Add product attributes that are NOT display-only</option>
<option value="runOptionalSQL5" title="Remove the product attributes that are ONLY read-only">Remove product attributes that are ONLY read-only</option>
<option value="runOptionalSQL6" title="Ensure availability and operation of PRODUCTS_OPTIONS_TYPE_SELECT, UPLOAD_PREFIX, and TEXT_PREFIX or if dropdowns do not appear">Restore visibility of Dropdowns</option>
<option value="runOptionalSQL7" title="Add ALL new single attribute NOT display only product to SBA table">Add ALL new product attributes that are NOT display only</option>
<option value="updatePASfieldPAC" title="Update Unique Combo field">Update Unique Combo field</option>
<option value="truncatePAStable" title="WARNING: This will COMPLETLY EMPTY the Product with Attribute Stock Table!">Remove ALL entries from the PAS Table</option>
@@ -2838,6 +2939,11 @@ function displayOptionalSQL(){
verifyProductOptionsTypes();
case 'runOptionalSQL7';
case 'runOptionalAllToSBA';
I also noticed the following has a colon instead of a semi-colon and am not sure if that was intentional
case 'runOptionalAllToSBA':
case 'runOptionalSQL7':
Again, I really appreciate your help and time.
So, I went back to review the modification I applied. There was an issue with the query I created, it had an extra semi-colon from when I copied and pasted it from within phpMyAdmin.
The issues about the missing constant, well that is something that would be seen with the code in place, visitors navigating the site until the database install was completed. I've made generated a change to the code to prevent logging that issue; however, in a way the fix is unnecessary once the appropriate constant has been set either in a file or the database.
But, the other above issues? I have no idea how the other issues exist in your file. I do not see github history of the problem content like:
1) I don't see what the issue is with the option list, the three options appear to have the same format with just differences in associated/necessary data. So i'm not sure what issue is/was created there.
2) semi-colons as a part of case statements, these specifically are supposed to be colons, there is nothing that I found having semi-colons in that spot.
I have created and force pushed an update for the original issue for the query to do what was requested: Adds all new product/attribute pairs for single attribute not yet in SBA · mc12345678/Stock_By_Attributes_Combined@064350f (github.com)
https://github.com/mc12345678/Stock_...326c26a8192f01
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
I have just uploaded on a squeaky clean install of V2.0.1 and while there were no error during installation I do get an error when clicking on the All Attribute Stock link.
I am assuming this is the link used access the SBA functions/features.
The link launches a new browser tab as indicated and displays the following error message on the new page "WARNING: An Error occurred, please let us know! If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you entered valid data."
[31-May-2024 01:53:24 ------] Request URI: /********/index.php?cmd=products_with_attributes_stock, IP address: *******, Language id 1
#0 [internal function]: zen_debug_error_handler()
#1 /*****/includes/classes/db/mysql/query_factory.php(714): trigger_error()
#2 /*****/includes/classes/db/mysql/query_factory.php(659): queryFactory->show_error()
#3 /*****/includes/classes/db/mysql/query_factory.php(299): queryFactory->set_error()
#4 /*****/products_with_attributes_stock.php(912): queryFactory->Execute()
#5 /*****/index.php(16): require('/******* ..')
--> PHP Fatal error: MySQL error 1146: Table '******.products_with_attributes_stock' doesn't exist :: SELECT DISTINCT pwas.products_id FROM products_with_attributes_stock pwas
LEFT JOIN (SELECT DISTINCT
pa.products_id, pd.products_name
FROM products_attributes pa
LEFT JOIN products_description pd ON (pa.products_id = pd.products_id)
WHERE pd.language_id= 1
ORDER BY pd.products_name) att ON (att.products_id = pwas.products_id)
WHERE
att.products_id IS NULL ==> (as called by) /**********/products_with_attributes_stock.php on line 912 <== in /*******/includes/classes/db/mysql/query_factory.php on line 714.
--> PHP Fatal error: MySQL error 1146: Table '*******.products_with_attributes_stock' doesn't exist :: SELECT DISTINCT pwas.products_id FROM products_with_attributes_stock pwas
LEFT JOIN (SELECT DISTINCT
pa.products_id, pd.products_name
FROM products_attributes pa
LEFT JOIN products_description pd ON (pa.products_id = pd.products_id)
WHERE pd.language_id= 1
ORDER BY pd.products_name) att ON (att.products_id = pwas.products_id)
WHERE
att.products_id IS NULL ==> (as called by) *******/products_with_attributes_stock.php on line 912 <== in /******/includes/classes/db/mysql/query_factory.php on line 714.
(Directories and original ZC DB tables are correct but have been ****** out.)
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Issue resolved: SBA links and screens were added once I manually ran the SBA install script from the browser address bar. Sorry to be a bother. :)
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
webmanstudios
Issue resolved: SBA links and screens were added once I manually ran the SBA install script from the browser address bar. Sorry to be a bother. :)
No problem at all. Would help if I had a central set of instructions to at least get through the start of things. Glad you worked it out though. While the time between posts was only 15 minutes, I hope you didn't lose too much up to that point.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Has anyone had any luck with styling the drop down "Qty" and "Custom Id's"? Been searching w/ no luck. Using 1.5.8 Responsive Classic.
Thanks all.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
chuckrey
Has anyone had any luck with styling the drop down "Qty" and "Custom Id's"? Been searching w/ no luck. Using 1.5.8 Responsive Classic.
Thanks all.
Referring to changing the look of the catalog side drop-down for qty, or some sort of admin side modification?
What is the desired modification or issue attempting to address?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
I would like to bold the Qty with the count and/or change it's color to make it stand out a bit more. I am near completion and asked for some input from the users in the office and this was something that came up. You can view it at pfcfurnitureindustries.com If that isn't possible, I was thinking of removing the custom id from displaying so there is less information on that line. Thanks for your response.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
chuckrey
I would like to bold the Qty with the count and/or change it's color to make it stand out a bit more. I am near completion and asked for some input from the users in the office and this was something that came up. You can view it at pfcfurnitureindustries.com If that isn't possible, I was thinking of removing the custom id from displaying so there is less information on that line. Thanks for your response.
The dropdown is not a jQuery/javascript driven item. It is a standard option type list which means that there is little to no html modifications possible.
The custom_id was chosen to be attached to that area; however, can be modified/reworked to act/respond/report differently or elsewhere. But, alas, bolding parts, alternate coloring, etc within the dropdown list would require implementing some other dropdown list "tool". I've been wanting to do so, but haven't made the time. I believe it will require a complete rework of the product attributes display code or at least the final output. Currently it is more of a create for the output instead of a create for posing to an html tag. (E.g. not as javascript like as it should be).
Good that the team had some ideas, unfortunately, not easily implemented as requested. I suggest at least capturing the information that is made available, whether it is by alternate javascript output or page location. But basically, by incorporating the data where I did allowed reducing the overall file edits and ways for things to possibly go wrong. :)
Apologize for the delay in response, been busy.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
The dropdown is not a jQuery/javascript driven item. It is a standard option type list which means that there is little to no html modifications possible.
The custom_id was chosen to be attached to that area; however, can be modified/reworked to act/respond/report differently or elsewhere. But, alas, bolding parts, alternate coloring, etc within the dropdown list would require implementing some other dropdown list "tool". I've been wanting to do so, but haven't made the time. I believe it will require a complete rework of the product attributes display code or at least the final output. Currently it is more of a create for the output instead of a create for posing to an html tag. (E.g. not as javascript like as it should be).
Good that the team had some ideas, unfortunately, not easily implemented as requested. I suggest at least capturing the information that is made available, whether it is by alternate javascript output or page location. But basically, by incorporating the data where I did allowed reducing the overall file edits and ways for things to possibly go wrong. :)
Apologize for the delay in response, been busy.
Makes total sense. I understand and I think the way it currently sits will work as needed. Thanks very much for your response.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Question asked elsewhere relates to adding other SBA created fields to product searches. For example, there is a description field added to the admin area and the user would like to have that content searchable.
A while back a new auto loading observer class was added to the catalog side to support searching the custom ID. This can be further modified to include other SBA/PWAS fields.
The file in question is: includes/classes/observers/auto.advanced_search_categories_custom_id.php
A duplicate file name could possibly be created for the additional content but also the file name could be changed. Really would suggest making good notes in the file.
Anyways, around line 166, there is/ was this code:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
WHERE customid LIKE '%:keywords%')";
The permalink was: https://github.com/mc12345678/Stock_....php#L166-L169
Anyway, that snippet specifically retrieves product ids that have a custom ID containing or like the keywords searched.
Data in the SBA/PWAS table can be added to that parenthetical group for searching. I would suggest though adding an alias to the table to prevent potential version differences from bringing out some sort of conflict.
So first would change that to:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE pwas.customid LIKE '%:keywords%')";
Then to aid in expansion I would break some of the content so that endings are on their own line. This way, new code is both easier to add and easier to find when added.
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE
pwas.customid LIKE '%:keywords%'
)
";
And then add the requested information:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE
pwas.customid LIKE '%:keywords%'
OR pwas.title LIKE '%:keywords%'
)
";
I note that while in the admin screen the column is shown as a description, the database field name was title and also that the base installation supports basically 100 characters.
I'm also aware others have added fields to that table in support of whatever additional features they've added. I would expect a similar error to include those additional fields in the search.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
Question asked elsewhere relates to adding other SBA created fields to product searches. For example, there is a description field added to the admin area and the user would like to have that content searchable.
A while back a new auto loading observer class was added to the catalog side to support searching the custom ID. This can be further modified to include other SBA/PWAS fields.
The file in question is: includes/classes/observers/auto.advanced_search_categories_custom_id.php
A duplicate file name could possibly be created for the additional content but also the file name could be changed. Really would suggest making good notes in the file.
Anyways, around line 166, there is/ was this code:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
WHERE customid LIKE '%:keywords%')";
The permalink was:
https://github.com/mc12345678/Stock_....php#L166-L169
Anyway, that snippet specifically retrieves product ids that have a custom ID containing or like the keywords searched.
Data in the SBA/PWAS table can be added to that parenthetical group for searching. I would suggest though adding an alias to the table to prevent potential version differences from bringing out some sort of conflict.
So first would change that to:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE pwas.customid LIKE '%:keywords%')";
Then to aid in expansion I would break some of the content so that endings are on their own line. This way, new code is both easier to add and easier to find when added.
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE
pwas.customid LIKE '%:keywords%'
)
";
And then add the requested information:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE
pwas.customid LIKE '%:keywords%'
OR pwas.title LIKE '%:keywords%'
)
";
I note that while in the admin screen the column is shown as a description, the database field name was title and also that the base installation supports basically 100 characters.
I'm also aware others have added fields to that table in support of whatever additional features they've added. I would expect a similar error to include those additional fields in the search.
Are the code changes that you recommend required to get the search to work?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
jodean
Are the code changes that you recommend required to get the search to work?
To use/reuse the existing code intended to offer search of SBA data, yes at least the last change was needed. The operation can be accomplished any number of other ways and may depend on other installed software.
The above fix or addition adds the search capability that was requested in another separate thread of wanting to search the SBA description.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
So, I went back to review the modification I applied. There was an issue with the query I created, it had an extra semi-colon from when I copied and pasted it from within phpMyAdmin.
The issues about the missing constant, well that is something that would be seen with the code in place, visitors navigating the site until the database install was completed. I've made generated a change to the code to prevent logging that issue; however, in a way the fix is unnecessary once the appropriate constant has been set either in a file or the database.
But, the other above issues? I have no idea how the other issues exist in your file. I do not see github history of the problem content like:
1) I don't see what the issue is with the option list, the three options appear to have the same format with just differences in associated/necessary data. So i'm not sure what issue is/was created there.
2) semi-colons as a part of case statements, these specifically are supposed to be colons, there is nothing that I found having semi-colons in that spot.
I have created and force pushed an update for the original issue for the query to do what was requested:
Adds all new product/attribute pairs for single attribute not yet in SBA · mc12345678/Stock_By_Attributes_Combined@064350f (github.com)
https://github.com/mc12345678/Stock_...326c26a8192f01
I am reaching out because I thought this error (missing constant) was resolved, but it is still arriving. I am not clear on specifically what I need to do when you say "once the appropriate constant has been set either in a file or the database". Can you please advise what I need to do to resolve? I saw the updated install file and updated, but am not sure if that is all that needed to be done to resolve the missing constant. Thank you so much.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
chuckrey
I am reaching out because I thought this error (missing constant) was resolved, but it is still arriving. I am not clear on specifically what I need to do when you say "once the appropriate constant has been set either in a file or the database". Can you please advise what I need to do to resolve? I saw the updated install file and updated, but am not sure if that is all that needed to be done to resolve the missing constant. Thank you so much.
No problem.
The issue of the missing constant is expected to be non-existent upon installation of the software in an operational state. The purest state would be to:
1. have a base Zen Cart package,
2. load the SBA files from github merging the template changes as necessary for that additional template functionality
3. log into your admin
4. change the url path to access: stock_by_attr_install.php.
For ZC 1.5.8, that would be like: mydomain/MYADMIN/index.php?cmd=stock_by_attr_install
The installation file can also be executed by mydomain/MYADMIN/stock_by_attr_install.php
5. Once see the generated window (in ZC 2.X may also have a message across the header and a debug log generated indicating an issue with the header), in the dropdown at the top of the screen select: Full/Upgrade DB Install
6. press the button to run the script.
This will add/create the constant that is missing (PRODUCTS_OPTIONS_TYPE_SELECT_SBA).
If there are other files laying around in the installation then those may be the one(s) generating the logs.
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
mc12345678
No problem.
The issue of the missing constant is expected to be non-existent upon installation of the software in an operational state. The purest state would be to:
1. have a base Zen Cart package,
2. load the SBA files from github merging the template changes as necessary for that additional template functionality
3. log into your admin
4. change the url path to access: stock_by_attr_install.php.
For ZC 1.5.8, that would be like: mydomain/MYADMIN/index.php?cmd=stock_by_attr_install
The installation file can also be executed by mydomain/MYADMIN/stock_by_attr_install.php
5. Once see the generated window (in ZC 2.X may also have a message across the header and a debug log generated indicating an issue with the header), in the dropdown at the top of the screen select: Full/Upgrade DB Install
6. press the button to run the script.
This will add/create the constant that is missing (PRODUCTS_OPTIONS_TYPE_SELECT_SBA).
If there are other files laying around in the installation then those may be the one(s) generating the logs.
Ah, okay. I missed the last and most important step. Just completed. Thanks yet again!
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
What are the table names that are created for this plugin?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5+
Is there any way to thoroughly uninstall this module?
-
Re: Stock by Attribute v4.0 for Zen Cart 1.3.5
Quote:
Originally Posted by
jodean
What are the table names that are created for this plugin?
They are listed in each of includes/extra_datafiles/products_with_attributes_stock_database_tables.php and admin/includes/extra_datafiles/products_with_attributes_stock.php
As being:
Code:
define('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK', DB_PREFIX . 'products_with_attributes_stock');
define('TABLE_ORDERS_PRODUCTS_ATTRIBUTES_STOCK', DB_PREFIX . 'orders_products_attributes_stock');
define('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK_ATTRIBUTES_NON_STOCK', DB_PREFIX . 'products_with_attributes_stock_attributes_non_stock');
The value of DB_PREFIX is identified in your applicable configure.php file.
The information on the right side of each above define makes up the table name. So, if your DB_PREFIX is zen_, then the first table would be zen_products_with_attributes_stock.
Those tables are created through the admin file: stock_by_attr_install.php
There are or might be other tables that are touched. Since the reason for asking hasn't been identified I haven't gone to find which are so touched and further not making assumptions about the intent. I expect that the script to install or remove would do or undo whatever issue is at hand.