0

I'm trying to change the payment method label on my checkout page. I want to display an image for the particular method. My original code was:

<label for="p_method_<?php echo $_code ?>" style="text-transform:none">
<?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> 
<?php echo $this->getMethodLabelAfterHtml($_method) ?></label>

Here is what I am trying to do: The name of the method I want to change is "Laybuy"

<label for="p_method_<?php echo $_code ?>" style="text-transform:none">
<?php if($this->getMethodTitle($_method) = "Laybuy "): ?>
<img>goes here
<?php else: ?>
<?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> 
<?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
<?php endif; ?>

But it is not working at all. I am a complete php noob. How can I get this to work.

2

Please try below.

Just go to phtml file of your payment method and you can try below code.

$img_url = $this->getSkinUrl('rwd/default/images/logo.png');

if ( $this->getMethodCode() == "your_payment_method_code" ) {
     <img width="100" src="<?php echo $img_url;?>" alt="<?php echo $this->__('Payment'); ?>" />
} else {
    // title here.
}
  • How would I get the payment method code? I have tried echo $this->getMethodCode($_method) for each method but it returns norhing?? – Pragman Aug 20 '17 at 2:37
  • Just echo $this->getMethodCode() this in phtml file of payment method and you can see your payment method code. – Vish Aug 21 '17 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.