//add payment module restriction when enable country

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17658 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
vAugagneur
2012-10-01 15:40:11 +00:00
parent 1d17f750a9
commit 145d34a291
4 changed files with 56 additions and 15 deletions
+6 -14
View File
@@ -111,21 +111,13 @@ abstract class PaymentModuleCore extends Module
*/
public function addCheckboxCountryRestrictionsForModule(array $shops = array())
{
if (!$shops)
$shops = Shop::getShops(true, null, true);
foreach ($shops as $s)
{
if (!Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'module_country` (`id_module`, `id_shop`, `id_country`)
SELECT '.(int)$this->id.', "'.(int)$s.'", `id_country` FROM `'._DB_PREFIX_.'country` WHERE active = 1'))
return false;
}
return true;
$countries = Country::getCountries((int)Context::getContext()->cookie->id_lang, true); //get only active country
$country_ids = array();
foreach ($countries as $country)
$country_ids[] = $country['id_country'];
return Country::addModuleRestrictions($shops, $countries, array(array('id_module' => (int)$this->id)));
}
/**
* Validate an order in database
* Function called from a payment module