[-] MO : #PSCFV-2437 : Bug fix adding block using multishop
This commit is contained in:
@@ -119,6 +119,7 @@ class BlockCMSModel extends ObjectModel
|
|||||||
{
|
{
|
||||||
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
|
$sql = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cms_block_shop` (
|
||||||
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
|
`id_cms_block` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`id_group_shop` int(10) unsigned NOT NULL,
|
||||||
`id_shop` int(10) unsigned NOT NULL,
|
`id_shop` int(10) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`id_cms_block`, `id_shop`)
|
PRIMARY KEY (`id_cms_block`, `id_shop`)
|
||||||
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
|
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8';
|
||||||
@@ -157,10 +158,10 @@ class BlockCMSModel extends ObjectModel
|
|||||||
return Db::getInstance()->Insert_ID();
|
return Db::getInstance()->Insert_ID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function insertCMSBlockShop($id_cms_block, $id_shop)
|
public static function insertCMSBlockShop($id_cms_block, $id_group_shop, $id_shop)
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_shop` (`id_cms_block`, `id_shop`)
|
$sql = 'INSERT INTO `'._DB_PREFIX_.'cms_block_shop` (`id_cms_block`, `id_group_shop`, `id_shop`)
|
||||||
VALUES('.(int)$id_cms_block.', '.(int)$id_shop.')';
|
VALUES('.(int)$id_cms_block.', '.(int)$id_group_shop.', '.(int)$id_shop.')';
|
||||||
|
|
||||||
Db::getInstance()->execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
|
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ class BlockCms extends Module
|
|||||||
foreach ($this->context->controller->_languages as $language)
|
foreach ($this->context->controller->_languages as $language)
|
||||||
BlockCMSModel::insertCMSBlockLang($id_cms_block, $language['id_lang']);
|
BlockCMSModel::insertCMSBlockLang($id_cms_block, $language['id_lang']);
|
||||||
|
|
||||||
BlockCMSModel::insertCMSBlockShop($id_cms_block, Shop::getContextShopGroupID(), Shop::getContextShopID());
|
BlockCMSModel::insertCMSBlockShop($id_cms_block, $this->context->shop->id_shop_group, $this->context->shop->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_errors[] = $this->l('New block cannot be created !');
|
$this->_errors[] = $this->l('New block cannot be created !');
|
||||||
|
|||||||
Reference in New Issue
Block a user