Forums / All Other Contributions/Addons / Stock by Attribute v4.0 addon for v1.3.5-1.3.9

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

Views: 660,384

Results 3,521 to 3,540 of 3,609
10 Jun 2023, 12:28 AM
#3521
mc12345678 avatar

mc12345678

Totally Zenned

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

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

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

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

11 Jun 2023, 8:38 PM
#3522
chuckrey avatar

chuckrey

Zen Follower

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

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

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.

12 Jun 2023, 12:57 AM
#3523
mc12345678 avatar

mc12345678

Totally Zenned

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

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

chuckrey:

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.

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

12 Jun 2023, 2:53 PM
#3524
chuckrey avatar

chuckrey

Zen Follower

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

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

mc12345678:

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.

14 Jun 2023, 3:02 PM
#3525
chuckrey avatar

chuckrey

Zen Follower

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

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

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!

14 Jun 2023, 6:19 PM
#3526
mc12345678 avatar

mc12345678

Totally Zenned

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

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

chuckrey:

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...

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

14 Jun 2023, 6:43 PM
#3527
chuckrey avatar

chuckrey

Zen Follower

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

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

mc12345678:

So 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?

14 Jun 2023, 6:47 PM
#3528
chuckrey avatar

chuckrey

Zen Follower

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

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

chuckrey:

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.

15 Jun 2023, 7:25 PM
#3529
chuckrey avatar

chuckrey

Zen Follower

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

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

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.....

16 Jun 2023, 3:02 AM
#3530
mc12345678 avatar

mc12345678

Totally Zenned

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

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

chuckrey:

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).

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

16 Jun 2023, 3:36 AM
#3531
chuckrey avatar

chuckrey

Zen Follower

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

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

mc12345678:

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.

22 Jul 2023, 11:41 PM
#3532
jodean avatar

jodean

Totally Zenned

Join Date:
May 2011
Location:
Tennessee
Posts:
511
Plugin Contributions:
0

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

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.

23 Jul 2023, 12:38 AM
#3533
mc12345678 avatar

mc12345678

Totally Zenned

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

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

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:

          if ($fieldsKey !== false) {

To:

          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.

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

24 Jul 2023, 12:21 PM
#3534
jodean avatar

jodean

Totally Zenned

Join Date:
May 2011
Location:
Tennessee
Posts:
511
Plugin Contributions:
0

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

*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.

24 Jul 2023, 1:53 PM
#3535
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

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

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:

      if ($fieldsKey !== false) {
> To: 
> ```
          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:

//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.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

24 Jul 2023, 4:31 PM
#3536
jodean avatar

jodean

Totally Zenned

Join Date:
May 2011
Location:
Tennessee
Posts:
511
Plugin Contributions:
0

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

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:

//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.
24 Jul 2023, 6:10 PM
#3537
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,967
Plugin Contributions:
8

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

jodean:

Your method solved the bug.

:thumbsup:

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

24 Jul 2023, 10:33 PM
#3538
mc12345678 avatar

mc12345678

Totally Zenned

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

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

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.

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

14 Aug 2023, 7:14 PM
#3539
lsde avatar

lsde

New Zenner

Join Date:
Jul 2014
Location:
Delaware USA
Posts:
26
Plugin Contributions:
0

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

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

29 Aug 2023, 5:06 AM
#3540
gemohler avatar

gemohler

Zen Follower

Join Date:
Jul 2005
Location:
CA
Posts:
223
Plugin Contributions:
0

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

Last question, then I have a lot of other work to do.

How do I set "No, Do not show Quantity Box" in EP?