-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