1

我有以下数组:

   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)and的返回值getShippingMethod($order)

$this->getPaymentMethod($order)退货、现金交付或贝宝。如果返回值为 Cashondelivery,我希望将文本更改为“Cash on Collection”。

同样,getShippingMethod($order)退货、送货上门(这里有一些文字)或自取(这里有一些文字)。我想把它改成送货上门或自取,不用多说。如何在数组中执行此操作?

4

2 回答 2

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

也许这会有所帮助

于 2013-04-15T08:17:27.023 回答
0

你可以使用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));

文档 在这里

于 2013-04-15T08:10:54.053 回答