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

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

Views: 658,583

Results 1,661 to 1,680 of 3,609
15 Aug 2013, 1:29 PM
#1661
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

maishane:

Now I try to install the 1.4.14 ver of mod to Zen 1.3.9.h (Not the test site), I overwrite all files and execute the sql file but get this error:

1062 Duplicate entry 'STOCK_SHOW_LOW_IN_CART' for key 'unq_config_key_zen'
in:
[INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Show available stock level in cart when less than order', 'STOCK_SHOW_LOW_IN_CART', 'false', 'When customer places more items in cart than are available, show the available amount on the shopping cart page:', '9', '6', NULL, now(), NULL, "zen_cfg_select_option(array('true', 'false')," ), ('Display Images in Admin', 'STOCK_SHOW_IMAGE', 'false', 'Display image thumbnails on Products With Attributes Stock page? (warning, setting this to true can severly slow the loading of this page):', '9', '6', NULL, now(), NULL, "zen_cfg_select_option(array('true', 'false')," );]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

I can't remember if I upload this sql file before but I think I never gotten this message. Will this cause the issue? How can I fix this??

I do not think there is a problem, this is based on a couple of things, first you indicated in your next post that it is working. Second, normally this error is telling you that you already have the item in your database and thus the script just stops, it should not have added anything new from the error forward, and it did not continue past the error (since it error-ed out on the first entry nothing should have changed in the database).

You may want to look in the admin under configuration/stock and see that both of these option that the script was to install are actually there, if they are I suspect everything is okay.

'Show available stock level in cart when less than order'
'Display Images in Admin'

16 Aug 2013, 6:26 PM
#1662
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

I just installed stock_by_attribute_1.5.1.1 on a fresh install of Zen Cart 1.5.1.

Everything seems to be OK, except on the product display page. When a product attribute/variant (in this case size: 5 x 7), is Out of Stock, it shows out of stock but it places 2 instead of 0 for Qty(quantity). Which seems to be coming from the previous attribute (4 x 6). Following is the pictures of what I see.
Attachment 12902

Has any one encountered this problem?

17 Aug 2013, 1:06 PM
#1663
rbranden avatar

rbranden

New Zenner

Join Date:
Feb 2006
Posts:
3
Plugin Contributions:
0

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

Well it shows I am using zen cart v1.5.1.. However if dhtml.php is not used in that version then a file or files must not have gotten updated.

17 Aug 2013, 3:55 PM
#1664
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

Does any one know of a SQL statement or scheme to update and or add quantities to products_with_attributes_stock table from an external csv file?

17 Aug 2013, 4:00 PM
#1665
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Kevin205:

I just installed stock_by_attribute_1.5.1.1 on a fresh install of Zen Cart 1.5.1.

Everything seems to be OK, except on the product display page. When a product attribute/variant (in this case size: 5 x 7), is Out of Stock, it shows out of stock but it places 2 instead of 0 for Qty(quantity). Which seems to be coming from the previous attribute (4 x 6). Following is the pictures of what I see.

Hi, Thanks for spotting this, I have a fix.
You can do either of the following:

  1. Replace the "includes\modules\attributes.php" file with this one [Attachment no longer available]
    or
  2. If you have made changes to the 'attributes.php' file then add this code on/or about line 118 before the if() "$PWA_STOCK_QTY = null;//initialize variable"
                //add qty to atributes based on STOCK_SHOW_ATTRIB_LEVEL_STOCK setting                
                $PWA_STOCK_QTY = null;//initialize variable
                if(STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true' && $qtyeachoption->fields['quantity'] > 0 ){
                    $PWA_STOCK_QTY = PWA_STOCK_QTY . $qtyeachoption->fields['quantity'] . ' ';
                }
                // END "Stock by Attributes"

I will add this to the next version I upload, currently trying to get pagination working on the entry page so that a smaller selection of product is displayed at one time.

17 Aug 2013, 4:48 PM
#1666
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

potteryhouse:

Hi, Thanks for spotting this, I have a fix.
You can do either of the following:

Thanks for the reply. I will change it and will let you know the outcome.

Meanwhile do you have a solution for this:

Kevin205:

Does any one know of a SQL statement or scheme to update and or add quantities to products_with_attributes_stock table from an external csv file?

17 Aug 2013, 5:07 PM
#1667
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

potteryhouse:

Hi, Thanks for spotting this, I have a fix.
You can do either of the following:

  1. Replace the "includes\modules\attributes.php" file with this one [Attachment no longer available]
    or
  2. If you have made changes to the 'attributes.php' file then add this code on/or about line 118 before the if() "$PWA_STOCK_QTY = null;//initialize variable"
            //add qty to atributes based on STOCK_SHOW_ATTRIB_LEVEL_STOCK setting                
            $PWA_STOCK_QTY = null;//initialize variable
            if(STOCK_SHOW_ATTRIB_LEVEL_STOCK == 'true' && $qtyeachoption->fields['quantity'] > 0 ){
                $PWA_STOCK_QTY = PWA_STOCK_QTY . $qtyeachoption->fields['quantity'] . ' ';
            }
            // END "Stock by Attributes"
> 
> I will add this to the next version I upload, currently trying to get pagination working on the entry page so that a smaller selection of product is displayed at one time.

Attachment 12916

Problem is FIXED.  Thanks.

Another question:
I know if you set **Allow Checkout** to **false**, the out of stock product would not show up on the product_info page.  Is there a way to display the **Out of Stock** product without being able to add it to the cart?
17 Aug 2013, 6:06 PM
#1668
pablo avatar

pablo

New Zenner

Join Date:
Jun 2011
Posts:
91
Plugin Contributions:
0

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

Chargin:

AWESOME :) thanks.
I will be sure to provide feedback within a couple of days.

This works great but it is still a hassle to find the product id number.

I have modified one line in the stats_products_purchased.php file located in the root of YOUR_ADMIN folder.

FROM THIS:
$products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' and p.products_ordered > 0 group by pd.products_id order by p.products_ordered DESC, pd.products_name";

TO THIS:
$products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' group by pd.products_id order by pd.products_name ASC, p.products_id";

This will still show you the products purchased, but it displays them by name rather than by quantity purchased
and will also show zero quantity purchases so you can easily get a product id number.

Be sure to BACKUP your original file before you modify it.

17 Aug 2013, 6:12 PM
#1669
pablo avatar

pablo

New Zenner

Join Date:
Jun 2011
Posts:
91
Plugin Contributions:
0

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

potteryhouse:

The attached file is a "Quick Fix", please test it to see if it does what you want before using on an active site.
The file will replace: stock_by_attribute\admin\includes\classes\products_with_attributes_stock.php
I suggest you back up before using this.
It will give you a search box, no product listing, and you must know the product ID number or product name to search for it (I commented out the model number as it gave me too many returns, you can change it back if you like, it is still in the file on line 115). [Attachment no longer available]

Let me know how it goes please.

FYI, I have been trying to get pagination working with no good results as of yet.

This works great but it is still a hassle to find the product id number.

I have modified one line in the stats_products_purchased.php file located in the root of YOUR_ADMIN folder.

FROM THIS:
$products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' and p.products_ordered > 0 group by pd.products_id order by p.products_ordered DESC, pd.products_name";

TO THIS:
$products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' group by pd.products_id order by pd.products_name ASC, p.products_id";

This will still show you the products purchased, but it displays them by name rather than by quantity purchased
and will also show zero quantity purchases so you can easily get a product id number.

Be sure to BACKUP your original file before you modify it.

18 Aug 2013, 1:17 AM
#1670
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

If a product has 2 attributes (size and color) and the inventory is only kept by the size of the product and not by the color.

Is there a way to track inventory by size only? As the color is only used as read only Attribute for filtering and description purposes.

18 Aug 2013, 1:38 AM
#1671
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

And if you already have 1000 of product size attributes in your existing site, how would you add all of them to products_with_attributes_stock table?

I hope the answer is not one by one through admin!

19 Aug 2013, 4:41 AM
#1672
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

While reading the wiki I noticed the following:

I offer my customers a choice of gift wrapping / ring setting / picture frame / container / monogram style, but don't want to create product variants for every combination of products and gift wrapping ... How can I avoid this?

This is an important issue that is affecting a number of stores as the variety of situations mentioned in the question above indicates. A workable solution is discussed from posts 199 to 204 in an archived stock by attributes thread[2]. However, as this intrudes into critical Zen Code and tables there are no plans incorporate it into this mod, though it will be considered for inclusion when the function is incorporated into Zen Cart's core code.

As I have explained I am in the same situation and frozen. I read posts 199 to 204 but did not find the code change for it. Where can I get the code change for this? Would appreciate your help on this.

19 Aug 2013, 2:25 PM
#1673
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

Kevin205:

And if you already have 1000 of product size attributes in your existing site, how would you add all of them to products_with_attributes_stock table?

I hope the answer is not one by one through admin!

Good morning (at least it is here....)
I had provided as part of the mod update an 'Optional.sql' file, this file finds all the products that have attributes in your database and creates entries into the new stock by attribute table. This worked great for me, but I have only one variable (size) for products. Did you happen to try this sql file on a TEST version of your database??

If that is too simplistic of an approach for your data set, I would need a sample (if your willing to provide) of your database (the sample will need to be 'sanitized' to remove any customer related information, orders, etc.) all I think I would need from your database is the following tables to try an create a custom sql file (as this is done on my spare time as a hobby I can not say how long it will take)

products
products_attributes
products_attributes_download
products_description
products_options
products_options_types
products_options_values_to_products_options
products_with_attributes_stock

It may be best to use private messages for this if you decide to send anything.

19 Aug 2013, 3:57 PM
#1674
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

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

Good morning to you. Thanks for the reply.
[QUOTE=potteryhouse;1215179]Good morning (at least it is here....)
I had provided as part of the mod update an 'Optional.sql' file, this file finds all the products that have attributes in your database and creates entries into the new stock by attribute table. This worked great for me, but I have only one variable (size) for products. Did you happen to try this sql file on a TEST version of your database??

[/CODE]

I did not run 'Optional.sql as I didn't realize what it does.

[QUOTE=potteryhouse;1215179]
If that is too simplistic of an approach for your data set, I would need a sample (if your willing to provide) of your database (the sample will need to be 'sanitized' to remove any customer related information, orders, etc.) all I think I would need from your database is the following tables to try an create a custom sql file (as this is done on my spare time as a hobby I can not say how long it will take)

products
products_attributes
products_attributes_download
products_description
products_options
products_options_types
products_options_values_to_products_options
products_with_attributes_stock

It may be best to use private messages for this if you decide to send anything. 

I gathered all the above tables to forward to you. I sent you a pm.

FYI: Following pictures displays what I see,
- when I add inventory to the size from the mod.
Attachment 12922
with the following settings
Attachment 12924

- when I removed the second attribute id from the stock_attributes
Attachment 12923

28 Aug 2013, 8:54 PM
#1675
buildingblocks avatar

buildingblocks

Totally Zenned

Join Date:
Jun 2008
Posts:
629
Plugin Contributions:
0

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

Hi

I have installed Stock by Attributes - Version: 1.5.0 on a zen cart 1.5.0. The module documentation says:

You will also want to consider the settings in Configuration->Stock. The settings here will determine things such as whether or not a customer will be allowed to checkout when insufficient stock is on hand. As well as controlling the new feature that allows you display the amount of stock available on the shopping cart page if a customer tries to buy more
than the recorded stock.

I don't see anything in Configuration->Stock for controlling the new feature. What setting should be there?

Could some tell me please what setting I should be seeing in there?

thanks

28 Aug 2013, 9:37 PM
#1676
pablo avatar

pablo

New Zenner

Join Date:
Jun 2011
Posts:
91
Plugin Contributions:
0

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

buildingblocks:

Hi

I have installed Stock by Attributes - Version: 1.5.0 on a zen cart 1.5.0. The module documentation says:

You will also want to consider the settings in Configuration->Stock. The settings here will determine things such as whether or not a customer will be allowed to checkout when insufficient stock is on hand. As well as controlling the new feature that allows you display the amount of stock available on the shopping cart page if a customer tries to buy more
than the recorded stock.

I don't see anything in Configuration->Stock for controlling the new feature. What setting should be there?

Could some tell me please what setting I should be seeing in there?

thanks

Check stock level > true
Subtract stock > true
Allow Checkout > false
Mark product out of stock > ***
Stock Re-order level > 5
Show available stock level in cart when less than order > true
Display Images in Admin > false
Show available stock level on product page with the attribute (option) >false or true
Products status in Catalog when out of stock should be set to > 0
Show Sold Out Image in place of Add to Cart > 0
etc, etc, etc...

28 Aug 2013, 10:22 PM
#1677
buildingblocks avatar

buildingblocks

Totally Zenned

Join Date:
Jun 2008
Posts:
629
Plugin Contributions:
0

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

Pablo:

Check stock level > true
Subtract stock > true
Allow Checkout > false
Mark product out of stock > ***
Stock Re-order level > 5
Show available stock level in cart when less than order > true
Display Images in Admin > false
Show available stock level on product page with the attribute (option) >false or true
Products status in Catalog when out of stock should be set to > 0
Show Sold Out Image in place of Add to Cart > 0
etc, etc, etc...

Thank you. It was missing.

Show available stock level in cart when less than order - true/false

For some reason the automatic sql installation didn't add it but I did find the sql in the legacy folder so I was able to activate it.

28 Aug 2013, 10:38 PM
#1678
buildingblocks avatar

buildingblocks

Totally Zenned

Join Date:
Jun 2008
Posts:
629
Plugin Contributions:
0

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

Pablo:

Check stock level > true
Subtract stock > true
Allow Checkout > false
Mark product out of stock > ***
Stock Re-order level > 5
Show available stock level in cart when less than order > true
Display Images in Admin > false
Show available stock level on product page with the attribute (option) >false or true
Products status in Catalog when out of stock should be set to > 0
Show Sold Out Image in place of Add to Cart > 0
etc, etc, etc...

I also see in your list

"Show available stock level on product page with the attribute (option) >false or true "

The version module (1.5.0) I'm using does not include it. I see the file

stock_by_attr_install.php for module version 1.5.1.1 does have it. If I install the sql for, Show available stock level on product page, will it work for module version 1.5.0?

29 Aug 2013, 10:42 AM
#1679
potteryhouse avatar

potteryhouse

Zen Follower

Join Date:
Jun 2012
Location:
Florida
Posts:
123
Plugin Contributions:
0

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

buildingblocks:

I also see in your list

"Show available stock level on product page with the attribute (option) >false or true "

The version module (1.5.0) I'm using does not include it. I see the file

stock_by_attr_install.php for module version 1.5.1.1 does have it. If I install the sql for, Show available stock level on product page, will it work for module version 1.5.0?

The short answer is no.
The reason is, that was, a new option added to code in the latest version 1.5.1.

As a note I am working with another member, Kevin205, to make some significant improvements to this mod and add some level of user instructions to help with understanding what each of the option switches in the "Configuration/Stock" will provide, and maybe a recommended base setting.

This update will replace the previous version (1.5.0, 1.5.1, and 1.5.1.1) since most of the files have at least a small amount of code updates. It will add too and correct some of the behaviors this mod exhibits, some of which were lost over time as it was updated.

I am hoping to have a beta version posted for anyone wanting to test and provide us feedback in the near future. It will not be perfect, but I think everyone will like the updates. But it will only be compatible with Zen Cart 1.5.1 since the CORE file modifications are based on 1.5.1.

29 Aug 2013, 2:29 PM
#1680
buildingblocks avatar

buildingblocks

Totally Zenned

Join Date:
Jun 2008
Posts:
629
Plugin Contributions:
0

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

potteryhouse:

The short answer is no.
The reason is, that was, a new option added to code in the latest version 1.5.1.

As a note I am working with another member, Kevin205, to make some significant improvements to this mod and add some level of user instructions to help with understanding what each of the option switches in the "Configuration/Stock" will provide, and maybe a recommended base setting.

This update will replace the previous version (1.5.0, 1.5.1, and 1.5.1.1) since most of the files have at least a small amount of code updates. It will add too and correct some of the behaviors this mod exhibits, some of which were lost over time as it was updated.

I am hoping to have a beta version posted for anyone wanting to test and provide us feedback in the near future. It will not be perfect, but I think everyone will like the updates. But it will only be compatible with Zen Cart 1.5.1 since the CORE file modifications are based on 1.5.1.

Thanks for responding. I'd be interested in testing the beta when it is available.