Hi I try to override getAllowProducts() method from Mage/Core/Block/Product/View/Type/Configurable.php with local module to show Out of stock products in configurable attribute dropdown.
I use Magento CE 1.9 and Simple Configurable Products (SCP) extension. Product_View_Type_Configurable class is already overriden by SCP so I rewrite SCP class using depends.
When I activate my module, configurable attribute dropdown and product data desappear from template catalog/product/view.phtml.
Is anybody help for this issue ?
Here is the code of my module :
etc/modules : app/etc/modules/Mycompany_SimpleConfigurableProducts.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_SimpleConfigurableProducts>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Catalog />
<OrganicInternet_SimpleConfigurableProducts />
</depends>
</Mycompany_SimpleConfigurableProducts>
</modules>
</config>
config.xml in app/code/local/Mycompany/SimpleConfigurableProducts/etc
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_SimpleConfigurableProducts>
<version>1.0.0</version>
</Mycompany_SimpleConfigurableProducts>
</modules>
<global>
<blocks>
<catalog>
<rewrite>
<product_view_type_configurable>Mycompany_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable</product_view_type_configurable>
</rewrite>
</catalog>
</blocks>
</global>
</config>
Configurable.php in /app/code/local/Mycompany/SimpleConfigurableProducts/Catalog/Block/Catalog/Product/View/Type
<?php
class Mycompany_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable extends OrganicInternet_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable{
public function getAllowProducts()
{
if (!$this->hasAllowProducts()) {
$products = array();
$skipSaleableCheck = Mage::helper('catalog/product')->getSkipSaleableCheck();
$allProducts = $this->getProduct()->getTypeInstance(true)
->getUsedProducts(null, $this->getProduct());
foreach ($allProducts as $product) {
// Get Out of stock simple products
//if ($product->isSaleable() || $skipSaleableCheck) {
$products[] = $product;
//}
}
$this->setAllowProducts($products);
}
return $this->getData('allow_products');
}
}