A little php/html help
-
12-12-2019 - |
Question
So I got some php code, but I want to separate the 'echo' from the 'echo this' so I can put them into 2 DIVs so that I can give them individual css (I have posted the exact code from my site). This code is to give a frontend message so that people can see that items are for backorder BEFORE the checkout phase.
<div class="extra-info">
<?php $inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
$inv_qty = (int)$inventory->getQty();
if ($inventory->getBackorders() >= 0 && $inv_qty == 0) {
echo "TO ORDER - LEAD TIME APROX. 3 WEEKS";
} else {
echo $this->getChildHtml('product_type_availability');
}
?>
</div>
Thx,
Solution
<?php $inventory = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product);
$inv_qty = (int)$inventory->getQty();
if ($inventory->getBackorders() >= 0 && $inv_qty == 0) {
?>
<div class="extra-info-a">TO ORDER - LEAD TIME APROX. 3 WEEKS</div>
<?php
} else {
?>
<div class="extra-info-b"><?php echo $this->getChildHtml('product_type_availability');?></div>
<?php
}
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange