From fa45a3f3c62976c8e4624120c7430cce55ed7f5a Mon Sep 17 00:00:00 2001 From: mc12345678 Date: Sat, 26 Jan 2019 11:25:53 -0500 Subject: [PATCH] Update handling of attribute images In rearranging code, the variable `$options_attributes_image` became reset on initial pass of every option_name, this causes the attribute image to not be displayed for all image placement settings within the option name manager when the product is not tracked by SBA. Removing the line from a default installed store with this plugin restored the operation of the attributes images and also allowed modifying the display of attribute images based on the setting of `SBA_SHOW_IMAGE_ON_PRODUCT_INFO`; however, all products that had attribute images were affected by the constant. Added a test for if the product is an SBA product to address the associated image controls. This again fixes #15 which somehow became an issue again. --- .../observers/class.products_with_attributes_stock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/classes/observers/class.products_with_attributes_stock.php b/includes/classes/observers/class.products_with_attributes_stock.php index 6e86b1a..bcb8acc 100644 --- a/includes/classes/observers/class.products_with_attributes_stock.php +++ b/includes/classes/observers/class.products_with_attributes_stock.php @@ -176,7 +176,7 @@ function updateNotifyAttributesModuleStartOption(&$callingClass, $notifier, $par $this->_options_menu_images = array(); $this->_moveSelectedAttribute = false; $products_options_array = array(); - $options_attributes_image = array(); +// $options_attributes_image = array(); // Could do the calculation here the first time set a variable above as part of the class and then reuse that... instead of the modification to the attributes file... if (!zen_not_null($this->_products_options_names_count)) { $this->_products_options_names_count = $products_options_names->RecordCount(); @@ -570,7 +570,7 @@ function updateNotifyAttributesModuleOptionBuilt(&$callingClass, $notifier, $pro $this->_products_options_names_current = 0; } // reset or clear the attribute images so that they do not display adjacent/near the product - if (defined('SBA_SHOW_IMAGE_ON_PRODUCT_INFO') && SBA_SHOW_IMAGE_ON_PRODUCT_INFO === '2') { + if (defined('SBA_SHOW_IMAGE_ON_PRODUCT_INFO') && SBA_SHOW_IMAGE_ON_PRODUCT_INFO === '2' && $this->_isSBA) { $options_attributes_image = array(); } }