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

Results 1,701 to 1,720 of 3,609
16 Sep 2013, 2:53 PM
#1702
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

milobloom:

I made the change and It looks like I can work with that.

http://www.nothingbutcostumes.com/final-clearence-c-4438/gabriella-lifeguard-high-school-musical-costume-p-15662.html

Do you know where I can find the TXT string that says Qty?

I want to change it to Available Stock Qty

You will find it in the file at:
includes\languages\english\extra_definitions\products_with_attributes.php

I noticed your shopping cart checkout page has incorrect info related to availability, the TEST2 mod I gave you a link to should fix that.
Let me know if you were able to get the test mod and your tests results. Thanks

17 Sep 2013, 5:24 AM
#1703
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

milobloom:

Can I hide the attribute value if stock is Zero instead of saying it is out of stock?

If I understand your question correctly, You can hide the Out of Stock Message, by going to admin>Configuration>Stock>Check stock level ,and set it to False!

That stops the display of Out of Stock Message.

I hope it helps.

17 Sep 2013, 8:49 AM
#1704
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

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

I had a version from January but can't find a guide text if I need to run the full upgrade / install script in case I upgrade from the Jan 3 version to this latest version of 1.5.1.2. Atleast the upgrade script runs to a warning:

WARNING: An Error occurred, please refresh the page and try again.

The error log has this "FATAL ERROR":
PHP Fatal error: 1146:Table 'customer123_ws.products_with_attributes_stock' doesn't exist :: UPDATE products_with_attributes_stock SET quantity = '3' WHERE products_with_attributes_stock.stock_id =263 LIMIT 1 in /home/customer123/public_html/shop/includes/classes/db/mysql/query_factory.php on line 120

17 Sep 2013, 9:00 AM
#1705
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

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

ADDITIONALLY comes also an error:

PHP Fatal error: 1146: Table 'customer123_ws.zen_products_with_attributes_stock' doesn't exist :: SELECT pas.stock_id, COUNT(pas.stock_id) AS stockCount
FROM zen_products_with_attributes_stock pas
GROUP BY pas.products_id, pas.stock_attributes
HAVING stockCount > 1 in /home/customer123/public_html/kauppa/includes/classes/db/mysql/query_factory.php on line 120

so, it seems it doesn't understand that there is a PREFIX used in our webshop. How to fix that?

There is no "out of stock" or "stock saldo" visible on the product info page even if set up in configuration so.

17 Sep 2013, 4:56 PM
#1706
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

ellivir:

I had a version from January but can't find a guide text if I need to run the full upgrade / install script in case I upgrade from the Jan 3 version to this latest version of 1.5.1.2. Atleast the upgrade script runs to a warning:

WARNING: An Error occurred, please refresh the page and try again.

The error log has this "FATAL ERROR":
PHP Fatal error: 1146:Table 'customer123_ws.products_with_attributes_stock' doesn't exist :: UPDATE products_with_attributes_stock SET quantity = '3' WHERE products_with_attributes_stock.stock_id =263 LIMIT 1 in /home/customer123/public_html/shop/includes/classes/db/mysql/query_factory.php on line 120

Where did you get version 1.5.1.2 from?

17 Sep 2013, 6:41 PM
#1707
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

ellivir:

I had a version from January but can't find a guide text if I need to run the full upgrade / install script in case I upgrade from the Jan 3 version to this latest version of 1.5.1.2. Atleast the upgrade script runs to a warning:

WARNING: An Error occurred, please refresh the page and try again.

The error log has this "FATAL ERROR":
PHP Fatal error: 1146:Table 'customer123_ws.products_with_attributes_stock' doesn't exist :: UPDATE products_with_attributes_stock SET quantity = '3' WHERE products_with_attributes_stock.stock_id =263 LIMIT 1 in /home/customer123/public_html/shop/includes/classes/db/mysql/query_factory.php on line 120

It seems that Stock by Attributes has been released.

Make sure you are not trying to upgrade from 1.4.XX on Zen Cart 1.3.X.

Are you installing this mod on Zen Cart 1.5.1?

Have you installed any other versions of this mod on your cart? If yes, which version?

18 Sep 2013, 2:48 AM
#1708
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

ellivir:

ADDITIONALLY comes also an error:

so, it seems it doesn't understand that there is a PREFIX used in our webshop. How to fix that?

There is no "out of stock" or "stock saldo" visible on the product info page even if set up in configuration so.

You were correct, There was one instance (line 293) that was missing the database table prefix. The attached file is corrected, and will be included in the next version. [Attachment no longer available]

Thank you.

19 Sep 2013, 3:26 PM
#1709
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

ellivir:

I had a version from January but can't find a guide text if I need to run the full upgrade / install script in case I upgrade from the Jan 3 version to this latest version of 1.5.1.2. Atleast the upgrade script runs to a warning:

WARNING: An Error occurred, please refresh the page and try again.

The error log has this "FATAL ERROR":
PHP Fatal error: 1146:Table 'customer123_ws.products_with_attributes_stock' doesn't exist :: UPDATE products_with_attributes_stock SET quantity = '3' WHERE products_with_attributes_stock.stock_id =263 LIMIT 1 in /home/customer123/public_html/shop/includes/classes/db/mysql/query_factory.php on line 120

Hi,
I was wondering if the updated file I provided on the forum corrected your install errors.

Thanks.

26 Sep 2013, 2:08 PM
#1710
ray_the_otter avatar

ray_the_otter

Zen Follower

Join Date:
Jul 2010
Posts:
278
Plugin Contributions:
0

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

HI, is it possible to do a 'bulk' or 'batch' action to "Add Quantity For Product Variant" on all products at once?

My problem see, is that I seem to have to mouse-click on "Add Quantity For Product Variant" for each product, then select ALL and the add Quantity to create the Stock ID.

I'd like to be able to Add "Quantity For Product Variant" on all products that have attributes at once. As I have 2000+ products, all with the same 15 attributes. And it is taking some time to do this individually, product by product, just to create the 'Stock ID'

All help appreciated, thanks

:(

27 Sep 2013, 12:21 AM
#1711
chargin avatar

chargin

Zen Follower

Join Date:
Sep 2011
Posts:
136
Plugin Contributions:
0

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

I would say using phpmyadmin you should be able to do this. There would be a query you could run that will populate all the fields with 15 or whatever stock level you want. Im not sure what the query would need to be exactly though.

27 Sep 2013, 12:34 AM
#1712
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

ray-the-otter:

HI, is it possible to do a 'bulk' or 'batch' action to "Add Quantity For Product Variant" on all products at once?

My problem see, is that I seem to have to mouse-click on "Add Quantity For Product Variant" for each product, then select ALL and the add Quantity to create the Stock ID.

I'd like to be able to Add "Quantity For Product Variant" on all products that have attributes at once. As I have 2000+ products, all with the same 15 attributes. And it is taking some time to do this individually, product by product, just to create the 'Stock ID'

All help appreciated, thanks

:(

This depends on what version of the mod you are running.
If you are using the version 1.5.1.2, than this functionality is built into the installation script as a selection.

After installation you can use the "Run Optional SQL", This script will Makes entries into the new SBA Table based on the products that have attributes associated.

After running the script you can do an export 'Export Table Data' of the table to a CSV file and update the stock using excel (save file as CSV), use "Import Table Data'... This is explained in the documentation under Optional SQL:

Optional.sql

The Optional SQL script is intended to initially fill the stock table with the same quantity that the product has. The script only creates entries for products that have associated attributes.
The first time the script is run on a clean new installation (the new SBA stock table is empty), then all found records are added.

2 Oct 2013, 3:53 AM
#1713
nwcider avatar

nwcider

New Zenner

Join Date:
Sep 2013
Location:
Oregon, USA
Posts:
2
Plugin Contributions:
0

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

I'm having a problem that I can't find reference to on this thread.

When I have a product with attributes and stock for each attribute a customer can choose to order whichever version they want. However when they check out, stock is removed from the overall stock levels for the product, but not for the particular attribute.

For example, if I have product A with variants Ab and Ac, and I start with stock of 10 each. A customer purchases 5 in variant Ac; my stock for product A now says 15, but Ab shows as 10, and Ac shows as ten. Worse (which has happened) a customer buys all of Ac, but then the next customer can still choose to buy 10 more that don't exist.

I am using V1.5.0, SBA version 1.5.0, however I was having the same issue with an earlier SBA which I uninstalled over the summer and re-installed just recently. I merged all of the files needed, and everything else seems to work.

Any ideas on where to even start looking?

Thanks.

2 Oct 2013, 4:33 AM
#1714
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

NWCider:

I'm having a problem that I can't find reference to on this thread.

...

Any ideas on where to even start looking?

Thanks.

Hi,
The code that should be doing this is in: includes\classes\order.php on about line 739, with the title:
// kuroi: Begin Stock by Attributes additions
// added to update quantities of products with attributes

I was not aware this did not work correctly.
This is an area of the code I have not looked closely at yet. If you solve the problem, would you let us know, I am working on an updated version of this mode to include some additional features, and could add that fix.

2 Oct 2013, 4:57 AM
#1715
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

In my case it works fine.

I have Product A with 3 attributes.

Prod A, Attribute A (9 QTY)
Prod A, Attribute B (3 QTY)
Prod A, Attribute C (1 QTY)

Displaying 13 Units in Stock

When I checkout one (purchase) from Prod A, Attribute B. After checkout, product_info page displays:

Prod A, Attribute A (9 QTY)
Prod A, Attribute B (2 QTY)
Prod A, Attribute C (1 QTY)

Displaying 12 Units in Stock

It works fine for me.

2 Oct 2013, 5:03 AM
#1716
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

Tried another test. Checked out 5 of units of Prod A, Attribute A

Prod A
Attribute A (4 QTY)
Attribute B (2 QTY)
Attribute C (1 QTY)

Displaying 7 Units in Stock

Code works fine here.

2 Oct 2013, 1:14 PM
#1717
nwcider avatar

nwcider

New Zenner

Join Date:
Sep 2013
Location:
Oregon, USA
Posts:
2
Plugin Contributions:
0

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

Thanks for the ideas. The file you referenced was replaced in the install, so it should be fresh. Here is the code in that section, it all looks good to me, but I'm not an advanced code reader...

I also re-checked my stock config settings and everything seems to be correct.

// kuroi: Begin Stock by Attributes additions
// added to update quantities of products with attributes
$attribute_search = array();
$attribute_stock_left = STOCK_REORDER_LEVEL + 1; // kuroi: prevent false low stock triggers

		if(isset($this->products[$i]['attributes']) and sizeof($this->products[$i]['attributes']) >0){
			foreach($this->products[$i]['attributes'] as $attributes){
				$attribute_search[] = $attributes['value_id'];
			}
		
			if(sizeof($attribute_search) > 1){
				$attribute_search = 'where options_values_id in ("'.implode('","', $attribute_search).'")';
			} else {
				$attribute_search = 'where options_values_id="' . $attribute_search[0].'"';
			}

			$query = 'select products_attributes_id from ' . TABLE_PRODUCTS_ATTRIBUTES . ' ' . $attribute_search .' and products_id="' . zen_get_prid($this->products[$i]['id']) . '" order by products_attributes_id';
			$attributes = $db->Execute($query);
			$stock_attributes_search = array();
			while(!$attributes->EOF){
				$stock_attributes_search[] = $attributes->fields['products_attributes_id'];	
				$attributes->MoveNext();
			}
			if(sizeof($stock_attributes_search) > 1){
				$stock_attributes_search = implode(',', $stock_attributes_search);
			} else {
				foreach($stock_attributes_search as $attribute_search){
					$stock_attributes_search1 = $attribute_search;
				}
				$stock_attributes_search = $stock_attributes_search1;
			}
			
			$get_quantity_query = 'select quantity from ' . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . ' where products_id="' . zen_get_prid($this->products[$i]['id']) . '" and stock_attributes="' . $stock_attributes_search . '"';

		$attribute_stock_available = $db->Execute($get_quantity_query);	
			$attribute_stock_left = $attribute_stock_available->fields['quantity'] - $this->products[$i]['qty'];

			$attribute_update_query = 'update ' . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . ' set quantity='.$attribute_stock_left.' where products_id="' . zen_get_prid($this->products[$i]['id']) . '" and stock_attributes="' . $stock_attributes_search . '"';
			$db->Execute($attribute_update_query);	
		}
		// kuroi: End Stock by Attribute additions
2 Oct 2013, 1:30 PM
#1718
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

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

NWCider

I solved this issue on my 1.5.1 cart on a Linux server...and it was addressed in the other thread. I'll try and refresh my memory of it and post.

SBA for 1.5.x http://www.zen-cart.com/showthread.php?166928-Stock-by-Attributes-5-0-Beta-%28for-v1-5-0%29/page32

In the mean time, I'm wondering why updates to this mod are here for zencart version 1.5.x?

2 Oct 2013, 1:59 PM
#1719
athena avatar

athena

Totally Zenned

Join Date:
Jan 2006
Location:
NM
Posts:
740
Plugin Contributions:
0

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

NWCider - just to follow up, especially if you are new to SBA and 1.5.1 - not sure if this is relevant as it seems this thread has taken over the development of this mod. Here is my post about the issue of sync quantities from that other thread...but, once our site was up and running for a few days on the Linux server the user RoboPhung's version began behaving without issues as long as we had the settings as described here. (Not trying to confuse things further, Just getting in the game, guys, so I can stay in the loop of the newer developments on this valuable zencart need.)

We have mostly non-attribute items up to about 1200 total. About thirty of those have attributes. We have RoboPhungs version installed and are still working on a sync quantities issue; However, everything else seems to be working very well in 1.5.1.

The sync issue for us is currently being solved by just pushing the "sync all quantities" link every day on the Config > SBA page, other wise, customers can check out without the help of a warning, only if the number of product with the chosen attribute is less than the total quantity of the product. Some weirdness that RoboPhung is working on and may just be some install issue on our end.

Check your install, (as if you haven't...but check it again anyways). Also, because single drop down does not work, check that under Config > Stock you are using:

Check stock level true
Product Info Single Attribute - multiple_dropdowns
Product Info Multiple Attribute - sequenced_dropdowns

2 Oct 2013, 3:53 PM
#1720
milobloom avatar

milobloom

Totally Zenned

Join Date:
Feb 2004
Posts:
1,267
Plugin Contributions:
1

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

1.5.1 Questions

What happens when I sync all quantities?

Can I change it so when people DO NOT select an option it prevents from ordering?
Can I change it so when products with attributes but no stock qty, it goes to unlimited?