Search code examples
phpvirtuemart

PHP & Virtuemart: change color of a number if this number is bigger than 1


The code at the virtumart is:

<th align="center" bgcolor="#EEEEEE" style="border: 1px solid #CCCCCC;"><?php echo JText::_('COM_VIRTUEMART_ORDER_PRINT_QTY') ?></th>

What I need is the following: When the COM_VIRTUEMART_ORDER_PRINT_QTY is bigger than 1, the font color to be somehtinge else, for example red (the format I will do it later, now I just want the "if" code).

Thanks


Solution

  • Please try

    <?php
        $quantity = JText::_('COM_VIRTUEMART_ORDER_PRINT_QTY');
        if($quantity > 1){
            echo '<th align="center" bgcolor="#EEEEEE" style="border: 1px solid #CCCCC; color:#FF0000">'.$quantity.'</th>';
        }else{
            echo '<th align="center" bgcolor="#EEEEEE" style="border: 1px solid #CCCCCC;">'.$quantity.'</th>';
        }
    ?>