1

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');
 }
}
asked Dec 2, 2014 at 16:09

1 Answer 1

1

I found my mistake, I have a wrong path for Configurable.php

I replace

/app/code/local/Mycompany/SimpleConfigurableProducts/Catalog/Block/Catalog/Product/View/Type

by

/app/code/local/Mycompany/SimpleConfigurableProducts/Catalog/Block/Product/View/Type

and it works :)

answered Dec 3, 2014 at 16:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.