嘿伙计们,我的 magento 商店中只有一种称为 JNE http://www.magentocommerce.com/magento-connect/suhanto-jne.html的运输方式
我想在我的客户填写他的城市时自动选择运输方式。
我已经搜索并找到了这个: http: //www.magentocommerce.com/boards/viewthread/9223/#t33602
他的解决方案是这样的
// find methods loop:
<?php foreach ($_rates as $_rate): ?>
// add checking for free shipping method and setting it as default
<?php if ($_rate->getCode()=='freeshipping_freeshipping' && !$this->getAddress()->getShippingMethod()) {
$this->getAddress()->setShippingMethod($_rate->getCode());
} ?>
我不知道应该将代码放在 available.html 中的哪个位置
顺便说一句,我的 available.html 中有这段代码
<?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
<strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong>
<dl class="shipment-methods">
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
<dt><?php echo $this->getCarrierName($code) ?></dt>
<dd>
<ul>
<?php foreach ($_rates as $_rate): ?>
<li>
<?php if ($_rate->getErrorMessage()): ?>
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
<?php else: ?>
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> onclick="shippingMethodStep.save()"/>
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
<strong>
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
<?php echo $_excl; ?>
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
<?php endif; ?>
</strong>
</label>
<?php endif ?>
</li>
<?php endforeach; ?>
</ul>
</dd>
<?php endforeach; ?>
你能告诉我应该在哪里替换或添加该解决方案吗?
或者可能是自动选择 jne 运输方式的另一种解决方案