1

I'm new to Magento and trying to edit the success page on 1.9x

All I want is to add payment details for some payment methods. If the customer selects BANK TRANSFER, I want My_Block to be shown on the success page (these are the bank transfer details 'My bank account #00000') I would like to apply the same to maybe other payments.

I've tried many statements, but nothing so far.

    <?php if(payment === 'banktransfer'): ?>
    <p><?php echo $this->__('My_block') ?></p>
<?php elseif(payment === 'checkmo'): ?>
    <p><?php echo $this->__('My_block2');?></p> 
<?php else(payment === 'purchaseorder'): ?>
    <p><?php echo $this->__('My_block3') ?></p>
<?php endif; ?>

Any ideas on how to achieve this? Thank you for your help

2
  • Have you got your solution ? – Pawan Mar 5 '18 at 17:57
  • I haven't found a solution yet. – Geo Mar 6 '18 at 1:40
0

First you need to get payment method for the last order. You can use below code on success.phtml

<?php if ($this->getOrderId()):?>
    <div class="bank_detail">
    <?php $orderId = $this->getOrderId(); ?>
    <?php $order = Mage::getModel("sales/order")->loadByIncrementId($orderId); //load order by increment id?>
    <?php $paymentCode = $order->getPayment()->getMethod(); ?>

       <?php if ($paymentCode=='checkmo') { 
           echo "whatever you want!";
       } //you can also check for other payment method?>

   </div>
<?php endif;?>

Explanation: First we load order by its increment id and get payment method from the loaded order. We can check for payment method echo content based on method.

Hope above will help.

2
  • welcome @Geo, If have any issue, feel free to ask. – Pawan Mar 7 '18 at 17:23
  • Great.welcome @Geo – Pawan Mar 8 '18 at 4:01

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.