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.
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.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
$attributes = $db->Execute($attributes_query);
/home/nothingb/public_html/includes/functions/functions_lookups.php
Anything here??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);
All searches for $db
come up
$db = new queryFactory();
Is the problem in here?
Line #444 : $attributes_query = "select sum(options_values_price) as total
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;
}
}
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.
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
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
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.
Bookmarks