magento -- 結賬時默認選中其中一種配送方式
用Magento給國內用戶做中文站,各種各樣的需求都會有,一個客戶要求前台結賬時某一種快遞方式是默認選中的,作為推薦使用的一種。舉個例子,前台可以選擇申通、圓通和順豐作為快遞方式,客戶會要求申通是默認選中的,這樣既對自己有利,也方便客戶。
下麵是修改方案:
打開文件/template/checkout/onepage/shipping_method/available.phtml,找到如下代碼
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" <?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
替換成
<?php if($_rate->getCode()== 'xxxx'):?> <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" <?php if(!$this->getAddressShippingMethod()) echo ' checked="checked"' ?> /> <?php else: ?> <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" <?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> /> <?php endif; ?>
其中xxxx代表你要默認選中的那種配送方式的code,比如tablerate_bestway是代表Table Rate這種方式
最後更新:2017-04-02 06:51:22