
Originally Posted by
mc12345678
I have applied the above changes to a v1.5.5f site, it seems that the changes to includes/classes/class.products_with_attributes_class_stock.php are causing problems. The error I get when adding a SBA attributed product to the cart (from the product info page) is
Code:
[23-Sep-2018 15:08:12 Europe/London] Request URI: /my-category/my-product?number_of_uploads=0&action=add_product, IP address: 127.0.0.1
#1 trigger_error() called at [\www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php:793]
#2 products_with_attributes_class_stock->zen_sba_attribs_no_text() called at [\www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php:787]
#3 include(\www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php) called at [\www\mydomain.co.uk\includes\main_cart_actions.php:26]
#4 require(\www\mydomain.co.uk\includes\main_cart_actions.php) called at [\www\mydomain.co.uk\includes\init_includes\init_cart_handler.php:44]
#5 require(\www\mydomain.co.uk\includes\init_includes\init_cart_handler.php) called at [\www\mydomain.co.uk\includes\autoload_func.php:48]
#6 require(\www\mydomain.co.uk\includes\autoload_func.php) called at [\www\mydomain.co.uk\includes\application_top.php:170]
#7 require(\www\mydomain.co.uk\includes\application_top.php) called at [\www\mydomain.co.uk\index.php:26]
[23-Sep-2018 15:08:12 Europe/London] PHP Warning: SBA product can not have any attributes in \www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php on line 793
[23-Sep-2018 15:08:12 Europe/London] PHP Stack trace:
[23-Sep-2018 15:08:12 Europe/London] PHP 1. {main}() \www\mydomain.co.uk\index.php:0
[23-Sep-2018 15:08:12 Europe/London] PHP 2. require() \www\mydomain.co.uk\index.php:26
[23-Sep-2018 15:08:12 Europe/London] PHP 3. require() \www\mydomain.co.uk\includes\application_top.php:170
[23-Sep-2018 15:08:12 Europe/London] PHP 4. require() \www\mydomain.co.uk\includes\autoload_func.php:48
[23-Sep-2018 15:08:12 Europe/London] PHP 5. require() \www\mydomain.co.uk\includes\init_includes\init_cart_handler.php:44
[23-Sep-2018 15:08:12 Europe/London] PHP 6. include() \www\mydomain.co.uk\includes\main_cart_actions.php:26
[23-Sep-2018 15:08:12 Europe/London] PHP 7. products_with_attributes_class_stock->zen_sba_attribs_no_text() \www\mydomain.co.uk\includes\extra_cart_actions\stock_by_attributes.php:787
[23-Sep-2018 15:08:12 Europe/London] PHP 8. trigger_error() \www\mydomain.co.uk\includes\classes\class.products_with_attributes_class_stock.php:793
To my inexperienced eye it would appear that this code, lines 762 - 788, are behind the issue, only because reverting to the SBA's previous version of this code gives no errors.
PHP Code:
if (!isset($this->_isSBA[(int)$products_id]['sql'])) {
if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
$options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0"), popt.products_options_name';
} else {
$options_order_by= ' order by popt.products_options_name';
}
//get the option/attribute list
$sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
popt.products_options_type, popt.products_options_length, popt.products_options_comment,
popt.products_options_size,
popt.products_options_images_per_row,
popt.products_options_images_style,
popt.products_options_rows
from " . TABLE_PRODUCTS_OPTIONS . " popt
left join " . TABLE_PRODUCTS_ATTRIBUTES . " patrib ON (patrib.options_id = popt.products_options_id)
where patrib.products_id= :products_id:
and popt.language_id = :languages_id: " .
$options_order_by;
$sql = $db->bindVars($sql, ':products_id:', $products_id, 'integer');
$sql = $db->bindVars($sql, ':languages_id:', $_SESSION['languages_id'], 'integer');
$products_options_names = $db->Execute($sql);
$this->_isSBA[(int)$products_id]['sql'] = $products_options_names;
} else {
$products_options_names = $this->_isSBA[(int)$products_id]['sql'];
}
There doesn't seem to be anything special about the product's attributes. Product is priced by attributes, one dropdown option name with three option values (the first of which is display only)
Bookmarks