Restriccion para categoría por pais
Iniciado por
Pelayo Martin
, abr 10 2014 19:00
Pulsa corazón para recibir avisos de nuevas Respuestas
Pelayo Martin
AUTOR PREGUNTA
#1
Publicado 10 abril 2014 - 19:00
¿Es un poco rebuscada esta pregunta pero pregunto si existe una forma de hacer en prestashop una restricción para que una categoría no este disponible en un país determinado? Gracias de antemano
Esto también te interesa!
Pelayo Martin
AUTOR PREGUNTA
#2
Publicado
11 abril 2014 - 05:50
Con el siguiente código lo pude hacer, lo dejo aquí por si alguién más lo necesita:
public function getRestrictedCountries($obj) {
$country = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT DISTINCT id_country FROM `'._DB_PREFIX_.'category_country_restriction` WHERE id_category = ' . (int)Tools::getValue('id_category') . ';'); $blacklisted_countries = array();
if (is_array($country))
foreach ($country as $cnt)
$blacklisted_countries[] = $cnt['id_country'];
$c_todos = Country::getCountries(Context::getContext()->language->id);
oreach ($c_todos as $c) $this->fields_value['restricted_countries_'.$c['id_country']] = Tools::getValue('restricted_countries_'.$c['id_country'], (in_array($c['id_country'], $blacklisted_countries))); }