Last active
August 29, 2015 14:04
-
-
Save antoinekociuba/9695fcaa202324aee289 to your computer and use it in GitHub Desktop.
Display out of stock options of Configurable products, depending on 'Show out of stock' system configuration setting.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if out of stock options of configurable products should be displayed | |
*/ | |
public function checkDisplayOutOfStockOptions() | |
{ | |
$currentProduct = Mage::registry('current_product'); | |
if ($currentProduct && $currentProduct->isConfigurable()) { | |
if (Mage::getStoreConfigFlag(Mage_CatalogInventory_Helper_Data::XML_PATH_SHOW_OUT_OF_STOCK)) { | |
Mage::helper('catalog/product')->setSkipSaleableCheck(true); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<controller_action_layout_render_before_catalog_product_view> | |
<observers> | |
<your_module_observer_name> | |
<class>Your_Module_Model_Observer</class> | |
<method>checkDisplayOutOfStockOptions</method> | |
</your_module_observer_name> | |
</observers> | |
</controller_action_layout_render_before_catalog_product_view> | |
<controller_action_layout_render_before_checkout_cart_configure> | |
<observers> | |
<your_module_observer_name> | |
<class>Your_Module_Model_Observer</class> | |
<method>checkDisplayOutOfStockOptions</method> | |
</your_module_observer_name> | |
</observers> | |
</controller_action_layout_render_before_checkout_cart_configure> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment