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
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
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.
see line 373
VM SVN 1311
Check out this one http://forum.virtuemart.net/index.php?topic=39543.0