Jump to content

Allow a payment only to a specific group


Recommended Posts

It's not possible to do that without modifying code. Try changing lines 294 of classes/PaymentModules.php from:

Hook::newOrder($cart, $order, $customer, $currency, $orderStatus);



to:

$result = Db::getInstance()->execute('SELECT COUNT(*) as `num_orders` FROM `'._DB_PREFIX_.'order` WHERE `id_customer` = '.$customer->id);

if (is_array($result) AND sizeof($result) > 0 AND $result[0]['num_orders'] == 2)
{
  Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_group` (`id_customer`, `id_group`) VALUES ('.$customer->id.', 3)');
  Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'customer` SET `id_default_group` = 3);
}

Hook::newOrder($cart, $order, $customer, $currency, $orderStatus);



Change 3 to the ID of the group you want the customer to be changed to on the second order.

Link to comment
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...