2010-04-28 3 views
-1

Comment est-ce que je peux emballer l'énoncé entier ci-dessous dans un état? Donc, si la variable $ uprice = 0 alors je ne veux pas afficher le code ci-dessousaide php conditionnelle

<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item- >getWeeeTaxAppliedAmount()): ?> 

    <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?> 

    <?php else: ?> 
    <?php echo $this->helper('checkout')->formatPrice($_item- >getCalculationPrice()) ?> 
    <?php endif; ?> 

Répondre

3

Ceci ??

<?php if ($uprice === 0): ?>  
    <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item- >getWeeeTaxAppliedAmount()): ?>  
    <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>  
    <?php else: ?> 
    <?php echo $this->helper('checkout')->formatPrice($_item- >getCalculationPrice()) ?> 
    <?php endif; ?> 
<?php endif; ?> 
+0

+1 ... vous bercez! : P – zaf

+0

@zaf: Merci ................. – Sarfraz

1
if ($uprice == 0){ 
    if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') 
     && $_item- >getWeeeTaxAppliedAmount()) 
    { 
    echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice() 
     +$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); 
    } else { 
    echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) 
    } 
}
1

Je pense que votre code serait plus lisible en contenant tout dans un bloc de php, et comme dit Sarfraz devrait pas être aussi simple que d'ajouter une condition autour du genre de choses?