Reading list Switch to dark mode

    Restrict Payment Gateway According Shipping Method In Prestashop 1.7

    Updated 7 December 2016

    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.

    Searching for an experienced
    Prestashop Company ?
    Find out More

    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.

    Restrict Payment Gateway According Shipping Method

     

    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.

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home