ComGrafPL Posted November 25, 2022 Share Posted November 25, 2022 Hello, We need to figure out how to solve it. 3 peoples wasn't able to do it. Even IT from here. The issue client have is, when you go to the product link, we need to attribute switch to first/next in stock attribute. Even when default attribute have 0 in stock. So client could see add to cart from start. Default combination cant be changed as it is required to be set like that. I have tried to add code from @4you.software to link.php in override but it wasn't successful. //Attribute equal to 0 or empty is useless, so we force it to null so that it won't be inserted in query parameters if (empty($idProductAttribute)) { $idProductAttribute = null; } else { // find if attributer is 0 quantity $findNewAttributeByQuantity = 0; $isQuantityNull = Db::getInstance()->getValue('SELECT quantity FROM '._DB_PREFIX_.'stock_available WHERE id_product = '.$params['id'].' AND id_product_attribute = '. $idProductAttribute); if ($isQuantityNull == '0'){ $findNewAttributeByQuantity = Db::getInstance()->getValue('SELECT id_product_attribute FROM '._DB_PREFIX_.'stock_available WHERE id_product = '.$params['id'].' AND id_product_attribute > 0 AND quantity > 0'); } if ($findNewAttributeByQuantity){ $idProductAttribute = $findNewAttributeByQuantity; } } Any other suggestions? PS: 1.7.8.6 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now