Magento 1.8中没有相应地显示装运方法
如何根据我在排序顺序的输入字段中设置的订单号显示发货方式列表 我已在后台设置了每种配送方式的排序顺序,但它们不会相应显示 例如,在我的后台,我有这些运送方法Magento 1.8中没有相应地显示装运方法,magento,sorting,shipping,Magento,Sorting,Shipping,如何根据我在排序顺序的输入字段中设置的订单号显示发货方式列表 我已在后台设置了每种配送方式的排序顺序,但它们不会相应显示 例如,在我的后台,我有这些运送方法 Method Name: bestway Sort Order: 1 Method Name: Free Sort Order: 2 Method Name: Chronopost Sort Order: 3 但它们不会按此顺序显示在frontend\argenties\default\template\checkout/cart/s
Method Name: bestway
Sort Order: 1
Method Name: Free
Sort Order: 2
Method Name: Chronopost
Sort Order: 3
但它们不会按此顺序显示在frontend\argenties\default\template\checkout/cart/shipping.phtml
<?php
$methods = Mage::getSingleton('shipping/config')->getActiveCarriers();
$shipping = array();
foreach($methods as $_ccode => $_carrier):
if($_methods = $_carrier->getAllowedMethods()):
if(!$_title = Mage::getStoreConfig("carriers/$_ccode/title"))
$_title = $_ccode;
foreach($_methods as $_mcode => $_method):
$_code = $_ccode . '_' . $_mcode;
$shipping[$_code] = array('title' => $_method,'carrier' => $_title);
?>
<li><input type="radio" name="estimate_method" value="<?php echo $_code;?>" id="s_method_<?php echo $_code ?>"<?php if($_code === $this->getAddressShippingMethod()) echo ' checked="checked"' ?>> <span class="item-text-shipping-method"><?php echo $_title;?></span></li>
<?php endforeach;?>
<?php endif;?>
<?php endforeach;?>
methodname:bestway
应该在列表的顶部,但它总是被放到第二位。为什么?你知道我该怎么修吗?
<?php
foreach ($_shippingRateGroups as $code => $_rates):?>
<?php foreach ($_rates as $_rate): ?>
<li>
<input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
<span class="item-text-shipping-method">
<?php echo $this->getCarrierName($code);?>
</span>
</li>
<?php endforeach; ?>
class=“收音机”/>
试试这段代码,我从base/default/checkout/cart/shipping.phtml文件中警告了这段代码发货方法是根据价格排序的,当它们都是相同的价格时,它不会查看其他字段来确定哪一个应该先到 我有一个类似的问题,我的交货方法是以一个固定的价格,所以我在
Mage/Shipping/Model/Rate/Results.php
文件中添加了额外的排序标准,特别是sortRatesByPrice()
函数
如果要更改核心文件,请确保将其复制到本地池。请注意以下事实:
此代码有时无法显示装运方法。我必须重新装填才能看到它们。
<?php
foreach ($_shippingRateGroups as $code => $_rates):?>
<?php foreach ($_rates as $_rate): ?>
<li>
<input name="estimate_method" type="radio" value="<?php echo $this->escapeHtml($_rate->getCode()) ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio" />
<span class="item-text-shipping-method">
<?php echo $this->getCarrierName($code);?>
</span>
</li>
<?php endforeach; ?>