VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Virtuemart 1.1 Development (Archiv) => Quality & Testing VirtueMart 1.1.x => Topic started by: patrik60 on February 12, 2008, 17:32:23 PM

Title: Different payment method for different countries
Post by: patrik60 on February 12, 2008, 17:32:23 PM
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
Title: Re: Different payment method for different countries
Post by: aravot on February 12, 2008, 17:53:57 PM
This request will get lost as the post grow please post it in feature request section too http://dev.virtuemart.net/cb/proj/tracker/browseTracker.do?tracker_id=3
Title: Re: Different payment method for different countries
Post by: mkonc on March 11, 2008, 16:06:13 PM
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.
Title: Re: Different payment method for different countries
Post by: patrik60 on March 12, 2008, 16:48:48 PM
see line 373

VM SVN 1311
Title: Re: Different payment method for different countries
Post by: aravot on May 01, 2008, 19:45:51 PM
Check out this one http://forum.virtuemart.net/index.php?topic=39543.0