diff --git a/.gitignore b/.gitignore index b79a0b55d9..eadcdde6a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,4 @@ -# Ignore everything (useful to ignore the whole Contao installation) -/* - -# Do not ignore ".gitignore" -!.gitignore -!.tx -!composer.json -!build.xml.dist -!README.md - -# Isotope ignoring rules -!isotope/ -isotope/* -!isotope/.htaccess -!isotope/index.html -!system/ -system/* -!system/modules -system/modules/* -!system/modules/isotope/* -!system/modules/isotope_reports/* -!system/modules/isotope_rules/* -/system/modules/isotope/config/runonce.php - -# Gulp and node modules -!gulpfile.js -!package.json -node_modules/ +/vendor/ +/node_modules/ +/composer.lock +/.php_cs.cache diff --git a/system/modules/isotope/docs/CHANGELOG-2.5.md b/system/modules/isotope/docs/CHANGELOG-2.5.md index 4aac33b335..16b6f7719b 100644 --- a/system/modules/isotope/docs/CHANGELOG-2.5.md +++ b/system/modules/isotope/docs/CHANGELOG-2.5.md @@ -2,6 +2,12 @@ Isotope eCommerce Changelog =========================== +Version 2.5.15-stable (2019-07-02) +---------------------------------- + +- Cumulative filter incorrectly handled checkbox fields (#1933) + + Version 2.5.14-stable (2019-06-11) --------------------------------- diff --git a/system/modules/isotope/library/Isotope/Isotope.php b/system/modules/isotope/library/Isotope/Isotope.php index 329114ad75..0ca5c45a87 100644 --- a/system/modules/isotope/library/Isotope/Isotope.php +++ b/system/modules/isotope/library/Isotope/Isotope.php @@ -44,7 +44,7 @@ class Isotope extends \Controller /** * Isotope version */ - const VERSION = '2.5.14'; + const VERSION = '2.5.15'; /** * True if the system has been initialized diff --git a/system/modules/isotope/library/Isotope/Model/Attribute/AbstractAttributeWithOptions.php b/system/modules/isotope/library/Isotope/Model/Attribute/AbstractAttributeWithOptions.php index 75da493e8f..a3c8a858d0 100644 --- a/system/modules/isotope/library/Isotope/Model/Attribute/AbstractAttributeWithOptions.php +++ b/system/modules/isotope/library/Isotope/Model/Attribute/AbstractAttributeWithOptions.php @@ -287,8 +287,10 @@ public function getValue(IsotopeProduct $product) $value = parent::getValue($product); if ($this->multiple) { - if (IsotopeAttributeWithOptions::SOURCE_TABLE === $this->optionsSource - || IsotopeAttributeWithOptions::SOURCE_FOREIGNKEY === $this->optionsSource + if (( + IsotopeAttributeWithOptions::SOURCE_TABLE === $this->optionsSource + || IsotopeAttributeWithOptions::SOURCE_FOREIGNKEY === $this->optionsSource + ) && $this->csv === ',' ) { $value = explode(',', $value); } else { diff --git a/system/modules/isotope/library/Isotope/Model/Attribute/CheckboxMenu.php b/system/modules/isotope/library/Isotope/Model/Attribute/CheckboxMenu.php index 4a814b8395..fe68280f21 100644 --- a/system/modules/isotope/library/Isotope/Model/Attribute/CheckboxMenu.php +++ b/system/modules/isotope/library/Isotope/Model/Attribute/CheckboxMenu.php @@ -36,14 +36,14 @@ public function prepareOptionsWizard($objWidget, $arrColumns) */ public function saveToDCA(array &$arrData) { - parent::saveToDCA($arrData); - $this->multiple = true; + parent::saveToDCA($arrData); + if (!$this->variant_option && $this->optionsSource === IsotopeAttributeWithOptions::SOURCE_NAME) { $arrData['fields'][$this->field_name]['eval']['multiple'] = false; $arrData['fields'][$this->field_name]['sql'] = "char(1) NOT NULL default ''"; - $arrData['fields'][$this->field_name]['options']; + unset($arrData['fields'][$this->field_name]['options']); } else { $arrData['fields'][$this->field_name]['eval']['multiple'] = true; $arrData['fields'][$this->field_name]['sql'] = 'blob NULL'; diff --git a/system/modules/isotope/library/Isotope/Upgrade/To0020050150.php b/system/modules/isotope/library/Isotope/Upgrade/To0020050150.php new file mode 100644 index 0000000000..b0a1396924 --- /dev/null +++ b/system/modules/isotope/library/Isotope/Upgrade/To0020050150.php @@ -0,0 +1,66 @@ +execute( + "SELECT field_name FROM tl_iso_attribute WHERE type='checkbox' AND (optionsSource='table' OR optionsSource='foreignKey')" + )->fetchEach('field_name'); + + if (empty($attributes)) { + return; + } + + $fields = implode(', ', $attributes); + + $products = Database::getInstance()->execute("SELECT id, $fields FROM tl_iso_product")->fetchAllAssoc(); + + foreach ($products as $product) { + $update = []; + + foreach ($attributes as $attribute) { + if (0 !== strpos($product[$attribute], 'a:')) { + continue; + } + + $value = deserialize($product[$attribute]); + + if (\is_array($value)) { + $update[$attribute] = implode(',', $value); + } + } + + if (empty($update)) { + continue; + } + + Database::getInstance()->prepare("UPDATE tl_iso_product %s WHERE id=?")->set($update)->execute($product['id']); + } + } +}