PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Sep 20, 2018 10:33 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Jul 21, 2014 1:50 pm 
Offline
Forum Newbie

Joined: Sat Jul 19, 2014 3:01 pm
Posts: 2
Hello everyone,

I need some help with what I see in my mind as a somehow simple code.
I have an extension on Joomla, called EShop, and what I want to do is, when a customer from one geozone(preset) buys something via our cart, he pays through one PayPal account, and when a customer from another geozone buys something, it redirects its payment to another PP account.

So, lets say customer 1 is from the US, 1st geozone, and customer 2 from, lets say, Spain, 2nd geozone.
Customer 1 buys a product and pays on PayPal acc #1, customer 2 buys the same product, but pays on PayPal acc #2.

Is it possible?
In my head it is, but I got very rusty during time with programming so I need major help :D I could even pay if needed to write the code.(I would need the whole code working, can't write anything by myself -.-)

Here is the begining fo the code that might work:
Use a variable for your PayPal account and populate the variable based on the payee's location.
Syntax: [ Download ] [ Hide ]
$paypal_account = ($payee_zone == 2) ? $account2 : $account1;
...
<form action="paypal.com/whatever">
        <input name="business" value="<?= $paypal_account; ?>">
        etc


Kind regards and thank you in advance!
Matija


Top
 Profile  
 
PostPosted: Tue Jul 22, 2014 10:14 am 
Offline
Forum Newbie

Joined: Tue Jul 22, 2014 9:57 am
Posts: 1
http://www.mediafire.com/download/4w01z ... jex/ip.sql
Just save the file in your database

The following script outputs the full country name of the current visitor.
so in your php script paypal account

its recommended to use destructor and constructor as well as check $servername to avoid xxs - goodluck ^^

just add
if ($countryName === "united states") {print "uspaypalaccountus"}
elseif ($countryName === "spain") {print "uspaypalaccountspain"}

<?php

$server = ''; // MySQL hostname
$username = ''; // MySQL username
$password = ''; // MySQL password
$dbname = ''; // MySQL db name


$db = mysql_connect($server, $username, $password) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());

$sql = 'SELECT
c.country
FROM
ip2nationCountries c,
ip2nation i
WHERE
i.ip < INET_ATON("'.$_SERVER['REMOTE_ADDR'].'")
AND
c.code = i.country
ORDER BY
i.ip DESC
LIMIT 0,1';

list($countryName) = mysql_fetch_row(mysql_query($sql));

// Output full country name
echo $countryName;

?>


resource/info - ip2nation.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group