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

Results 501 to 520 of 3,609
4 Sep 2008, 2:51 AM
#501
stevehare avatar

stevehare

Zen Follower

Join Date:
Dec 2005
Posts:
108
Plugin Contributions:
0

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

Is there an issue using this mod with multiple attributes?

For instance, I have a product with color and size attributes. I have added 100 stock for each attribute and the product display shows 2800 in stock.

But, the dropdown menus for each attribute are empty. (Yes, I did add the attributes in the attribute controller).

4 Sep 2008, 10:00 PM
#502
jsu1972 avatar

jsu1972

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

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

Hi there...I have read the forum and only saw one reference to my problem and no resolution. The problem that i'm having is that when I go to the "Products with Attributes Stock" screen under "catalog" and try to "Add Quantity for Product Variat" I get the following error is I select "All" from each attribute:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/dance/zen/zencart/admin/products_with_attributes_stock.php:193) in /var/www/dance/zen/zencart/admin/includes/functions/general.php on line 21

If I add them one by one by selecting the different combinations then i don't get any errors.

If i just click the back button after the error and refresh it looks like it works fine, but there seems to be a problem because it doesn't allow you to see the stock correctly (i'm using the dynamic dropdowns addon also)

I did a small test by adding one manually and then using the add all. then I had a look in the mysql table "products_with_attributes_stock". There is difference in how the attributes are added to the entry in the mysql table for the field "stock_attributes". For the one added manually with no errors and works properly with dynamic dropdowns, the attributes are in the following order: attribute 1, attribute 2, attribute 3, attribute 4. For the ones added by "all" in each attribute the order is: attribute 2, attribute 3, attribute 1, attribute 4. If i manually edit the entry in the table to put attribute 1 first then it works again. So it seems that the function that is adding the attributes for all combinations is putting them in the wrong order. Is there a fix for this?

John

6 Sep 2008, 6:16 PM
#503
oakwood avatar

oakwood

New Zenner

Join Date:
May 2008
Posts:
85
Plugin Contributions:
0

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

kuroi:

No from within Zen Cart. For a mass add you would need to structure and upload the information directly to the database.

ok kuroi - I took the plunge and started messing around with my database, but I'm a little stuck with this.

I exported the products_with_attributes_stock table from my database and took a look. I setup a test with two products with the same attribute combinations. Here was the results -
VALUES
(26, 1, '2,5,10', 100),
(27, 4, '20,24,26', 1000);

Each of the attributes are exactly the same (except stock) but there is a completely different combination of numbers to represent the combination.

Now say for product 1, if I add another set of attributes but only change one instance (say style) I would get something like '3,5,10' which makes total sense. But what I dont understand is how the numbers get their values for the other product numbers. Is there some sort of mathematical formula that correlates '2,5,10' equaling '20,24,26'?

If I try to run (through sql) say (28, 5, '2,5,10' 100) it says duplicate entry - making this mass add kinda difficult.

thx:smile:

8 Sep 2008, 5:46 PM
#504
jsu1972 avatar

jsu1972

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

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

Oakwood:

ok kuroi - I took the plunge and started messing around with my database, but I'm a little stuck with this.

I exported the products_with_attributes_stock table from my database and took a look. I setup a test with two products with the same attribute combinations. Here was the results -
VALUES
(26, 1, '2,5,10', 100),
(27, 4, '20,24,26', 1000);

Each of the attributes are exactly the same (except stock) but there is a completely different combination of numbers to represent the combination.

Now say for product 1, if I add another set of attributes but only change one instance (say style) I would get something like '3,5,10' which makes total sense. But what I dont understand is how the numbers get their values for the other product numbers. Is there some sort of mathematical formula that correlates '2,5,10' equaling '20,24,26'?

If I try to run (through sql) say (28, 5, '2,5,10' 100) it says duplicate entry - making this mass add kinda difficult.

thx:smile:

I'm kinda new to zencart and this addon but i think i know the answer to your question. while the attribute might be the same when you add it to a product it gets another id. you can find these id's in the "products_attributes" table. you'll see that the attribute has an ID and it has a new ID each time it's associated with a product.

8 Sep 2008, 5:59 PM
#505
jsu1972 avatar

jsu1972

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

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

jsu1972:

Hi there...I have read the forum and only saw one reference to my problem and no resolution. The problem that i'm having is that when I go to the "Products with Attributes Stock" screen under "catalog" and try to "Add Quantity for Product Variat" I get the following error is I select "All" from each attribute:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/dance/zen/zencart/admin/products_with_attributes_stock.php:193) in /var/www/dance/zen/zencart/admin/includes/functions/general.php on line 21

If I add them one by one by selecting the different combinations then i don't get any errors.

If i just click the back button after the error and refresh it looks like it works fine, but there seems to be a problem because it doesn't allow you to see the stock correctly (i'm using the dynamic dropdowns addon also)

I did a small test by adding one manually and then using the add all. then I had a look in the mysql table "products_with_attributes_stock". There is difference in how the attributes are added to the entry in the mysql table for the field "stock_attributes". For the one added manually with no errors and works properly with dynamic dropdowns, the attributes are in the following order: attribute 1, attribute 2, attribute 3, attribute 4. For the ones added by "all" in each attribute the order is: attribute 2, attribute 3, attribute 1, attribute 4. If i manually edit the entry in the table to put attribute 1 first then it works again. So it seems that the function that is adding the attributes for all combinations is putting them in the wrong order. Is there a fix for this?

John

Ok so i see from another post the correction to the error I was getting. I removed the line and that works fine now. However I am still having problems with the attribute order while using the multiadd. The values are in the wrong order. I have the dynamic dropdown code also installed and when the values are in a different order the dropdowns don't work. Is there a way to make the multiadd put the attributes in the same order as a single add?

9 Sep 2008, 1:52 AM
#506
oakwood avatar

oakwood

New Zenner

Join Date:
May 2008
Posts:
85
Plugin Contributions:
0

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

jsu1972:

I'm kinda new to zencart and this addon but i think i know the answer to your question. while the attribute might be the same when you add it to a product it gets another id. you can find these id's in the "products_attributes" table. you'll see that the attribute has an ID and it has a new ID each time it's associated with a product.

Nope, that doesn't say what the new values will be on an individual product level.

I'd be really happy if I could even add, for example:
style - men's
size - small
color - green, red, blue, black, tan
like that all at once from the admin or otherwise. This mod is essential but it takes FOREVER if you have say a possible of 300 different combinations of attributes per product!

Again, in my case the actual stock is not important, just how it incorporates with dynamic drop downs to create dependent attributes is vital.

If anybody has any clues on how to speed up the process please post! I even but something in the commercial help but no luck so far. :(

Still...great mod though!

9 Sep 2008, 2:42 PM
#507
jsu1972 avatar

jsu1972

New Zenner

Join Date:
Aug 2008
Posts:
6
Plugin Contributions:
0

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

jsu1972:

Ok so i see from another post the correction to the error I was getting. I removed the line and that works fine now. However I am still having problems with the attribute order while using the multiadd. The values are in the wrong order. I have the dynamic dropdown code also installed and when the values are in a different order the dropdowns don't work. Is there a way to make the multiadd put the attributes in the same order as a single add?

did you open and look at the table called "products_attributes". if you look in the table you will see the attributes for your products...in your post before the last one you asked if there is a mathmatical formula that correlates one set of attributes to another. there is no formula...there is this table. so to "predict" what the values should be, look in this table for the product_id you want...then find the option_id's for the options you want to add...and then you can lookup their product_attributes_id and put it in the stock_attributes column on the products_with_attributes_stock table.

9 Sep 2008, 6:58 PM
#508
oakwood avatar

oakwood

New Zenner

Join Date:
May 2008
Posts:
85
Plugin Contributions:
0

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

jsu1972:

did you open and look at the table called "products_attributes". if you look in the table you will see the attributes for your products...in your post before the last one you asked if there is a mathmatical formula that correlates one set of attributes to another. there is no formula...there is this table. so to "predict" what the values should be, look in this table for the product_id you want...then find the option_id's for the options you want to add...and then you can lookup their product_attributes_id and put it in the stock_attributes column on the products_with_attributes_stock table.

ok - now I see what your saying. :cool:

10 Sep 2008, 12:59 AM
#509
oakwood avatar

oakwood

New Zenner

Join Date:
May 2008
Posts:
85
Plugin Contributions:
0

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

Well let me take that back...It just doesn't seem to work for me like it should when I pick the attributes from that table. I can cleary identify them, write them in and wallah, there they are in the admin...but not on the product page. The stock_attributes numbers are different from product to product but not repesented that way on the product_attributes table. It seems when attributes are added to a different product, zen cart picks up where it left off so to speak. So if the largest value of an option was say 40 for my first product, the smallest value of an option would be 41 for my second product. Hope that made sense.

11 Sep 2008, 6:50 AM
#510
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

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

So I've used this contrib before with ABSOLUTELY no issues.. However, I am working on a site that we are using the Super Orders contrib.. I haven't seen much specifically in this thread or the Super Orders support thread which talks about these two contribs together. So my question is this: can these two contribs play nice together? I am assuming they can with some edits to the orders.php and or super_orders.php files.. Some advice/information would be very much appreciated..

16 Sep 2008, 1:38 PM
#511
eclecticbaby avatar

eclecticbaby

New Zenner

Join Date:
Sep 2008
Posts:
3
Plugin Contributions:
0

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

I'm hoping someone can help me. I have tried to install v4.7 of this addon and I'm getting an error message when I click on catalog->products with attributes stock It comes up with this message

Warning: main(includes/classes/products_with_attributes_stock.php) [function.main]: failed to open stream: No such file or directory in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Warning: main(includes/classes/products_with_attributes_stock.php) [function.main]: failed to open stream: No such file or directory in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Warning: main(includes/classes/products_with_attributes_stock.php) [function.main]: failed to open stream: No such file or directory in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Fatal error: main() [function.require]: Failed opening required 'includes/classes/products_with_attributes_stock.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Can someone please help me fix this????

Thanks
Emma

16 Sep 2008, 3:22 PM
#512
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

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

eclecticbaby:

I'm hoping someone can help me. I have tried to install v4.7 of this addon and I'm getting an error message when I click on catalog->products with attributes stock It comes up with this message

Warning: main(includes/classes/products_with_attributes_stock.php) [function.main]: failed to open stream: No such file or directory in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Warning: main(includes/classes/products_with_attributes_stock.php) [function.main]: failed to open stream: No such file or directory in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Warning: main(includes/classes/products_with_attributes_stock.php) [function.main]: failed to open stream: No such file or directory in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Fatal error: main() [function.require]: Failed opening required 'includes/classes/products_with_attributes_stock.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eclectic/public_html/store/admin/products_with_attributes_stock.php on line 12

Can someone please help me fix this????

Thanks
Emma I could be wrong, but the error message seems to indicate a file is missing/damaged from your install of this contrib. Did you check whether or not "products_with_attributes_stock.php" is located in your
"home/eclectic/public_html/store/admin" directory??

16 Sep 2008, 11:22 PM
#513
eclecticbaby avatar

eclecticbaby

New Zenner

Join Date:
Sep 2008
Posts:
3
Plugin Contributions:
0

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

Hi,

Yes the "products_with_attributes_stock.php" is located in that directory.

16 Sep 2008, 11:34 PM
#514
eclecticbaby avatar

eclecticbaby

New Zenner

Join Date:
Sep 2008
Posts:
3
Plugin Contributions:
0

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

I've figured it out, thanks for you help DivaVocals

2 Oct 2008, 11:53 AM
#515
heathenmagic avatar

heathenmagic

Totally Zenned

Join Date:
May 2005
Location:
England
Posts:
730
Plugin Contributions:
0

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

Hello there,

I too was stuggling to get this modification working, so that customers can see what is in stock for each attribute. I am grateful for any reply or help. I made the changes to includes/modules/attributes.php

JUST FOUND IT!!!!!

Make sure to edit the attributes.php in your override folder. Then change option name to Radio and it works!!!

Hope this helps somebody out there!!!

Here's an addition that will display the actual stock amounts for each attribute next to the attribute name. You can see it in action on this product in my store.

Open includes/modules/pages/product_info/main_template_vars_attributes.php and make the following changes:
Replace
Code:
$sql = "select pov.products_options_values_id,
pov.products_options_values_name,
pa.*
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$order_by;
by
Code:
$sql = "select pov.products_options_values_id,
pov.products_options_values_name,
pwas.quantity,
pa.*
from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
where pa.products_id = '" . (int)$_GET['products_id'] . "'
and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "'
and pa.options_values_id = pov.products_options_values_id
and pwas.stock_attributes = pa.products_attributes_id
and pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
$order_by;
Next, in that same file replace:
Code:
if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO or $products_options->RecordCount() == 1 or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
$products_options_value_id = $products_options->fields['products_options_values_id'];
if ($products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_TEXT and $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_FILE) {
$products_options_details = $products_options->fields['products_options_values_name'];
} else {
// don't show option value name on TEXT or filename
$products_options_details = '';
}
if ($products_options_names->fields['products_options_images_style'] >= 3) {
$products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
$products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
} else {
$products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
$products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
}
}
by
Code:
if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_CHECKBOX or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_RADIO or $products_options->RecordCount() == 1 or $products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
$products_options_value_id = $products_options->fields['products_options_values_id'];
if ($products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_TEXT and $products_options_names->fields['products_options_type'] != PRODUCTS_OPTIONS_TYPE_FILE) {
// $products_options_details = $products_options->fields['products_options_values_name'];
// gbm - replaced original line above to display attribute stock amount beside attribute
$products_options_details = $products_options->fields['products_options_values_name'] . ' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . ']';
} else {
// don't show option value name on TEXT or filename
$products_options_details = '';
}
if ($products_options_names->fields['products_options_images_style'] >= 3) {
$products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
// $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
// gbm - replaced original line above to display attribute stock amount beside attribute
$products_options_details_noname = ' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . '] ' . $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '<br />' . $products_options_display_weight : '');
} else {
$products_options_details .= $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
// $products_options_details_noname = $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
// gbm - replaced original line above to display attribute stock amount beside attribute
$products_options_details_noname = ' [' . $products_options->fields['quantity'] . ' '. TEXT_ATTRIBUTES_PIECES . '] ' . $products_options_display_price . ($products_options->fields['products_attributes_weight'] != 0 ? '' . $products_options_display_weight : '');
}
}
Then open includes/languages/english/your_template/product_info.php and add the following line:
Code:
define('TEXT_ATTRIBUTES_PIECES','pieces');
Repeat for all languages in your store.

3 Oct 2008, 11:35 AM
#516
xxdrag0nxx avatar

xxdrag0nxx

New Zenner

Join Date:
May 2008
Posts:
98
Plugin Contributions:
0

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

Hi guys,

Anyone using stock by attributes with the product cost price module?

Does it work together?

10 Oct 2008, 1:47 PM
#517
imfsub12 avatar

imfsub12

Zen Follower

Join Date:
Aug 2008
Location:
Halifax, NS
Posts:
274
Plugin Contributions:
0

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

yes i listed this one in a differn't form - but i though i put it here (yes i know double adding) but this is the right place for it..

Ok just trying to add this mod to my site..

Stock by Attributes v4.7a

And they are telling me if i have a prfix such as "zen_" i have to fix the .sql up.. HOW do i do this as this is my config file...

/ define our database connection
  define('DB_TYPE', 'mysql');
  define('DB_PREFIX', 'zen_');
CREATE TABLE products_with_attributes_stock (
        stock_id INT NOT NULL AUTO_INCREMENT ,
        products_id INT NOT NULL ,
        stock_attributes VARCHAR( 255 ) NOT NULL ,
        quantity FLOAT NOT NULL ,
        PRIMARY KEY ( `stock_id` )
        );

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'),"
       );

Do I just install the sql update.. or do i have to modify it??? as everyother mod i did i didn't have to add antying to the mod??

ME LOST and not a great data baser.... thanks...

:flex:

11 Oct 2008, 9:17 PM
#518
playfuldays avatar

playfuldays

New Zenner

Join Date:
Sep 2008
Posts:
2
Plugin Contributions:
0

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

I don't much want to install any add-ons but will if I have to! I have version : 1.3.8a and I want to have different quantities for my attributes on my sunhats anyway of doing this without installing this add-on????

Thanks.
Newbie!:shocking:

11 Oct 2008, 11:15 PM
#519
ldop avatar

ldop

New Zenner

Join Date:
Oct 2008
Posts:
3
Plugin Contributions:
0

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

Hello.
I have a problem that after installing Stock by Attributes of version 4.7 (also in 4.6) in Zencart version 1.3.7.1 I got an error message during order process. The message is:

Fatal error: Cannot redeclare class order in /home/www/slune.eu/subdomeny/www/includes/classes/order.php on line 1069

Can you give a hint where can be the problem? I guess that the problem can be some conflict with some other contribution. I have the following add-ons installed: Printable Pricelist, Edit Orders, Easy Populate, Image Handler.

12 Oct 2008, 5:55 PM
#520
naturalolive avatar

naturalolive

New Zenner

Join Date:
Aug 2006
Posts:
19
Plugin Contributions:
0

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

Hi there,

I too, am having a problem. I am running 1.3.6 and have just added a product with 6 attribute variables.

http://www.naturalpod.com/shop/index.php?main_page=product_info&cPath=65&products_id=926

Each attribute has approx 6-7 options. Does someone know a fast way to set the quantity to say 999 for each variable. The amount of combinations/permutations to do it one by one would take forever.

tia.

A.