所以我有一些php代码,但我想从'回声这个'分开'echo',所以我可以把它们放入2个div,这样我就可以给他们一个单独的css(我已经发布了我的确切代码地点)。此代码是给出前端消息,以便人们可以看到在结账阶段之前的延迟交货。

<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,

有帮助吗?

解决方案

<?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
} 
?>
.
许可以下: CC-BY-SA归因
scroll top