在Magento中设置默认装运方式

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Magento中设置默认装运方式相关的知识,希望对你有一定的参考价值。

Inspired by http://subesh.com.np/2010/08/magento-setting-default-shipping-method-cart-page/.
Basically Magento requires only countryId in shipment address to show shipment methods (at least in polish case). Very useful if you want user to select shipment method before specifying address.
This code must be put in init method of Mage_Checkout_Model_Cart or class that redefines it, just after line 122 (after Mage_Checkout_Model_Cart {...} in other words), otherwise it won't show up in cart when user first enters it, only when he/she refershes it.
  1. $shippingAddress = $this->getQuote()->getShippingAddress();
  2. if (!$shippingAddress->getCountryId()) {
  3. $shippingAddress->setCountryId('PL')->setShippingMethod('flatrate_flatrate')->save();
  4. $shippingAddress->save();
  5. }

以上是关于在Magento中设置默认装运方式的主要内容,如果未能解决你的问题,请参考以下文章

在 Magento 中设置全局变量,GUI 方式?

如何在运行时在由 android studio 创建的导航抽屉中设置默认片段

PayPal 订单在 Magento 中设置为“可疑欺诈”状态

Magento 在布局中设置多商店愿望清单错误

Magento在Dev服务器中设置机器人

在片段中设置文本颜色