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

Results 1,581 to 1,600 of 3,609
7 Sep 2012, 1:01 AM
#1581
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

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

Custom code.
So, you trace that back to figure out why the $attributes array was empty.

Chances are some query or criteria or selection in however you set up your attributes ... failed.

Keep following the trail until you find the solution.

7 Sep 2012, 1:10 AM
#1582
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

$attributes = $db->Execute($attributes_query);

/home/nothingb/public_html/includes/functions/functions_lookups.php

Line #420 : $attributes_query = "select pa.products_attributes_id

Line #425 : $attributes_query = "select pa.products_attributes_id

Line #430 : $attributes = $db->Execute($attributes_query);

Line #444 : $attributes_query = "select sum(options_values_price) as total

Line #448 : $attributes = $db->Execute($attributes_query);

Anything here??

7 Sep 2012, 1:12 AM
#1583
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

All searches for $db

come up

$db = new queryFactory();

7 Sep 2012, 1:16 AM
#1584
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

Is the problem in here?

Line #444 : $attributes_query = "select sum(options_values_price) as total

7 Sep 2012, 1:26 AM
#1585
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

A snippit from this section that has $attributes_query

/*

  • Check if product has attributes
    */
    function zen_has_product_attributes($products_id, $not_readonly = 'true') {
    global $db;

    if (PRODUCTS_OPTIONS_TYPE_READONLY_IGNORED == '1' and $not_readonly == 'true') {
    // don't include READONLY attributes to determin if attributes must be selected to add to cart
    $attributes_query = "select pa.products_attributes_id
    from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_OPTIONS . " po on pa.options_id = po.products_options_id
    where pa.products_id = '" . (int)$products_id . "' and po.products_options_type != '" . PRODUCTS_OPTIONS_TYPE_READONLY . "' limit 1";
    } else {
    // regardless of READONLY attributes no add to cart buttons
    $attributes_query = "select pa.products_attributes_id
    from " . TABLE_PRODUCTS_ATTRIBUTES . " pa
    where pa.products_id = '" . (int)$products_id . "' limit 1";
    }

    $attributes = $db->Execute($attributes_query);

    if ($attributes->recordCount() > 0 && $attributes->fields['products_attributes_id'] > 0) {
    return true;
    } else {
    return false;
    }
    }

/*

  • Check if product has attributes values
    */
    function zen_has_product_attributes_values($products_id) {
    global $db;
    $attributes_query = "select sum(options_values_price) as total
    from " . TABLE_PRODUCTS_ATTRIBUTES . "
    where products_id = '" . (int)$products_id . "'";

    $attributes = $db->Execute($attributes_query);

    if ($attributes->fields['total'] != 0) {
    return true;
    } else {
    return false;
    }
    }

7 Sep 2012, 1:36 AM
#1586
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

Sadly... I am trying... But not sure what I am doing...

8 Sep 2012, 3:28 AM
#1587
robophung avatar

robophung

New Zenner

Join Date:
Jan 2011
Posts:
66
Plugin Contributions:
0

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

milobloom:

Sadly... I am trying... But not sure what I am doing...

Can you provide more details?

What specific variation of SBA did you install? I'm assuming you're on ZC 1.3.9h or older version?

Did you modify any code in the files from the SBA addon module? Or did you install perhaps other addon modules that may have overwritten files related to the SBA addon instead of properly merging the code?

You linked a specific product in your post, is this product the cause of the error? Can you be more specific about how the error is triggered?

What exactly are you doing in the ZC admin that causes that error to be displayed, and does this error only happen with a few specific products, or does it happen to all of your products?

Based on the assumption that you did not modify any of the SBA code, and you did not install other addons that may have overwritten SBA code...

Then the problem as Dr. Byte pointed out is that your $attributes array is coming up as empty, and the reason is not because of an error in the code, but an error in how you may have programmed your product's attributes.

Looking at the specific product that you linked, I noticed that it was not assigned any specific attributes. It appears as if most of your toddler items are assigned either the 0-6m attribute or the 6-12m attribute, except this one. Does the problem persist if you assign it a specific attribute? Or is the error what's actually preventing you from adding specific attributes to this product?

Need all these questions answered to help you further.

10 Sep 2012, 10:11 AM
#1588
keyclearste avatar

keyclearste

New Zenner

Join Date:
Jan 2009
Location:
UK
Posts:
17
Plugin Contributions:
0

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

Can anyone steer me in the right direction please?
In Admin > Catalog > Products with attributes stock, is it possible to sort the attributes for each product in any way other than the default 'primary attribute'? I'm using v1.3.9h with SBA v 1.4.14. I'd like to sort by colour then by size, unfortunately, some products were added with size as the primary attribute and others with colour as the primary attribute. Thanks

10 Sep 2012, 10:17 AM
#1589
jgold723 avatar

jgold723

Zen Follower

Join Date:
Dec 2010
Posts:
362
Plugin Contributions:
0

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

Is there a way to change the order in which the attributes appear in the admin interface in this? I'm using ZC 1.3.9h.

Thanks,

John

10 Sep 2012, 10:29 AM
#1590
keyclearste avatar

keyclearste

New Zenner

Join Date:
Jan 2009
Location:
UK
Posts:
17
Plugin Contributions:
0

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

John,

The attributes are ordered by primary attribute. The primary attribute is the attribute you inserted first for each product. Within the primary attribute, the order is determined by the sort order of the primary attribute. For example, if you added colour before size, and within colour you have blue- sort order 10, red - sort order 20, then the SBA order will be 1st blue size x, blue size y followed by red size x, red size y. You can change the sort order within an attribute via admin>catalog>option value manager. I don't know how you change the primary attribute.

14 Sep 2012, 12:30 PM
#1591
jgold723 avatar

jgold723

Zen Follower

Join Date:
Dec 2010
Posts:
362
Plugin Contributions:
0

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

Hmm, that doesn't seem to work. I went into catalog > option value manager and changed the default order for several of the attributes.

While that change did affect their order in that screen (option value manager) it had no effect on their order in the "Stock By Attributes" screen. Did I miss something?

John

14 Sep 2012, 12:55 PM
#1592
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

jgold723:

Hmm, that doesn't seem to work. I went into catalog > option value manager and changed the default order for several of the attributes.

While that change did affect their order in that screen (option value manager) it had no effect on their order in the "Stock By Attributes" screen. Did I miss something?

John
When you add attributes to a product they assume the default sort order of the attributes (it's flexible so you can change the sort order of your attribute name and values at the time you add the attributes if you want a different order for whatever reason).. If you change the sort order of the attribute names and values in the attributes manager, the default sort order will be modified for any future products you add your attributes to. Products that you've already added your attributes (with the old sort order values) to will remain the same as the original default sort order.. this means you must edit your products that you have added attributes to with the new sort order values..

14 Sep 2012, 1:01 PM
#1593
jgold723 avatar

jgold723

Zen Follower

Join Date:
Dec 2010
Posts:
362
Plugin Contributions:
0

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

I think I understand, but to clarify -- when you say "edit the products" do you mean I need to delete attributes and re-add them so that the new sort order will take effect?

Also -- I just want to change the order in the "Stock by Attributes" admin screen -- I don't want to change how the attributes are arranged in the front end.

John

14 Sep 2012, 1:11 PM
#1594
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

jgold723:

I think I understand, but to clarify -- when you say "edit the products" do you mean I need to delete attributes and re-add them so that the new sort order will take effect?Edit your products in the attributes manager.. simply change the sort order of the names and values as you wish.. no need to delete and start over..

14 Sep 2012, 1:18 PM
#1595
jgold723 avatar

jgold723

Zen Follower

Join Date:
Dec 2010
Posts:
362
Plugin Contributions:
0

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

Thank you.

However, my concern is that changing the sort order in the Attributes Controller section changes how the attributes are ordered on the product page -- something I don't want. I just want to change them in the Admin screen of "Stock by Attributes"

I tried this and is seems to work: I went into Stock by Attributes and deleted every attribute.
Then I readded them in the reverse order in which I want them to appear.
That seemed to do the trick -- at least with a product that had three attributes.
Does this seem correct?

John

14 Sep 2012, 2:18 PM
#1596
jgold723 avatar

jgold723

Zen Follower

Join Date:
Dec 2010
Posts:
362
Plugin Contributions:
0

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

I'll answer my own question -- it didn't work.

14 Sep 2012, 3:10 PM
#1597
jgold723 avatar

jgold723

Zen Follower

Join Date:
Dec 2010
Posts:
362
Plugin Contributions:
0

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

Finally -- success!

jgold723:

Hmm, that doesn't seem to work. I went into catalog > option value manager and changed the default order for several of the attributes.

While that change did affect their order in that screen (option value manager) it had no effect on their order in the "Stock By Attributes" screen. Did I miss something?

John

This did work -- but you have to click the very small "sort" link at the top of the Stock by Attributes admin screen before you see the new sort order. Thanks to everyone for your help.

8 Oct 2012, 2:10 PM
#1598
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

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

Hi,

I hope someone can help me. I am working on https://www.dragonslivestore.com, using Zen Cart 1.3.9 h and StockByAttributes_1.4.13_with_my_stock_id_MOD_1.0.2. The module installed correctly, and I have given each attribute it's own model number. However when a customer places an order, in admin - orders - it shows the product and attribute, but the model column is empty. What can I do so the model number shows up on my orders?

8 Oct 2012, 3:12 PM
#1599
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

barendfaber:
If I understand correctly what you have to do is actually include the model number as part of your attribute value.

so if you go to catalogue > attribute controller

and create a the option name "size"

then create the value "small #12345" for the particular item that this part number will apply to.

If the part number is different for the option "small" for other products you create different option value for "size" that includes the part number as it applies to each product. That way the part number shows up on the invoice. We do this to avoid mis-picking the order.

8 Oct 2012, 3:39 PM
#1600
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

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

Hi,

Thanks for the reply, but I do not think this will work. This will be a huge amount of work and will still not add a model number in orders, only adds the model number next to the attribute description. It also means that next to each product on the site, the attribute drop down will change from “Small” to “Small - 63-AN-011-1”, or “Medium” to “Medium - 63-AN-011-2”. Good to know for future.

I think I will have to ask the customer to allow us to add a model number for the main product, and they will just have to check sizes on the orders.