jeudi 29 juin 2017

PHP conditional string echo [on hold]

I need to print out a different text depending on what the $get_payment_method variable includes. The following code prints out either "cod" or "thepaycard".

<?php printf( $this->order->get_payment_method() ); ?>

I need to get that changed to "Dobírka" and "Kartou". Could you please suggest, what I'm doing wrong? Here is the code I've come up with:

<?php 
$platba = (string)$payment_method; 
if (strpos($platba, 'cod') !== false) {
    echo "Dobírka";
} else {
    echo "Kartou";
}?>

Thank you

Aucun commentaire:

Enregistrer un commentaire