在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.
$shippingAddress = $this->getQuote()->getShippingAddress(); if (!$shippingAddress->getCountryId()) { $shippingAddress->setCountryId('PL')->setShippingMethod('flatrate_flatrate')->save(); $shippingAddress->save(); }
以上是关于在Magento中设置默认装运方式的主要内容,如果未能解决你的问题,请参考以下文章
如何在运行时在由 android studio 创建的导航抽屉中设置默认片段