Why Magento won’t allow you to show out of stock options in configurable products is beyond me, thankfuly nyah, on the Magento forums was kind enough to post a “quick-fix” for this delima, first edit:
app/code/core/Mage/Catalog/Block/Product/View/Configurable.php
locate the getAllowProducts() function…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public function getAllowProducts() { if (!$this->hasAllowProducts()) { $products = array(); $allProducts = $this->getProduct()->getTypeInstance()->getUsedProducts(); foreach ($allProducts as $product) { if ($product->isSaleable()) { $products[] = $product; } } $this->setAllowProducts($products); } return $this->getData('allow_products'); } |
and replace or comment out the existing method with:
1 2 3 4 5 | public function getAllowProducts() { $allProducts = $this->getProduct()->getTypeInstance()->getUsedProducts(); $this->setAllowProducts($allProducts); return $this->getData('allow_products'); } |
Looking at the above fix basically all products in the configurable product are displayed regardless of their isSaleable() state. Which I’m assuming a better solution would be to modify it instead in case of other instances not just out of stock.
This won’t disable the product out the option but if a user attempts to order it will get an out of stock message. Its not perfect but serves the purpose until Magento can possibly make a more permanent solution.
Be aware this modifies the Core code of magento and its highly recommended that you make a backup of the Configurable.php file before modifying its contents.
Possibly Related Posts:
- Magento Commerce Error Reporting Tip
- Eclipse + ZendStudio + ZendServer + Android SDK = Awesome IDE
- Magento: Paypal Standard IPN Double Totals Bug 1.3.2.3 + fix
- iPhone Magento theme compatible with Android
- Magento Tutorial Video: Display Product Images in Blocks and Pages
Pingback: Twitted by molotovbliss
Note:
app/code/core/Mage/Catalog/Block/Product/View/Configurable.php
should be
app/code/core/Mage/Catalog/Block/Product/View/Type/Configurable.php