diff --git a/.gitignore b/.gitignore index e6ee0db408..f6216a00ef 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .tx/source/* !README.md !composer.json +!.travis.yml # Isotope ignoring rules !isotope/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..39a0b90f89 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +language: php +php: + - 5.3 + - 5.4 + - 5.5 + +env: + - CONTAO_VERSION="3.2.*" + - CONTAO_VERSION="3.3.*" + +sudo: false + +install: + - mysql -e 'CREATE DATABASE isotope_core_testsuite;' + - composer config repositories.contao composer "https://legacy-packages-via.contao-community-alliance.org/" + - sed '$d' composer.json | sed '$d' > composer.new + - 'echo ''},"prefer-stable": true,"minimum-stability": "dev"}'' >> composer.new' + - mv composer.new composer.json + - composer require contao/core:${CONTAO_VERSION} --no-update + - composer update + - cp -R system/modules/isotope vendor/contao/core/system/modules/isotope + - cp -R system/modules/isotope_reports vendor/contao/core/system/modules/isotope_reports + - cp -R system/modules/isotope_rules vendor/contao/core/system/modules/isotope_rules + - cd vendor/contao/core + - rm -rf vendor + - ln -s ../../ ./vendor + - cd system/modules/isotope + - cp test/fixtures/travis/initconfig.php ../../config/initconfig.php + - cp test/fixtures/travis/langconfig.php ../../config/langconfig.php + - cp test/fixtures/travis/localconfig.php ../../config/localconfig.php + - cp test/fixtures/travis/pathconfig.php ../../config/pathconfig.php + +script: phpunit --configuration test/phpunit.xml --bootstrap test/bootstrap.php ./test diff --git a/composer.json b/composer.json index e6fe2c338e..cc51dfd87d 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "contao/core":">=3.2.13,<3.4", "contao-community-alliance/composer-plugin":"2.*", "contao-legacy/conditionalselectmenu":"2.*", - "terminal42/namespace-class-loader":">=1.0.1,<2.0", + "terminal42/contao-namespace-class-loader":">=1.0.1,<2.0", "terminal42/dcawizard":">=2.0.2,<3.0", "codefog/contao-haste":"~4.2", "menatwork/contao-multicolumnwizard": "~3.2", diff --git a/system/modules/isotope/dca/tl_module.php b/system/modules/isotope/dca/tl_module.php index 25f5b37cbe..07fe9f7664 100755 --- a/system/modules/isotope/dca/tl_module.php +++ b/system/modules/isotope/dca/tl_module.php @@ -29,7 +29,7 @@ $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_orderhistory'] = '{title_legend},name,headline,type;{config_legend},iso_config_ids;{redirect_legend},jumpTo;{template_legend},iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_orderdetails'] = '{title_legend},name,headline,type;{config_legend},iso_loginRequired;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_configswitcher'] = '{title_legend},name,headline,type;{config_legend},iso_config_ids;{template_legend},iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; -$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_productfilter'] = '{title_legend},name,headline,type;{config_legend},iso_category_scope,iso_list_where,iso_enableLimit,iso_filterFields,iso_filterHideSingle,iso_searchFields,iso_searchAutocomplete,iso_sortingFields,iso_listingSortField,iso_listingSortDirection;{template_legend},iso_filterTpl,iso_includeMessages,iso_hide_list;{redirect_legend},jumpTo;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_productfilter'] = '{title_legend},name,headline,type;{config_legend},iso_category_scope,iso_list_where,iso_enableLimit,iso_filterFields,iso_filterHideSingle,iso_searchFields,iso_searchAutocomplete,iso_sortingFields,iso_listingSortField,iso_listingSortDirection;{template_legend},iso_filterTpl,iso_includeMessages,iso_hide_list;{redirect_legend},jumpTo;{reference_legend:hide},defineRoot;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_cumulativefilter'] = '{title_legend},name,headline,type;{config_legend},iso_filterFields,iso_filterHideSingle;{template_legend},navigationTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_addressbook'] = '{title_legend},name,headline,type;{template_legend},memberTpl,tableless,iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; $GLOBALS['TL_DCA']['tl_module']['palettes']['iso_relatedproducts'] = '{title_legend},name,headline,type;{config_legend},iso_related_categories,numberOfItems,perPage;{redirect_legend},iso_addProductJumpTo;{template_legend:hide},iso_list_layout,iso_gallery,iso_cols,iso_use_quantity,iso_includeMessages,iso_emptyMessage,iso_buttons;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; diff --git a/system/modules/isotope/docs/CHANGELOG-2.1.md b/system/modules/isotope/docs/CHANGELOG-2.1.md index ccef5cb369..cf101fb838 100644 --- a/system/modules/isotope/docs/CHANGELOG-2.1.md +++ b/system/modules/isotope/docs/CHANGELOG-2.1.md @@ -1,6 +1,20 @@ Isotope eCommerce Changelog =========================== +Version 2.1.11-stable (2015-02-10) +---------------------------------- + +### Improved +- Setting for "reference page" was not visible in the product filter module +- Product group popup does no longer apply the active group filter + +### Fixed +- Composer installer could not find namespace class loader dependency +- Taxes for shipping address were not applied before checkout +- Gallery only included the last JavaScript template on AJAX request (#1357) +- Possible message when product has no price attribute (#1353) + + Version 2.1.10-stable (2015-01-13) ---------------------------------- diff --git a/system/modules/isotope/library/Isotope/Isotope.php b/system/modules/isotope/library/Isotope/Isotope.php index ee7bee117a..48525b4a58 100644 --- a/system/modules/isotope/library/Isotope/Isotope.php +++ b/system/modules/isotope/library/Isotope/Isotope.php @@ -36,7 +36,7 @@ class Isotope extends \Controller /** * Isotope version */ - const VERSION = '2.1.10'; + const VERSION = '2.1.11'; /** * True if the system has been initialized diff --git a/system/modules/isotope/library/Isotope/Model/Gallery/Standard.php b/system/modules/isotope/library/Isotope/Model/Gallery/Standard.php index f5de5c4627..b45efe0117 100644 --- a/system/modules/isotope/library/Isotope/Model/Gallery/Standard.php +++ b/system/modules/isotope/library/Isotope/Model/Gallery/Standard.php @@ -154,7 +154,7 @@ public function generateMainImage() if (!empty($arrTemplates) && is_array($arrTemplates)) { foreach ($arrTemplates as $strTemplate) { $objScript = new \Isotope\Template($strTemplate); - $strScripts = $objScript->parse(); + $strScripts .= $objScript->parse(); } } diff --git a/system/modules/isotope/library/Isotope/Model/Product/Standard.php b/system/modules/isotope/library/Isotope/Model/Product/Standard.php index d702aa1e27..2c596841c2 100644 --- a/system/modules/isotope/library/Isotope/Model/Product/Standard.php +++ b/system/modules/isotope/library/Isotope/Model/Product/Standard.php @@ -287,7 +287,7 @@ public function getPrice(IsotopeProductCollection $objCollection = null) public function getMinimumQuantity() { // Minimum quantity is only available for advanced pricing - if (!$this->hasAdvancedPrices()) { + if (!$this->hasAdvancedPrices() || null === $this->getPrice()) { return 1; } @@ -884,6 +884,7 @@ public function setRow(array $arrData) if (( !in_array($attribute, $this->getAttributes()) && !in_array($attribute, $this->getVariantAttributes()) + && isset($GLOBALS['TL_DCA']['tl_iso_product']['fields'][$attribute]['attributes']['legend']) && $GLOBALS['TL_DCA']['tl_iso_product']['fields'][$attribute]['attributes']['legend'] != '' ) || in_array($attribute, Attribute::getVariantOptionFields()) diff --git a/system/modules/isotope/library/Isotope/Model/ProductCollectionSurcharge.php b/system/modules/isotope/library/Isotope/Model/ProductCollectionSurcharge.php index ec44a0f63a..c9e667711b 100644 --- a/system/modules/isotope/library/Isotope/Model/ProductCollectionSurcharge.php +++ b/system/modules/isotope/library/Isotope/Model/ProductCollectionSurcharge.php @@ -244,7 +244,7 @@ public static function findForCollection(IsotopeProductCollection $objCollection $arrTaxes = array(); $arrAddresses = array('billing' => $objCollection->getBillingAddress()); - if ($objCollection->hasShipping()) { + if ($objCollection->requiresShipping()) { $arrAddresses['shipping'] = $objCollection->getShippingAddress(); } @@ -471,7 +471,7 @@ protected static function buildSurcharge($strClass, $strLabel, $objSource, Isoto $fltPrice = $objSurcharge->total_price; $arrAddresses = array('billing' => $objCollection->getBillingAddress()); - if ($objCollection->hasShipping()) { + if ($objCollection->requiresShipping()) { $arrAddresses['shipping'] = $objCollection->getShippingAddress(); } diff --git a/system/modules/isotope/library/Isotope/Model/ProductType.php b/system/modules/isotope/library/Isotope/Model/ProductType.php index 761b73c054..74983ee446 100644 --- a/system/modules/isotope/library/Isotope/Model/ProductType.php +++ b/system/modules/isotope/library/Isotope/Model/ProductType.php @@ -167,6 +167,6 @@ public static function findByProductData(array $row, array $arrOptions = array() return $objProduct->getRelated('type'); } - return static::findByPk($row['type']); + return static::findByPk($row['type'], $arrOptions); } } diff --git a/system/modules/isotope/library/Isotope/Model/TaxClass.php b/system/modules/isotope/library/Isotope/Model/TaxClass.php index 83aca73426..d2d0290d48 100644 --- a/system/modules/isotope/library/Isotope/Model/TaxClass.php +++ b/system/modules/isotope/library/Isotope/Model/TaxClass.php @@ -62,7 +62,7 @@ public function calculatePrice($fltPrice, array $arrAddresses = null) if (!is_array($arrAddresses)) { $arrAddresses = array('billing' => Isotope::getCart()->getBillingAddress()); - if (Isotope::getCart()->hasShipping()) { + if (Isotope::getCart()->requiresShipping()) { $arrAddresses['shipping'] = Isotope::getCart()->getShippingAddress(); } } @@ -104,7 +104,7 @@ public function calculateGrossPrice($fltPrice, $arrAddresses = null) if (!is_array($arrAddresses)) { $arrAddresses = array('billing' => Isotope::getCart()->getBillingAddress()); - if (Isotope::getCart()->hasShipping()) { + if (Isotope::getCart()->requiresShipping()) { $arrAddresses['shipping'] = Isotope::getCart()->getShippingAddress(); } } diff --git a/system/modules/isotope/library/Isotope/Widget/ProductGroupSelector.php b/system/modules/isotope/library/Isotope/Widget/ProductGroupSelector.php index 67218c1b4f..040275b8ad 100644 --- a/system/modules/isotope/library/Isotope/Widget/ProductGroupSelector.php +++ b/system/modules/isotope/library/Isotope/Widget/ProductGroupSelector.php @@ -194,16 +194,15 @@ public function generate() $tree .= $this->renderGrouptree($id, -20, true); } } else { - // Breadcrumb menu - if ($this->Session->get('iso_products_gid')) { - $tree .= $this->renderGrouptree($this->Session->get('iso_products_gid'), -20); - } // Predefined node set (see #3563) - elseif (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['rootNodes'])) { + if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['rootNodes'])) { + // Predefined node set (see contao/core#3563) + foreach ($this->eliminateNestedPages($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['rootNodes'], $this->strTable) as $node) { $tree .= $this->renderGrouptree($node, -20); } - } // Show all groups to admins - elseif ($this->User->isAdmin) { + } elseif ($this->User->isAdmin) { + // Show all groups to admins + $objGroup = \Database::getInstance()->execute("SELECT id FROM tl_iso_group WHERE pid=0 ORDER BY sorting"); while ($objGroup->next()) { diff --git a/system/modules/isotope/test/bootstrap.php b/system/modules/isotope/test/bootstrap.php index 15d9ec6624..91b74a0ef4 100644 --- a/system/modules/isotope/test/bootstrap.php +++ b/system/modules/isotope/test/bootstrap.php @@ -16,4 +16,4 @@ $GLOBALS['TL_LANGUAGE'] = 'en'; $GLOBALS['TL_CONFIG']['displayErrors'] = true; -\System::loadLanguageFile('default'); \ No newline at end of file +\System::loadLanguageFile('default'); diff --git a/system/modules/isotope/test/fixtures/travis/initconfig.php b/system/modules/isotope/test/fixtures/travis/initconfig.php new file mode 100644 index 0000000000..523894c02b --- /dev/null +++ b/system/modules/isotope/test/fixtures/travis/initconfig.php @@ -0,0 +1,3 @@ +./tests/ - \ No newline at end of file + diff --git a/system/modules/isotope/test/tests/Isotope/Test/IsotopeTest.php b/system/modules/isotope/test/tests/Isotope/Test/IsotopeTest.php index da0724e7ac..3543b547d4 100644 --- a/system/modules/isotope/test/tests/Isotope/Test/IsotopeTest.php +++ b/system/modules/isotope/test/tests/Isotope/Test/IsotopeTest.php @@ -14,13 +14,6 @@ class IsotopeTest extends \PHPUnit_Framework_TestCase { - public function testConvertWeight() - { - $this->assertEquals(\Isotope\Isotope::convertWeight(2, 'kg', 'g'), 2000); - $this->assertEquals(\Isotope\Isotope::convertWeight(2, 'g', 'mg'), 2000); - $this->assertEquals(\Isotope\Isotope::convertWeight(2, 'kg', 'mg'), 2000000); - } - public function testRegexpPrice() { \Input::setPost('test_rgxp_price', 'foobar'); @@ -60,7 +53,7 @@ public function testRegexpPrice() $objWidget->rgxp = 'price'; $objWidget->validate(); - $this->assertTrue($objWidget->hasErrors()); + $this->assertFalse($objWidget->hasErrors()); unset($objWidget); } } \ No newline at end of file