News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Different payment method for different countries

Started by patrik60, February 12, 2008, 17:32:23 PM

Previous topic - Next topic

patrik60

In my future shop I will have different payment methods for people from Switzerland (Invoice, Paypal) and from abroad (payment in advance and Paypal). If a user has registrated and starts the checkout process he will see all three methods (Invoice, Payment in advance, Paypal). It would be better if the user sees only "his" possibilities, either 1) Invoice, 2) Paypal or 1) payment in advance, 2) Paypal. That for I need to create two groups: Swissgroup and Internationalgroup. The user should automaticly be assigned to one of these groups when he fills out the form, depending from which country he is.

I have found a hack, which works also in VM 1.1.0: replacing the following code in ps_shopper.php

if( empty($d['shopper_group_id'])) {
$q =  "SELECT shopper_group_id from #__{vm}_shopper_group WHERE ";
$q .= "`default`='1' ";

$db->query($q);
if (!$db->num_rows()) {  // take the first in the table

$q =  "SELECT shopper_group_id from #__{vm}_shopper_group";
$db->query($q);
}
$db->next_record();
$d['shopper_group_id'] = $db->f("shopper_group_id");
}


with

if( empty($d['shopper_group_id'])) {
$q =  "SELECT shopper_group_id from #__{vm}_shopper_group WHERE ";
$q .= "`default`='1' ";

$db->query($q);
if (!$db->num_rows()) {  // take the first in the table

$q =  "SELECT shopper_group_id from #__{vm}_shopper_group";
$db->query($q);
}
$db->next_record();
if( $d["country"]=='CHE')
            $d['shopper_group_id'] = '8';
            else
            $d['shopper_group_id'] = '9';
}


Somehow I don't feel comfortable with this solution, because there are always a lot of changes in the developement of VM.
Therefore my suggestion:
Couldn't it be possible to assign payment methods not only to different shoppergroups but also to different countries?

Patrik


mkonc

Should shopper group change for existing users also after applying this hack. And one more thing. In my ps_shopper.php  line:
Quoteif( empty($d['shopper_group_id'])) {
doesn't exist.