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.
1 Answer 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.
-
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.phpwith the classclass 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?Marin Bînzari– Marin Bînzari2014年05月08日 07:44:54 +00:00Commented May 8, 2014 at 7:44 -
Oooh, I forgot about
config.xml. What shoud I insert there?Marin Bînzari– Marin Bînzari2014年05月08日 07:47:04 +00:00Commented 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.phpMeenakshiSundaram R– MeenakshiSundaram R2014年05月08日 07:58:26 +00:00Commented May 8, 2014 at 7:58
Explore related questions
See similar questions with these tags.