0

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,

1
<?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
} 
?>
  • Jeez, thanks for that, was struggling for a day to get it to work, but was so simple. Thanks again – vincent nice Apr 2 '15 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.