-1

i have this code in my shopping cart (magento 1.6.2)

<?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> */ ?>

This code calculates the needed amount for the customer to receive free shipping within the Netherlands.

Is there a way to add some code so when a vistor from a other country visits our webshop the amount is changed for free shipping. Like germany or belgium. They receive free shipping from 149,95.

I guess there should be a php if whick can determine the origin of the vistors ip-adress. Can anyone help me to set this up?

4

1 回答 1

0

这些是国家数据库和 API 的一些 IP。API 可能工作得很好,但你最终会为它们支付一些钱......

花点时间检查这个 PHP Class + DB:

https://github.com/magorski/php-ip-2-country

PS:也许数据库并没有那么糟糕,现在我正在一个真实的系统上使用一些 PHP 类和一个简单的数据库,它可以完成这项工作并且比我指出的那个要小得多。(也许不太精确或什么的)。

于 2013-05-02T11:13:37.160 回答