Restrict Payment Gateway According Shipping Method In Prestashop 1.7
On 4th November 2016 Prestashop 1.7 has been released with Symfony framework.
In Prestashop 1.7 their are major changes at code and functionality end.
In Prestashop 1.7, you can restrict payment gateway on the basis of shipping method.
Their are two way to restrict payment gateway on the basis of shipping method.
1.) From back office
2.) By code
1.) From back office:
You can restrict payment gateway according shipping method in backoffice from
“Payment->Preferences->Carrier restrictions” select shipping method according payment gateway and save.
2.) By Code:
Prestashop add new table “module_carrier” to save shipping method and payment gateway mapping so now you can add or remove payment gateway according shipping method.
foreach (Module::getPaymentModules() as $module) { Db::getInstance()->execute(' INSERT INTO `'._DB_PREFIX_.'module_'.bqSQL('carrier').'` (`id_module`, `id_shop`, `id_reference`) VALUES ('.(int) $module['id_module'].','.(int) $shopId.','.(int) $this->id.')' ); }
Here `id_module` is payment gateway module id, `id_shop` is shop id and `id_reference` is shipping method id.
Be the first to comment.