It's in the downloads queue awaiting approval.
Printable View
Please don't laugh at me for asking this - I've been searching everywhere and can't find an answer.
I want to download this add-on but where do I download it to? I can't find any info on where I should save this to.
Thanks for any help.
OK Ignore my above post - I manage to get the file installed but....
I'm really struggling here and have spent about 6 hours searching posts and wiki but I'm getting more and more confused about things. I'm having the same problem as a lot of other people but I still can't find a solution. The problem is I have a particular bead available in 4 colours. I've been able to set the attribute stock levels but if I have 4 aqua and 10 of the other 3 colours it is still possible to order 6 aqua.
There's so much information on the instructions and I don't know which bits are relevant to the versions I'm using. For example I've seen things about 'merging' and 'check if any of the files have changed' - how do I know?
So please please help me because I've wasted so much time that I don't have, I don't understand what I need to do so if anybody can help can you tell me in really simple easy to understand instructions and walk me through exactly what I need to do and maybe even how?
My version of Zen Cart is: 4.4.6 and I downloaded what I presume is the most recent version of this add-on.
Kuroi, I can't PM you any more as your message box is full. Hope you see this
Mod allowing checkout when there's insufficient stock, even when the Admin Settings say not to.
That would be this bead I think. The problem has been dealt with and is gone.
As Ellie observes, quite a few people have complained about this problem and so I have recently gone behind a few of their sites to look into this. In every case the issue has proven to be that not all the files needed by the mod had been installed.
The quick test for other people having this problem is to download the includes/classes/order.php file from their site. If line 8 doesn't say something like the line below then there is a problem with the installation.This is most likely due to a problem with the way in which the files are being FTP'd. Most likely because it involves overwriting some existing Zen Cart files and your FTP client may need you to confirm that you wish to do this. It's even possible that some FTP clients assume that the mod's files with an earlier timestamp than a later Zen Cart installation are less current than the files already there and just ignore the older but vital files.Quote:
* @version $Id: order.php 0000 2007-09-19 00:00:00Z kuroi $
However, whatever the reason, anybody else tempted to post on this problem should first check that they have the correct version of the above file installed on their site.
The issue I'm having is I have to manually reduce the quantity in stock when an order is placed. I thought this was done automatically by this Mod? Am I missing something?
I'm using Zencart vs.1.37. I installed the Products with Attributes Stock Mod on 04/07.
Here is my setup in Admin:
Check Stock Level = True
Subtract Stock = True
Allow Checkout = False
Should I update to the latest Mod submitted?
Thanks for any help?
Sounds like a different description of the installation issue referred to in post #308. You may as well install the latest version (just copy the files over, no database changes needed) as it offers you an additional option with no downside, and I suspect that you will need to re-install the files anyway.
Issues with the stock tracking...
Rather than deducting from the attribute (let’s say, 1 pink dress in size 10) when you put an item in the shopping cart, it deducts from the total product quantity. So, if I have 10 dresses in stock, and only one is pink, size 10, it will let the person put 11 dresses in their cart (all pink, size 10) before giving the out of stock message!
We created a new product, just to make sure something funky didn’t happen with the export that caused the products and attributes to not link up properly – same issue with the new product.
There must be a “switch” somewhere to tell the system to allow the attributes to deduct the stock totals, but we have looked all over and can’t find it!
the admin setting is set to true...
Line 8 of the includes/classes/order.php is
* @version $Id: order.php 0000 2007-09-19 00:00:00Z kuroi $
I also reloaded all the files for this version 4_5.
Still no change in the issue.
Here is a link to the dev site:
http://ffdev4.net/
Thanks for your attention to this!
@rogerh
Could you tell me which product it is, how much stock you have set for each product variant and set "Show stock when low" to true.
http://ffdev4.net/index.php?main_pag...&products_id=4
85
I have two in stock in size 80, and one in size 86. As you will see, you can
buy 2, and even 3, in size 86 (which should show out of stock at 2), but
when you add the 4th, it finally shows out of stock.
Every single product that has more than one (which is pretty much the whole
site minus just a few) is calculating stock this way.
Show available stock in cart when less than order is set to true (I think
that was the setting you were referring to?)
Version 4.7 of Stock by Attributes is release for Zen Cart 1.3.8. Please don't try to use it on earlier versions of Zen Cart, it will probably fail.
There are no functional changes. It's simply a maintenance mod that incorporates the 1.3.8 changes into this mod's versions of core Zen Cart files that it over-writes or over-rides.
The source of the problem on your site is the extra step that you have added to the installation process, i.e. make a copy of the file being over-written.
While this is not a bad thing to do in principle (though personally I prefer to keep a copy of the whole Zen Cart release package handy) I would strongly advise against ever mixing them in with your live files.
What has happened on your site is that first the new files from the stock by attributes mod get executed and work perfectly. And then your back up files get executed and over-write the stock by attributes results.
hi,
I am trying to install the great add-on you made; Stock by Attributes . http://www.zen-cart.com/index.php?ma...roducts_id=310
version 4.6
in the readme file there is a point regarding installing file;
There are six core Zen Cart files modified by this add-on. If you have installed other add-ons or customised your cart since your Zen Cart installation or upgrade, you will need to check whether they have changed any of the following files:
In addition, one file is over-ridden
- admin/includes/stylesheet.css
- admin/orders.php
- includes/classes/order.php
- includes/functions/functions_lookups.php
- includes/modules/pages/checkout_shipping/header_php.php
- includes/modules/pages/shopping_cart/header_php.php
My webshop is already online with products and customers etc. so i guess its not a new installation. btw, i am running 1.3.7.1 .
- includes/templates/template_default/templates/tpl_shopping_cart_default.php
I wanted to upload the above mentioned files with my flashfxp, should i override the current files or not?
like for example: admin/orders.php , should i override this orders.php file with the one already exist? if not what should i do? i really want to install this module but unfortunatly i do not have enough knowledge to merge the files or do anything with them...:dontgetit i am learning everyday!
looking forard for your reply
Thanks in advance
Saman-
Hi saman
Most of the files that you listed cannot be over-ridden - they can only be over-written.
Whether or not you should do this would depend upon whether you have installed other mods that have already changed them. Only you can answer that.
If you have, then your only options are to uninstall the other mods in favor of this one, merge the files together, or employ somebody (maybe from the Commercial Help Wanted forum) to do the job for you.
hello,
I am setting up a new store with ZenCart 1.3.7 and have installed the attributeStock3.01.1 (by danielcor). Everything is working fine on the backend and we can assign quantities to the attributes for each product. However, on the product pages, the dropdown boxes are empty (even though stock is non-zero). I've got all of the files for the module uploaded into the proper folder names, etc.
Does anyone know how to fix this and if there is a newer version of this module that might help? Thanks,
rian_c
The construction of a Zen Cart page is a very complex business. The control code whizzes round your site picking up components from all over the place. In some places it just picks up files that match specific naming conventions, in others it picks up everything in a relevant folder.
For this reason it is dangerous to leave backup files mixed in with your live files. Zen Cart doesn't have any logic to tell it that the insertion of OLD into a filename means that you don't want it executed.
By all means keep backups, but keep them separate from your live (or in this case development) site.
Sorry Rian, but this is the support thread for Stock by Attributes not Danielcor's attributeStock (I don't know of any support for the mod that you are using).
All I can tell you is that the module that you are using is a fairly recent update, and I believe that you have the latest version. However, I also believe that the update, like the original was developed for an earlier version of Zen Cart and anything to do with attribute stock is likely to be very sensitive to precisely matching mod versions with the version of Zen Cart for which they were developed.
Anybody know differently?
Alright, another stock-by-attribute question -- unfortunately I think I might already know the answer, but I want to double-check!
I have products with multiple attributes. Can I stock by only one of those attributes?
For example, we have titanium barbells in different lengths. Our stock number should be associated with the length. We also, however, custom-anodize these pieces, so we have an attribute drop-down for titanium color options. Is there a way to stock by the length, but NOT by the color?
I didn't realize that every product had to have a quantity when I installed this mod.
Having a store with too many products with lots of attributes allready makes this mod to hard to deal with.
How can I either,
1) Make it so that everything defaults to a high quantity
or
2) Uninstall this mod - or at least make it so that it doesn't make all of my products out of stock anymore.
One thought I was thinking of if it cannot be uninstalled is allow checkout if its out of stock and delete the Red box that says so... If so, which files do I edit?
Every product has to have a quantity in Zen Cart, whether you have this mod installed or not, even if that quantity is zero.
Are you using a version of this mod prior to 4.6 when you needed to enter attribute stock for each product that had attributes or else the product stock was treated as zero. If so, you may want to upgrade, because that's no longer the case. Now you enter attribute stock only for those products where you want to manage stock at attribute level and then only for those attribute combinations that are non-zero.
However, if you want to uninstall it, a list of the files that have been overwritten is included in the Stock by Attribute readme and on the Wiki page specifically so that you know which ones to replace from your original Zen Cart release package.
Oh. ok that should have been obvious.
Thanks.
70 colors, 9 sizes, and various other customization attributes; what do you get when you mix all these together, and multiply them by a few hundred products?
Answer: A million, trillion, zillion combinations, that must be entered one at a time.
Aside from hiring 3,000 third-world laborers to enter all these combinations, what are my options? I don't actually need (or even want) to track stock, I simply need to keep my customers from purchasing a few unavailable combinations.
For an example, I want to sell a t-shirt. This t-shirt comes in many different colors, sizes Small through 5XL. However, the color "Eggplant" is only available up to 3XL.
How can I keep people from buying 4XL and 5XL Eggplant t-shirts, which simply do not exist?
I'm trying to get this all working with Product Attribute Grid.
Thanks,
01011010
I get this same error too.
Is there a working fix for Zen 1.3.8 and Stock by Attributes v4.7 to make it mark the attributes that are sold out? Or remove from the drop down on the product page or something? It's very annoying for customers to add a product to their cart, and not find out it's sold out until later when they go to check out.
Set the stock decrement flag in the Admin to false and then EITHER:
Write yourself a small SQL script to insert a line into the attributes stock table with more stock than is ever likely to be required for a single order, wrap your SQL script in a PHP script that loops to create a record for every conceivable option, delete those combinations that don't actually exist OR
Create a spreadsheet with all possible options, export it to a CSV file, use a database admin tool (e.g. phpMyAdmin) to import it to the attributes stock table.
Hi.
I am running zen cart 1.3.7, so I have installed version 4.6 of this contribution. Installation went smoothly, the admin side seems to be ok but when I make a test purchase and go to checkout, I get the following error.
Fatal error: Cannot redeclare class order in /var/www/html/shop/includes/classes/order.php on line 1037
Can someone please tell me what I have messed up?
Philip
Hi, thank you for the products with attributes stock mod:-) i was just wondering if you know where i am going wrong with something. apparently (randomly and not very often) an attribute will be set to 0 but the user can still buy it with that attribute - i have set my cart to not allow checkout on out of stock items and it works for the vast majority o the time but sometimes it doesnt.
also when an attribute goes out of stock most of the time it shows up as ":" as opposed to the attribute name and sometimes it still has a stock level (although it doesnt show up to the user)
just had a brand new problem - i had 1 item with an attribute stock of 1 but the user ordered it x2 and now the stock says -1..any clues?
hope that made sense!
thanks for any help you can give:-)
just let me know if you need any details.
Ok, you're gonna hate me for this but ...
I had this mod installed in my site before i redid it all and haven't bothered with it again as it gave me an error message when deleting items for which I had to hit my back button and hit delete again for it to delete.
But I remember adding another mod which made it so that if an attribute was not in stock it wouldn't show up in the drop down menu. And if someone added more than the available stock of an attribute, on the shopping cart window it would come up in red (or whatever color you want it to be) that the amount in the cart is not available and it would actually say how many were available.
The bad news is I don't remember what the mod was. You'll have to read through the downloads section, that's how I found it.
Good luck.
I just installed this on a new site I am working on.
When I did the SPL query I got th1 error message and 1 note as follows:
Error: Cannot create table product_with _attributes_stock because it already exists ( I am assuming this is because I tried a diff mod for this earlier which uses the same table)
Note: 1 statement ignored. See upgrade exceptions table for additional details ( I assume this is because I wasn't upgrading)
I then proceeded to install the files which I did manually one at a time via FTP to make sure they were all uploaded correctly. The renamed the ones that would be overriden by adding a 1 at the end of the file name and then uploading the file of the same name. This way it will be easily undone.
Then I looked at the site http://www.cheechababy.com.au and it still looked the same so that was promising. I went to admin and the products with attributes stock option/tab is there.
I then added stock to a product (headbands) but only to the blush attribute. I then went to buy the cloud-blue for which I hadn't added any stock. I went to my cart and hit the checkout button but nothing happened, I tried again with the same result so I assume it is because that attribute has no stock so it's not allowing me to chekc it out. But it isn't telling anything.
So then I emtied the cart and added the blush attribute for which I had added 1 stock and when I went to checkout it came up with this error message:
Fatal error: Cannot redeclare class order in /home/cheechab/public_html/includes/classes/order.php on line 20
Obviously it has something to do line 20 on order.php which says this: class order extends base {
What's wrong with it?
Is there any functionality available to restock the attributes when an order is deleted? An option appears to restock, but only the stock of the article is set back to the right value and not in the attributes stock.
I think the general.php in admin\includes\functions need to be changed?
Kuroi, is this a functionality you would like to build in?
We are selling clothes and a lot of orders are returned (clothes do not always fit) and then it is a lot of work to restock it manually.
Regards,
Bram:smile:
Thanks Kuroi, that did it. I had left the original order.php file ther just renamed it order1.php. Sounds absurd but hey, such are these things sometimes.
I would like to simpy add a stock of 1 for each attribute defined for a product. Is there an easy way to do this without going through the admin screen, selecting each attribute, adding 1, submitting and then going to the next attribute?
Cheers.
Kuroi, can you give me a hand here?
I'm trying to modify the order history page, so that users can add the products from previous order back to cart.
The idea is to use the multiple add to cart form of Zen, then calculate the amount in stock of each products and draw an add-to-cart input form if the stock is available.
However, I'm having a hard time with the products that have attributes. In the orders_products table they are stored like this: id:attribute_string, ie:
19:1asdjaj1902ie9ajdaodj1092iasd
Do you have any idea how to know exactly which attribute id to get the stock?
Regards
@yellow1912
That can be done, though it's a bit complicated - no surprise there, I suspect.
Firstly, I don't believe that there's any encoding of attributes in the product_prid field used in order processing.
However there is a table dedicated to this, i.e. orders_products_attributes. Unfortunately it holds information frozen for display in the order history. It does this in case you change or delete your products after the order is completed. The customer will still be able to see details of what they purchased.
However, if you have changed or deleted a product, the customer would have a problem reloading it to their shopping cart anyway, so that's something you need to deal with, but not a show stopper.
So, your first step would be to work backwards from the products_options_values to get the relevant products_options_values_ids in the products_options_values table, then concatenate them as a common-separated string and search for that string in the stock_attributes field of the products_with_attributes_stock table.
If you find it all is fine. If you don't this could mean that the stock is being managed at product level, so you would need to check whether there are any other attribute combinations with stock for that product.
If there are, it would indicate that this attribute combination no longer exists for this product. If there are not, you would need to check whether there is a non-zero value for stock in the product table. If so, it would show that stock is being managed managed at the product level for this product.
I have installed this contribution and it works very well,
i have 2 questions.
i have a slight problem, on my test site i have a product which has around 10 attributes, some are in stock and some are out of stock,
when i go to the product on the cart as a customer, if i select one which is in stock on the drop down and click add to cart all is fine,
if i select one which is not in stock and then hit add to cart it goes to the cart and says out of stock which i guess i also fine,
however is it possible to update the page when each attribute is selected by the customer to display the add to cart or to display out of stock,
another way would be to have (In Stock) or (Out Of Stock) after the attribute name in the drop down.
are the above possible?
2nd question.
Is it possible to update more than one stock level at once, currently you have to select each product to update the stock level, is it possible to list the products to update all at once?
Thanks in advance
Rob
Ok i will have a good look through, sorry about that.
No problem. Tips - use the search this thread facility for localised searches. For the first question, search on "Grayson" or look in the Wiki, where I think there may be a link to the specific post from which to start. Also, for historic reasons, this mod has two support threads, so some of what you want may be covered in the other one too.
Thanks Kuroi, I think I get the basic ideas now:
1. first we need to get the attribute id by using the products_id, option name and value (we dont want to use option id here for a specific reason) from the orders_products_attributes table
2. then we need to check if the TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK exists (in case users are not using this mod), if it is we check if the stock info for that attribute is there. If not, we then assuming it is using the product stock instead.
3. the problem is with product associated with multiple attributes tho. Since my test site is not using any product with more than 1 attribute, I dont know how it is stored in TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK and orders_products_attributes tables.
Kuroi,
There is a problem with searching for the "string" as you suggested here:
"So, your first step would be to work backwards from the products_options_values to get the relevant products_options_values_ids in the products_options_values table, then concatenate them as a common-separated string and search for that string in the stock_attributes field of the products_with_attributes_stock table."
How would we get the exact order of the ids in the string? 19,29,30 and 29,19,30 contains the same ids but the string are different.
Ok, I had this fixed. But as I was checking on other stuff I went to my cart and hit the checkout button and got this error message again;
Fatal error: Cannot redeclare class order in /home/cheechab/public_html/includes/classes/order.php on line 20
However, I don't have any backed up order.php files in that folder now, just the one. I uploaded it fresh but it still does it.
Also, does the fix on post 46 work on ZC v.1.3.7.1 with this mod v.4.7? I need to figure out why when I try to add an attribute with 0 stock to the cart, no message comes up to say it's out of stock and if i go to checkout, the shopping cart page simply reloads.
The site I'm working on is http://www.cheechababy.com.au
Thank you.
hehe Thanks Kuroi, I had a couple more blasted things. Now the out of stock is working as well.
Have a good night,
Raquel.
Follow up:
This is the function I currently have to get product quantity:
Note: I used a function I have in my class to turn the result from db query into string, but if you want to make use of the function below you can easily use a loop to do so.
@Kuroi: can you have a look and tell me if there is anything wrong?
I used the option text name and value instead of the ids because I want to make sure that we either the stock of the exact product and attributes or nothing.
PHP Code:
<?php
function retrieve_attribute_stock_from_order($attribute_array,$products_id){
global $db;
// Lets assume that if table TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK is defined, then we are using the stock by attribute mod
// we can also query database to check if we want to
if(defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK')){
$sql_query = 'SELECT products_attributes_id FROM '.TABLE_PRODUCTS_ATTRIBUTES.' pa,'.TABLE_PRODUCTS_OPTIONS_VALUES.' ov,'.TABLE_PRODUCTS_OPTIONS.' o
WHERE ';
$condition_array = array();
if(count($attribute_array) == 0) return;
foreach($attribute_array as $attribute){
$condition_array[] = '(ov.products_options_values_name = \''.$attribute['value'].'\' AND o.products_options_name =\''.$attribute['option'].'\' AND pa.products_id = '.$products_id.' AND pa.options_id = o.products_options_id AND pa.options_values_id = ov.products_options_values_id)';
}
$sql_query .= implode(' OR ', $condition_array).' ORDER BY products_attributes_id';
$result = $db->Execute($sql_query);
$yobj = new yclass();
$attribute_string = $yobj->db_result_to_string(',',$result);
$get_quantity_query = 'SELECT quantity FROM ' . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . ' where products_id="' . $products_id . '" and stock_attributes="' . $attribute_string . '" LIMIT 1';
$quantity = $db->Execute($get_quantity_query);
if($quantity->RecordCount() == 1)
return $quantity->fields['quantity'];
}
// get products_quantity directly from products table
$get_quantity_query = 'SELECT products_quantity FROM ' . TABLE_PRODUCTS . ' where products_id="' . $products_id . '" LIMIT 1';
$quantity = $db->Execute($get_quantity_query);
if($quantity->RecordCount() == 1)
return $quantity->fields['products_quantity'];
else
return 0;
}
?>
The code will generate the broadly the right SQL, but I can see one potentially show stopping problem - but it's easily trapped.
Suppose you had a two attribute product where the attributes are size and color. A customer orders (XXXL, Red). (XXXL, Red) is withdrawn - no longer exists. But you still have (XXXL, White) and (XXXL, Black).
Executing your function against (XXXL, Red) will still return the product_attribute_id for XXXL. Your second query will take that as a parameter and, if the attribute stock for (XXXL, Red) has been removed, will return an array of stock quantities for (XXXL, Black) and (XXXL, White), neither of which you want.
You currently have a check that the record count is one, so your response to this situation would be to not return a false attribute stock result (which is good) but instead to drop through and return the overall product stock instead, which I suspect is bad (and a reason why I don't personally like code that relies on returns to control the logic).
Better would be to test earlier that the number of products_attributes_id returned matches the number of attributes in the original array and if not, deal with the exception at that point.
Thanks Kuroi, that does make sense. I added a simple checking to make sure that we get the number of attribute id we expected, if not then just return 0.
PHP Code:
<?php
function retrieve_attribute_stock_from_order($attribute_array,$products_id){
global $db;
// Lets assume that if table TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK is defined, then we are using the stock by attribute mod
// we can also query database to check if we want to
if(defined('TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK')){
$sql_query = 'SELECT products_attributes_id FROM '.TABLE_PRODUCTS_ATTRIBUTES.' pa,'.TABLE_PRODUCTS_OPTIONS_VALUES.' ov,'.TABLE_PRODUCTS_OPTIONS.' o
WHERE ';
$condition_array = array();
if(count($attribute_array) == 0) return;
foreach($attribute_array as $attribute){
$condition_array[] = '(ov.products_options_values_name = \''.$attribute['value'].'\' AND o.products_options_name =\''.$attribute['option'].'\' AND pa.products_id = '.$products_id.' AND pa.options_id = o.products_options_id AND pa.options_values_id = ov.products_options_values_id)';
}
$sql_query .= implode(' OR ', $condition_array).' ORDER BY products_attributes_id';
$result = $db->Execute($sql_query);
if($result->RecordCount() != count($attribute_array))
return 0;
$yobj = new yclass();
$attribute_string = $yobj->db_result_to_string(',',$result);
$get_quantity_query = 'SELECT quantity FROM ' . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . ' where products_id="' . $products_id . '" and stock_attributes="' . $attribute_string . '" LIMIT 1';
$quantity = $db->Execute($get_quantity_query);
if($quantity->RecordCount() == 1)
return $quantity->fields['quantity'];
}
// get products_quantity directly from products table
$get_quantity_query = 'SELECT products_quantity FROM ' . TABLE_PRODUCTS . ' where products_id="' . $products_id . '" LIMIT 1';
$quantity = $db->Execute($get_quantity_query);
if($quantity->RecordCount() == 1)
return $quantity->fields['products_quantity'];
else
return 0;
}
?>
Happy to find this module, but as a TOTAL NEWBIE :shocking: :blush: I am confused by the installation instructions.
1. I see no folders to rename to my template??
2. Your wiki instructions say to drop the admin and includes directories into the root directory of your site. BUT the files extracted to a directory: CART. Where exactly do we upload and/or overwrite each directory for this plugin? (Will dropping the 'cart' directory distribute itself to where it needs to go on its own? -- I use WS_FTP Pro)
THANK YOU!!
Hmmm ... Thanks. That must be the problem. I downloaded "stockAttribute3.0.1.1"
Any chance there's a link to the RIGHT one from this thread?
Meanwhile, I'll go try to find the one I downloaded ... :oops:
EDIT: Here's the file I downloaded: stockattribute_by_danielcor_3.01.1.zip
NEVERMIND ... I've now downloaded YOUR Stock by Attributes and will see how that goes. (Any clue how to UNinstall the SQL Patch I installed for the wrong one?) Thanks
Yikes!!!!!!
I really really messed up now :cry: DROPPED the table "products_with_attributes_stock" but now cannot re-create without the error above.Code:1062 Duplicate entry 'STOCK_SHOW_LOW_IN_CART' for key 2
in:
[INSERT INTO zen_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')," );]
Pefect, thank you so much! I'm installed and all is working well so far :)
Kuroi,
I was hoping you can help me with my issue. I'm running ZC 1.3.7 and installed the correct version of Stock by Attribute.
My issue is that when I add a variant for any product...it shows up fine in the product display info page, but when it is "added to cart" it shows as out of stock. I have show stock available set to true....and it will say "Stock Available: 0". Any ideas how I can fix this?
Thanks.
As you've eliminated the possibility of a mismatch between your version of Stock by Attributes and your version of Zen Cart, these types of problems always come down to 1) installation problems (usually files that didn't get properly uploaded) or 2) the presence of files that shouldn't be there (usually renamed versions of the files over-written being kept in their original folders just-in-case, and in practise getting in the way).
I checked the includes/classes/order.php file and line 8 says "@version $Id: order.php 0000 2007-09-19 00:00:00Z kuroi $". Also, I don't have any *.bak files in the same folders as my testing site...so that's odd...I'll keep trying. Thanks.
hi...I am new to all this zencart stuff and I am sure there is an answer to my question somewhere but I am buggered if I can find it. I have installed the stock by attributes module and it all works fine. I then added the modifications by Grayson and now I have issues. I have some items on my site that are made to order but have attributes namely size and colour. I do not want to set individual stock levels for every possible variable as that would create a very ugly looking page. What I had was radio boxes for people to select the colour and another set of radio boxes for the size. When I added Graysons addon I lost all my boxes so now nothing appears on the page for that item. Is there any way to get thhem back without having to fill in stock for every combo? I hope that makes sense?
Any help appreciated!
cheers
Melanie
Can I eliminate this type of problem:
If I change forexamble price for one product with several atributes (11 sizes with 4 prices) and copy new properties to another product with same atributes PWA_VARIANTS are missing.
Only ":" is shown. In product data total stock is shown but shopping cart shows that product is sold out.
If I want, how can I remove "Stock by Attributes v4.7" from ZenCart?
@melbel
I've never implemented the "Grayson solution", but seem to remember that it was designed for situations where there was only one attribute.
@Lampivimpa
Copying of attributes to another product is done by core code which knows nothing about stock by attributes which is an add-on. Whether this will change in Zen Cart 1.4 when stock by attributes is absorbed into core code, I don't know. It's possible that the developers may take the view that a desire to manage stock at the attribute level doesn't automatically imply the same desire for the new product.
The mod can be uninstalled at several different levels. This is explained here.
Hi
I hope you can help me. I'm having a hard time getting stock by attributes to run.
I'm using zen cart 1.3.8 and I'm trying to install v4.7.
I think I've created the sql patch because when I try to do it now I get a duplication error (1062, like the one in previous posts).
I've transferred the files to my home directory, I think that's my root directory. When I was uploading them I had to override a bunch of files, so I thought I finally had it, but no.
I've read the readme instructions and the detailed instructions on this thread in post #113.
I just can't seem to get it working. Any ideas?
Thanks
@kuroi
i really appreciate this mod and currently using it on my site. is there any conflict on it with mod dual pricing / wholesale pricing?
a thread on the prob i encountered is found here: http://www.zen-cart.com/forum/showth...t=dual+pricing
thankz!
I'm having a the same problem where my admin settings are set to "false" for allow checkout. but customers are able to checkout. at the shopping cart customers are correctly informed about how many items are in stock for the item with the specific attribute, if they try to order more than available, but they can still checkout.
I really doubt i have any backup files, but where would they be and what files are typically backed up?
I have reinstalled all the files using filezilla, 1st I originally used windows explorer. So that shouldn't be the issue.
I'm using a custom template, and the paypal module.
my issue is that my wholesale pricing is NOT working when the product is priced by attributes.
i restored my previous database and remove the files for Stock by Attributes and there it works. please help me solve this. i need to use Stock by Attributes with Wholesale pricing mods simultaneously.
adoy
SIgh, I made it to page 14 of this thread. I even double checked the baby steps on page 12. I'm 99.9% sure I have uploaded all files to relevant folders. Yes the mod is still not showing up under the catelog menu.
I'm at a complete loss with this one. I've reuploaded several times to the point that it keeps popping up the "this file already exists do you want to overwrite it?" .
Still nothing. I've had success with another mod so I'm confused as to why I can't get this one running. And I really need it.
Which is the file, and where should it be, the file that actually tells the menu option to show up? Perhaps that will give me a clue as to a file I missed.
Otherwise, does anyone have any ideas where I'm going wrong?
Nevermind, I seem to say that alot here :-) This is what happened. I was using Filezilla to upload the files. Filezilla was NOT overwriting the files as I commanded. I noticed when the file I was trying to upload, one that should overwrite another one, was a larger filesize than the corresponding one. And when it said the upload was successful, the file size uploaded hadn't changed to the new filesize. I had to DELETE each of the existing files and upload the Stock By Attribute file, fresh as it were.
I'm taking the rest of the night off!
Cynthia
http://www.wireyourworld.com
Your description of the need to over-write files and the duplication error when you try to re-apply the patch all sound like what I would expect from a correct installation.
Did you have to over-ride the files the first time you uploaded them?
Could you be more specific about what symptoms you are seeing that make you believe that it's not working?
I've never used dual pricing, but a quick look at the code suggests no overlap between the code for that mod and the code for stock by attributes and therefore no reason why they shouldn't work together.
It wouldn't however surprise me if there was clash between dual pricing and pricing by attributes where it would be easy to see how the code might overlap.
Does you customer template over-ride any of the files in the stock by attributes mod?
Spurious backup files are usually created by well-intentioned Zen Cart users who don't realise what they are doing, so it's not possible to tell you where they might be, but it doesn't sound as though you have made any.
Hi Cynthia
Thanks for posting back about this. Problems uploading and/or successfully over writing files is by far the biggest reason why this mod sometimes appears not to work.
In the days when I was still prepared to have a look at sites where it wasn't working, some 80-90% had this problem, even when their owners were convinced that they had uploaded the files correctly. So congratulations to you for being eagled-eyed enough to spot and correct the problem yourself.
You're welcome! Surprising I noticed it today given my lack of sleep. Sheer determination (or stubborness). IMO this potential situation of uploading might be a good note to add to your readme. As well as those baby steps on page 12, I thought I did it right but it was nice to see it confirmed by your post there. :-) I too didn't know what the heck to do with the sql, I just guessed (correctly fortunately).
Cynthia
Thank you so much for replying! The first time I tried to upload the files, I put the whole thing in my public_html as its own folder. Then I put the files into the main folders of the site. It still didn't work. So I went back and upload the individual files into the admin and includes files of my public_html and emptied the separate Stock by attributes file.
I now have Products with Attribute Stock at the bottom of the Admin>Catalog drop down menu. YAAAAHH! And I can enter the amounts.
However, I don't see the Show Stock when Low line under Configuration>Stock.
Customers are not informed as to how much stock is left if they request more than is available and they are able to checkout even though we don't have the stock.
In Configuration>Stock my settings are
Check stock level True
Subtract Stock True
Allow Checkout False
I'm sorry if you've answered this problem before. After about post #150 my eyes started to glaze over:shocking:
Thanks again for any help!
@2PT
Try cutting, pasting and executing just this bit into your Admin > Tools > Install SQL Patches page. I don't expect it to be a complete solution, but it may help your forward a step and give clues as to what the issue is.
Quote:
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'),"
);
Re: 2PT In Configuration>Stock Mine says "Show available stock level in cart when less than order". is that the same thing?
I would like to take a moment to reflect on the concept of restocking a deleted order:
I thought this would be a wonderful idea (even though 1.4 is going to implement inventory based on attributes, there are folks out there who need / want it now).
It all lies in the /admin/includes/functions/general.php (and please correct me if I missed or overlooked something)
Very simply, in the function zen_remove_order replace, the declaration line with this
In the function, in the check for $restock, add this check:PHP Code:
function zen_remove_order($order_id, $restock = false, $stock_by_attribute = false) {
PHP Code:
if($stock_by_attribute == 'on')
{
$order_stock_by_att = $db->Execute("select op.products_id, op.products_quantity,
opa.products_options_id, opa.products_options_values_id
from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa
where op.orders_id = '" . (int)$order_id . "'
AND opa.orders_id = op.orders_id ");
$options_id = $order_stock_by_att->fields['products_options_id'];
$options_values_id = $order_stock_by_att->fields['products_options_values_id'];
$prod_id = $order_stock_by_att->fields['products_id'];
while(!$order_stock_by_att->EOF){
$attribute_stock_sql = "select pas.stock_id from " .
TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas, ". TABLE_PRODUCTS_ATTRIBUTES ." pa
where pa.options_id = '$options_id'
and pa.options_values_id = '$options_values_id'
and pa.products_attributes_id = pas.stock_attributes
and pas.products_id = '$prod_id' ";
$attribute_stock = $db->Execute($attribute_stock_sql);
$db->Execute("update ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " set
quantity = quantity + " .$order_stock_by_att->fields['products_quantity'] . "
where stock_id = '".$attribute_stock->fields['stock_id']."'");
$order_stock_by_att->MoveNext();
}
}
The final function should look something like this:
PHP Code:
function zen_remove_order($order_id, $restock = false, $stock_by_attribute = false) {
global $db;
if ($restock == 'on') {
$order = $db->Execute("select products_id, products_quantity
from " . TABLE_ORDERS_PRODUCTS . "
where orders_id = '" . (int)$order_id . "'");
while (!$order->EOF) {
$db->Execute("update " . TABLE_PRODUCTS . "
set products_quantity = products_quantity + " . $order->fields['products_quantity'] . ", products_ordered = products_ordered - " . $order->fields['products_quantity'] . " where products_id = '" . (int)$order->fields['products_id'] . "'");
$order->MoveNext();
}
if($stock_by_attribute == 'on')
{
$order_stock_by_att = $db->Execute("select op.products_id, op.products_quantity,
opa.products_options_id, opa.products_options_values_id
from " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " opa
where op.orders_id = '" . (int)$order_id . "'
AND opa.orders_id = op.orders_id ");
$temp_string = "";
$options_id = $order_stock_by_att->fields['products_options_id'];
$options_values_id = $order_stock_by_att->fields['products_options_values_id'];
$prod_id = $order_stock_by_att->fields['products_id'];
while(!$order_stock_by_att->EOF){
$attribute_stock_sql = "select pas.stock_id from " .
TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pas, ". TABLE_PRODUCTS_ATTRIBUTES ." pa
where pa.options_id = '$options_id'
and pa.options_values_id = '$options_values_id'
and pa.products_attributes_id = pas.stock_attributes
and pas.products_id = '$prod_id' ";
$attribute_stock = $db->Execute($attribute_stock_sql);
$db->Execute("update ".TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " set
quantity = quantity + " .$order_stock_by_att->fields['products_quantity'] . "
where stock_id = '".$attribute_stock->fields['stock_id']."'");
$order_stock_by_att->MoveNext();
}
}
}
$db->Execute("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
$db->Execute("delete from " . TABLE_ORDERS_PRODUCTS . "
where orders_id = '" . (int)$order_id . "'");
$db->Execute("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . "
where orders_id = '" . (int)$order_id . "'");
$db->Execute("delete from " . TABLE_ORDERS_STATUS_HISTORY . "
where orders_id = '" . (int)$order_id . "'");
$db->Execute("delete from " . TABLE_ORDERS_TOTAL . "
where orders_id = '" . (int)$order_id . "'");
}
Ok, now that the function itself has been modified to adapt to what we need, we need to change the necessary calls to allow the new features to be activated.
For me (most of my clients use Super Orders in their zen carts), I modify the /admin/super_orders.php file. Default orders page is the /admin/orders.php file.
Look for the call ofand change that toPHP Code:
zen_remove_order($oID,$_POST['restock']);
PHP Code:
zen_remove_order($oID, $_POST['restock'],$_POST['restock']);
I hope this helps, I tested it a few times, but not thoroughly.
I've installed the add-on with no problem, but I kept getting this error:
146 Table '[...]TABLE_PRODUCTS_STOCK' doesn't exist
in:
[select quantity from TABLE_PRODUCTS_STOCK where products_id = '18' AND quantity > 0]
I tried following the instructions given to someone else who had the same problem, but nothing I do on the stocks page seems to change the outcome--I still keep getting the error.
I'm running Zen Cart 1.3.8...
This add-on is exactly what I need, but I can't figure out what's causing this problem. I tried uninstalling everything related to the mod (I'm not sure if I did a clean job, overwrote files, dropped the relevant tables in the database), and the problem persists.
Any advice?
Thanks!
I am having trouble at confirm checkout.
My customers get a message:
1146 Table 'shazzas_clothes08.sc_products_ratio' doesn't exist
in:
[SELECT ratio FROM sc_products_ratio WHERE products_id=116 LIMIT 1]
Orders are sent but stock isn't getting adjusted
Is there anything I can do to fix this as they keep clicking which dup orders
Any help will be appreciated./
Using Zen Cart 3.8
Follow up from my previous message
I think I need to run the SQL file again to fix the tables.
If I do will it detele all my attributes I have already done?
Or is there another workaround?
Thanks in Advanced
John
I'm not sure if this is possible or if the contrib. - would be relevant, but thought it would not hurt to post and ask - I have a shoe store - I have basically one attribute - size/width - Is it possible that if the distributor tells me let's say size 8M is out of stock but will be back in stock on 5/1/2008 - is it possible to set an date of availability for just that attribute?
Neither this version of Stock by Attributes nor Zen Cart's core code have a products_stock table or define a constant TABLE_PRODUCTS_STOCKS. It looks as though you must have some code floating around from another mod. Though I'm afraid that I don't know which one it might be.
@ ausjohn
I think we may have covered this in another thread, but just in case ...
products_ratio is not a stock by attributes table, so you must be using another mod, either in place of S by A, or alongside it, and the problem lies with the installation of that mod.
To answer your question above. Were you to re-run the S by A SQL it would not delete your attributes, but would most likely delete any stock records that you have created from those attributes.