Magento grid view show out of stock banner/label
Magento grid view show out of stock banner/label
So I have looked for this online and nothing worked.
I want a banner/label to show on my category view (in grid mode) that a certain product is out of stuck.
I tried to add:
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
$qty = $stock->getQty();
if($qty <= 0)
{
<span class="out-of-stock"><span>Sold Out</span></span>
}
literally after the foreach product
in the grid mode but didn't work
foreach product
Any help?
EDIT2
Out of stock
List VIew
1 Answer
1
You have to tried following code in your category list.phtml file:-
<?php if($_product->isSaleable()): ?>
<span class="in-stock"><span>In Stock</span></span>
<?php else: ?>
<span class="out-of-stock"><span>Sold Out</span></span>
<?php endif; ?>
Sorry. And hey Raj, any ideas?
– MagTubsvyu
20 hours ago
Hi. Let's talk in chat.
– Raj
20 hours ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments are not for extended discussion; this conversation has been moved to chat.
– Yvette Colomb♦
Jun 29 at 12:05