1

I have this following array:

   return array(
        $order->getRealOrderId(),
        Mage::helper('core')->formatDate($order->getCreatedAt(), 'medium', true),
        $this->getPaymentMethod($order),
        $this->getShippingMethod($order),
        $this->formatPrice($order->getData('grand_total'), $order),
        $this->getTotalQtyItemsOrdered($order),
        $order->getCustomerName(),
        $order->getCustomerEmail(),
        $this->getStreet($billingAddress),
        $billingAddress->getData("postcode"),
        $billingAddress->getData("telephone"),
    );

I want to edit the return value of getPaymentMethod($order) and getShippingMethod($order).

$this->getPaymentMethod($order) returns, cashondelivery or paypal. I want the text to be changed to "Cash on Collection" if the return value is cashondelivery.

Similarily, getShippingMethod($order) returns, Home Delivery (some text here) or Self Collection (some text here). I want to change it to Home Delivery or Self Collection without the extra words. How can I do this within an array?

2 Answers 2

1
$this->getPaymentMethod($order) == "cashondelivery" ? "Cash On Collection" : "paypal"

Maybe this will help

Sign up to request clarification or add additional context in comments.

Comments

0

you can use str_replace function

str_replace('cashondelivery', 'Cash on Collection', $this->getPaymentMethod($order));

and

str_replace('whatever you want to display', 'whatever you want to change', $this->getShippingMethod($order));

documentation here

2 Comments

You welcome man, please accept the answer for future people with similar problems!
The other way is much easier. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.