Restrict Payment Gateway According Shipping Method In Prestashop 1.7

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.

Comments

Popular Posts