1

On my Magento site I have configurable products. They have size and color attributes. How can I display products with sizes and colors that are out of stock? Now you can select only the color from from the products in stock and size also. If product is out of stock, combination of color/size isn't available for choosing. How to display all colors and sizes even from simple products out of stock?

P.S. I already set the configuration Display Out of Stock Products to Yes, but this is probably for catalog display, not attributes.

asked May 8, 2014 at 6:59

1 Answer 1

1

Goto

Mage / Catalog / Block / Product / View / Type / Configurable.php

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) {
 if ($product->isSaleable() || $skipSaleableCheck) {
 $products[] = $product;
 }
 }
 $this->setAllowProducts($products);
 }
 return $this->getData('allow_products');
}

Replace with this

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) {
 $products[] = $product;
 }
 $this->setAllowProducts($products);
 }
 return $this->getData('allow_products');
}

Note: Don't Edit in Core files. Make rewrite or copy the folder structure in to local code pool.

Cheers.

answered May 8, 2014 at 7:06
3
  • Thanks. If I edit core file it works. Can you help me with overriding it? I created the file app/code/local/SpartakusMd/CustomProductImporter/Catalog/Block/Product/View/Type/Configurable.php with the class class SpartakusMd_CustomProductImporter_Catalog_Block_Product_View_Type_Configurable extends Mage_Catalog_Block_Product_View_Type_Configurable, but it doesn't seem to override it. What is wrong? Commented May 8, 2014 at 7:44
  • Oooh, I forgot about config.xml. What shoud I insert there? Commented May 8, 2014 at 7:47
  • @SpartakusMd there is another way. You can copy the Same folder structure in local. like local/Mage/Catalog/Block/Product/View/Type/Configurable.php Commented May 8, 2014 at 7:58

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.