Skip to content

Commit

Permalink
v2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
tzyganu committed Nov 20, 2014
1 parent 979ce6e commit fdba94a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 33 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
Easylife Switcher
========

Configurable products switcher v2.0.0
Configurable products switcher v2.0.1

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.
You can also change the product image or entire media block when the congiruable option is changed and display the simple product image or media block.
For a full list of features with screenshots included check the [Features list] (https://github.com/tzyganu/Switcher/wiki/features) and the [Configuration](https://github.com/tzyganu/Switcher/wiki/configuration) section.

Please visit the [wiki](https://github.com/tzyganu/Switcher/wiki) for a full description.

Extension is compatible with CE versions 1.7 and after.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function getJsonAdditionalConfig()
$config['switch_media'] = $this->getSwitchMedia();
$config['switch_media_selector'] = Mage::getStoreConfig(self::XML_MEDIA_SELECTOR);
$config['switch_media_callback'] = Mage::getStoreConfig(self::XML_MEDIA_CALLBACK_PATH);
$config['allow_no_stock_select'] = Mage::getStoreConfigFlag(self::XML_NO_STOCK_SELECT_PATH);
$config['allow_no_stock_select'] = $this->getAllowNoStockSelect();
$config['keep_values'] = Mage::getStoreConfigFlag(self::XML_KEEP_SELECTED_VALUES);

if (!$this->getProduct()->hasPreconfiguredValues()) {
Expand All @@ -283,6 +283,14 @@ public function getJsonAdditionalConfig()
return $this->getCoreHelper()->jsonEncode($config);
}

/**
* @return bool
*/
public function getAllowNoStockSelect()
{
return Mage::getStoreConfigFlag(self::XML_SHOW_OUT_OF_STOCK_PATH) &&
Mage::getStoreConfigFlag(self::XML_NO_STOCK_SELECT_PATH);
}
/**
* @return array
*/
Expand Down Expand Up @@ -407,8 +415,9 @@ public function getDefaultValues()
$default = false;
foreach ($simpleProducts as $product) {
/** @var Mage_Catalog_Model_Product $product */
if ($product->getIsSalable()) {
if ($product->getIsSalable() || $this->getAllowNoStockSelect()) {
$default = $product;
break;
}
}
} else {
Expand Down
17 changes: 0 additions & 17 deletions app/code/community/Easylife/Switcher/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,6 @@ public function checkShowStock(Varien_Event_Observer $observer)
return $this;
}

/**
* tell Magento to load out of stock products also on cart configure page
* @access public
* @param Varien_Event_Observer $observer
* @return Easylife_Switcher_Model_Observer
*/
public function checkShowStockOnConfigure(Varien_Event_Observer $observer)
{
if ($this->_getSwitcherHelper()->isEnabled()) {
Mage::register('old_skip_aleable_check', $this->_getCatalogHelper()->getSkipSaleableCheck());
$this->_getCatalogHelper()->setSkipSaleableCheck(
Mage::getStoreConfigFlag(self::XML_SHOW_OUT_OF_STOCK_PATH)
);
}
return $this;
}

/**
* add column to simple products grid
* @access public
Expand Down
12 changes: 2 additions & 10 deletions app/code/community/Easylife/Switcher/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
*
* @category Easylife
* @package Easylife_Switcher
* @copyright 2013 - 2014 Marius Strajeru
* @copyright 2013 - 2014 Marius Strajeru
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
-->
<config>
<modules>
<Easylife_Switcher>
<version>2.0.0</version>
<version>2.0.1</version>
</Easylife_Switcher>
</modules>
<global>
Expand Down Expand Up @@ -73,14 +73,6 @@
</easylife_switcher>
</observers>
</catalog_controller_product_init>
<controller_action_layout_render_before_checkout_cart_configure>
<observers>
<easylife_switcher>
<class>easylife_switcher/observer</class>
<method>checkShowStockOnConfigure</method>
</easylife_switcher>
</observers>
</controller_action_layout_render_before_checkout_cart_configure>
</events>
<translate>
<modules>
Expand Down
6 changes: 3 additions & 3 deletions skin/frontend/base/default/css/easylife_switcher/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/mit-license.php
*
* @category Easylife
* @package Easylife_Switcher
* @category Easylife
* @package Easylife_Switcher
* @copyright 2013 - 2014 Marius Strajeru
* @license http://opensource.org/licenses/mit-license.php MIT License
* @license http://opensource.org/licenses/mit-license.php MIT License
*/
/**
* extension css file
Expand Down

0 comments on commit fdba94a

Please sign in to comment.