SCP Module – Show Out of stock product also in configurable product dropdown
SCP Module – Show Out of stock product also in configurable product dropdown:
When i used, latest (updated)SCP module , i should show out of stock product also in my configurable attribute dropdown. For that i had done following changes, it is working fine. Lastest Version:
OrganicInternet\SimpleConfigurableProducts\Catalog\Block\Product\View\Type\Configurable.php
Lastes version of SCP module files, following function are written in top of the above file path. Basically this function is calling, from parent file (from core), but in the old version of SCP module files , this function are written in the same file itself. Here i used latest version, following function “getJsonConfig” is called to parent file.
$config = Zend_Json::decode(parent::getJsonConfig());
go and refer getJsonConfig() from core files
core\Mage\Catalog\Block\Product\View\Type\Configurable.php Public function getJsonConfig(){ ———– ———- foreach ($this->getAllowProducts() as $product) { —— —– } }
getAllowProducts() in this function, out of stock product condition are checked. Need to comment and then check , out of stock product also visible in frontend.
Override public function getAllowProducts() from core to your Local
here i override into following folder , like below
OrganicInternet\SimpleConfigurableProducts\Catalog\Block\Product\View\Type\Configurable.php
In this file, we need to remove or comment one line
Override like as below
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) { //Comment this condition $products[] = $product; //} } $this->setAllowProducts($products); } return $this->getData(‘allow_products’); }
2 thoughts on “SCP Module – Show Out of stock product also in configurable product dropdown”
i commended //if ($product->isSaleable() || $skipSaleableCheck) { //Comment this condition
//}
Still out of stock in configurable product was not showing in magento 2.2
Hi Mohana, am really sorry , mainly this post mainly helpful for Magento1.x. ,not for M2.x. I also not tried with M2. Please provide SCP-M2.x link so that we can check & help you to resolve this issue. Thanks.
i commended //if ($product->isSaleable() || $skipSaleableCheck) { //Comment this condition
//}
Still out of stock in configurable product was not showing in magento 2.2
Please let me know for other solution.
Hi Mohana, am really sorry , mainly this post mainly helpful for Magento1.x. ,not for M2.x. I also not tried with M2. Please provide SCP-M2.x link so that we can check & help you to resolve this issue. Thanks.