Magento 基于所选货币的装运限制
我需要根据所选货币实施发货限制 例如: 如果人们选择/使用美元结账,他们的送货地址只能在美国,如果人们在货币下拉列表中选择英镑,他们的送货地址只能在英国 有人知道我怎样才能做到吗?我是一名初级开发人员,这是我的第一个Maganto项目 以下是我的可用.phtml文件:Magento 基于所选货币的装运限制,magento,currency,shipping,Magento,Currency,Shipping,我需要根据所选货币实施发货限制 例如: 如果人们选择/使用美元结账,他们的送货地址只能在美国,如果人们在货币下拉列表中选择英镑,他们的送货地址只能在英国 有人知道我怎样才能做到吗?我是一名初级开发人员,这是我的第一个Maganto项目 以下是我的可用.phtml文件: <?php $_shippingRateGroups = $this->getShippingRates(); ?> <?php if (!$_shippingRateGroups)
<?php $_shippingRateGroups = $this->getShippingRates(); ?>
<?php if (!$_shippingRateGroups): ?>
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
<?php else: ?>
<dl class="sp-methods">
<?php $shippingCodePrice = array(); ?>
<?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
<dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
<dd>
<ul>
<?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
<?php $shippingCodePrice[] = "'".$_rate->getCode()."':".(float)$_rate->getPrice(); ?>
<li>
<?php if ($_rate->getErrorMessage()): ?>
<ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>
<?php else: ?>
<?php if ($_sole) : ?>
<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
<?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"' ?> class="radio"/>
<?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
<script type="text/javascript">
//<![CDATA[
lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
//]]>
</script>
<?php endif; ?>
<?php endif; ?>
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
<?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; ?>
</label>
<?php endif ?>
</li>
<?php endforeach; ?>
</ul>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
//<![CDATA[
<?php if (!empty($shippingCodePrice)): ?>
var shippingCodePrice = {<?php echo implode(',',$shippingCodePrice); ?>};
<?php endif; ?>
$$('input[type="radio"][name="shipping_method"]').each(function(el){
Event.observe(el, 'click', function(){
if (el.checked == true) {
var getShippingCode = el.getValue();
<?php if (!empty($shippingCodePrice)): ?>
var newPrice = shippingCodePrice[getShippingCode];
if (!lastPrice) {
lastPrice = newPrice;
quoteBaseGrandTotal += newPrice;
}
if (newPrice != lastPrice) {
quoteBaseGrandTotal += (newPrice-lastPrice);
lastPrice = newPrice;
}
<?php endif; ?>
checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
return false;
}
});
});
//]]>
</script>
<?php endif; ?>
class=“收音机”/>
//getPrice();?>;
//]]>
您可以根据货币类型限制装运方式。去医院吧
app\design\frontend\base\default\template\checkout\onepage\shipping\u method\available.phtml
并通过在此处获取购物车获取货币。现在,根据货币的简单的If/Else条件,您可以限制运输方式。您也可以根据付款确认邮政编码。写一个ajax代码来验证Zipt谢谢你的帮助,你已经向我解释了很多。但我仍然有一个问题,如何实现这一点。我的理解是:如何在实际的结账过程中实现它?调用ajax并从发货地址传递邮政编码。和使用。用于根据邮政编码检查国家。您能更具体一点吗。我不熟悉Ajax。这也是我的第一个magento项目。您的第一个解决方案是逻辑。你能告诉我如何实施这一点吗。谢谢