阅读550 返回首页    go 阿里云 go 技术社区[云栖]


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

  上一篇:go 纸塔游戏
  下一篇:go 关于 Oracle 的数据导入导出及 Sql Loader (sqlldr) 的用法