我有这样一个数组:
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"),
);
我想编辑getPaymentMethod($order)
和getShippingMethod($order)
的返回值。
$this->getPaymentMethod($order)
退货,现金交付或paypal。如果返回值是cashondelivery,我想将文本更改为"Cash on Collection"。
同样,getShippingMethod($order)
返回,Home Delivery(这里的一些文本)或Self Collection(这里的一些文本)。我想把它改成送货上门或自助收件,不需要额外的文字。如何在数组中做到这一点?
$this->getPaymentMethod($order) == "cashondelivery" ? "Cash On Collection" : "paypal"
可能会有帮助
可以使用str_replace
函数
str_replace('cashondelivery', 'Cash on Collection', $this->getPaymentMethod($order));
和
str_replace('whatever you want to display', 'whatever you want to change', $this->getShippingMethod($order));
文档在