The subject function receives the following PHP notification on each execution ... if the requested product does not have attributes:
The issue is with the highlighted code since the fields array is not returned if the product has no attributes:Code:PHP Notice: Undefined property: queryFactoryResult::$fields in C:\xampp\htdocs\test\test_admin\includes\functions\general.php on line 2075
The notification can be corrected by the following change:Code:/** * 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->fields['products_attributes_id'] > 0) { return true; } else { return false; } }
Code:/** * 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); return !$attributes->EOF; }



