From 796fea95876b8511aa83a1006cbee5fb3712be08 Mon Sep 17 00:00:00 2001 From: Marius Strajeru Date: Fri, 28 Nov 2014 17:58:14 +0200 Subject: [PATCH] version 2.1.0 --- README.md | 7 +++++-- .../Product/View/Type/Configurable/Config.php | 18 +++++++++--------- .../Model/Adminhtml/Enabled/Comment.php | 14 ++++++++++++++ .../community/Easylife/Switcher/etc/config.xml | 2 +- .../community/Easylife/Switcher/etc/system.xml | 3 +++ 5 files changed, 32 insertions(+), 12 deletions(-) create mode 100644 app/code/community/Easylife/Switcher/Model/Adminhtml/Enabled/Comment.php diff --git a/README.md b/README.md index 8e2d2e3..7882e6e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Easylife Switcher ======== -Configurable products switcher v2.0.1 +Configurable products switcher v2.1.0 This is a Magento extension that allows you to change the configurable products dropdowns to labels, colors or images. It also allows you to set default configurations, keep the selected options when changing an option from above. @@ -11,4 +11,7 @@ For a full list of features with screenshots included check the [Features list] Please visit the [wiki](https://github.com/tzyganu/Switcher/wiki) for a full description. Extension is compatible with CE versions 1.7 and after. -**Not tested yet for CE 1.9.1** +The CE 1.9.1 version already comes with a configurable swatches extension. +If you use this extension and disable the core configurable swatches it works without an issue. +If you have both of them enabled, this extension shamelessly hides the elements generated by the core module. +It still seams to work, but test carefully specially if you use a custom theme. diff --git a/app/code/community/Easylife/Switcher/Block/Catalog/Product/View/Type/Configurable/Config.php b/app/code/community/Easylife/Switcher/Block/Catalog/Product/View/Type/Configurable/Config.php index a04113a..f307397 100644 --- a/app/code/community/Easylife/Switcher/Block/Catalog/Product/View/Type/Configurable/Config.php +++ b/app/code/community/Easylife/Switcher/Block/Catalog/Product/View/Type/Configurable/Config.php @@ -416,19 +416,14 @@ public function getDefaultValues() foreach ($simpleProducts as $product) { /** @var Mage_Catalog_Model_Product $product */ if ($product->getIsSalable() || $this->getAllowNoStockSelect()) { - $default = $product; + //$default = $product; + $defaultId = $product->getId(); break; } } - } else { - $default = false; } - } else { - $default = Mage::getModel('catalog/product') - ->setStoreId(Mage::app()->getStore()->getId()) - ->load($defaultId); } - if (!$default || !$default->getId()) { + if (!$defaultId) { return null; } $defaultValues = array(); @@ -436,7 +431,12 @@ public function getDefaultValues() /** @var Mage_Catalog_Model_Product_Type_Configurable_Attribute $attribute */ /** @var Mage_Catalog_Model_Resource_Eav_Attribute $productAttribute */ $productAttribute = $attribute->getProductAttribute(); - $defaultValues[$productAttribute->getId()] = $default->getData($productAttribute->getAttributeCode()); + $defaultValues[$productAttribute->getId()] = Mage::getResourceModel('catalog/product') + ->getAttributeRawValue( + $defaultId, + $productAttribute->getAttributeCode(), + Mage::app()->getStore()->getId() + ); } return $defaultValues; } diff --git a/app/code/community/Easylife/Switcher/Model/Adminhtml/Enabled/Comment.php b/app/code/community/Easylife/Switcher/Model/Adminhtml/Enabled/Comment.php new file mode 100644 index 0000000..dd12764 --- /dev/null +++ b/app/code/community/Easylife/Switcher/Model/Adminhtml/Enabled/Comment.php @@ -0,0 +1,14 @@ +isModuleEnabled('Mage_ConfigurableSwatches'); + if ($hasCoreSwatches) { + return Mage::helper('easylife_switcher')->__('Your magento instance contains the extension "Mage_ConfigurableSwatches". Enabling this might conflict in special cases with that core extension. Test before going live.'); + } + return ''; + } +} \ No newline at end of file diff --git a/app/code/community/Easylife/Switcher/etc/config.xml b/app/code/community/Easylife/Switcher/etc/config.xml index 9d724f5..8d00d76 100644 --- a/app/code/community/Easylife/Switcher/etc/config.xml +++ b/app/code/community/Easylife/Switcher/etc/config.xml @@ -19,7 +19,7 @@ - 2.0.2 + 2.1.0 diff --git a/app/code/community/Easylife/Switcher/etc/system.xml b/app/code/community/Easylife/Switcher/etc/system.xml index 55fac85..c1a8826 100644 --- a/app/code/community/Easylife/Switcher/etc/system.xml +++ b/app/code/community/Easylife/Switcher/etc/system.xml @@ -43,6 +43,9 @@ 1 1 1 + + easylife_switcher/adminhtml_enabled_comment +