jeudi 24 novembre 2016

PHP else statement

I am having a problem with the currency sign showing up when there is no reason for it to show up. It al goes well when the "if" statements are correct. But i need a correct else statement if the statements are incorrect. Then there should be no currency sign showing up at all

Here is the code without the "else" statement:

    foreach ($this->dataitems as $item  ) {
    $product_title=$item['title'];
    $product_id=$item['items_id'];
    $feed=$item['feed'];
    $alt=df_alt($item['title']);
    $product_ref=$item['url'];
    $product_description=$item['description'];
    $product_price=$item['Prijs'];
    $from_price=$item['Select9'];
    $product_image=$item['image'];
    $korting = $from_price - $product_price;
    echo '<li>';
    echo '<div itemscope itemtype="http://schema.org/Offer"><a  target="_blank" href="'.$product_ref.'" itemprop="url" rel="nofollow"></div>';
    echo '<div itemscope itemtype="http://schema.org/Offer"><span itemprop="name"><h2>'.$product_title.'</h2></span></div>';

    echo '<div itemscope itemtype="http://schema.org/Offer"><img class="product" <img itemprop="image"  src="'.$product_image.'" alt="'.$alt.' />" /></a></div>';
    $price_formated=$currency.' '.money_format('%!.2n', $product_price);

$Highprice_formated=$currency.' '.money_format('%!.2n', $from_price); if ($product_price > 0 ) { print 'Nu '.$currency.' '.$product_price.''; } echo ''.$price_formated.'

'; if ( $from_price > $product_price ) { print 'Oude prijs '.$currency.' '.$from_price.''; } echo ''.$Highprice_formated.''; if ( $product_price < $from_price ) { print 'Korting '.$currency.''.$korting.'';
} 

Here is a image when all is going correct and second when it is going wrong you see the currency sign still enter image description here

enter image description here

Aucun commentaire:

Enregistrer un commentaire