[-] BO : fix bug #PSCFV-2231 - blocklink problem when not in multishop

This commit is contained in:
tDidierjean
2012-05-09 14:10:33 +00:00
parent c19b032b4c
commit e80498c877
+20 -7
View File
@@ -183,14 +183,27 @@ class BlockLink extends Module
return false;
}
$assos_shop = Tools::getValue('checkBoxShopAsso_blocklink');
Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'blocklink_shop WHERE id_blocklink='.(int)$id_link);
foreach ($assos_shop as $asso)
foreach ($asso as $id_shop => $row)
Db::getInstance()->insert('blocklink_shop', array(
'id_blocklink' => (int)$id_link,
'id_shop' => (int)$id_shop,
));
if (!Shop::isFeatureActive())
{
Db::getInstance()->insert('blocklink_shop', array(
'id_blocklink' => (int)$id_link,
'id_shop' => (int)Context::getContext()->shop->id,
));
}
else
{
$assos_shop = Tools::getValue('checkBoxShopAsso_blocklink');
if (empty($assos_shop))
return false;
foreach ($assos_shop as $asso)
foreach ($asso as $id_shop => $row)
Db::getInstance()->insert('blocklink_shop', array(
'id_blocklink' => (int)$id_link,
'id_shop' => (int)$id_shop,
));
}
return true;
}