Reputation: 157
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?
Upvotes: 1
Views: 115
Reputation: 23490
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
Upvotes: 0
Reputation: 216
$this->getPaymentMethod($order) == "cashondelivery" ? "Cash On Collection" : "paypal"
Maybe this will help
Upvotes: 1