-1
我有我的购物车代码(Magento的1.6.2)腓如果选择按产地访问者(IP地址)
<?php if ($this->getQuote()->getSubtotal() < 41.28): ?>
<?php $subtotalamt = $this->getQuote()->getSubtotal(); ?>
<?php $freeshipamt = 41.28; ?>
<?php $sumtotal = ($freeshipamt - $subtotalamt)* 1.21; ?>
<?php Mage::helper('checkout')->formatPrice($sumtotal); ?>
<p>Gratis verzending vanaf € 49,95 <br/>(binnen Nederland)</p><p>
<strong>Nog <span>€ <?php print number_format($sumtotal, 2, ',', ' '); ?></span>
tot gratis verzending!</strong></p>
<?php else: ?><p><strong>Uw bestelling wordt GRATIS verzonden!</strong> <br/>(binnen Nederland)</p>
<?php endif ?>
<?php /* You are just <span>$<?php print ($sumtotal); ?></span> away from earning free shipping!</p> */ ?>
此代码计算客户在荷兰境内免运费所需金额。
有没有办法添加一些代码,所以当一个来自其他国家的访客访问我们的网上商店的金额改变了免费送货。像德国或比利时一样。他们从149,95收到免费送货。
我想应该有一个php if
whick可以确定访问者ip-adress的来源。 任何人都可以帮我设置这个吗?
可能的重复[如何从IP地址中获取国家/地区名称](http://stackoverflow.com/questions/4191489/how-to-get-country-name-from-ip-address-in-php ) – Quentin 2013-05-02 11:16:08