Jump to content

payment module, available just for several countries


Stanciu Valentin

Recommended Posts

Hi

i just finished a new payment module, and i'm very happy that everything is working alright from the install to the checkout of and order.
But each time when i install the module, i see that in the "Countries restrictions" box from "Payments" tab, my module is available for all countries
So my question is how can i set it up so when the module is installed it will just check the countries that i need.

Thank you

Link to comment
Share on other sites

I'm not sure how PrestaShop works with payment restrictions when installing modules. I'm guessing it just adds it to add countries. If it does, you could try adding a query to the install function of your module to remove the module from certain countries. For example:

$module = Db::getInstance()->executeS("SELECT `id_module` FROM `"._DB_PREFIX_."module` WHERE `name` = '".$this->name."'");
if (sizeof($module) > 0)
  Db::getInstance()->execute("DELETE FROM `"._DB_PREFIX_."module_country` WHERE `id_module` = ".$module[0]['id_module']." AND (`id_country` != 1 OR `id_country` != 2)");



Change 1 and 2 to the IDs of countries you want the module to be in. You can add more if necessary.

Link to comment
Share on other sites

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...