Commit dffa9ed2 authored by vAugagneur's avatar vAugagneur

[-] MO : fixed bug #PSCFV-4602

parent 76200a6d
......@@ -79,6 +79,7 @@ class Blocktopmenu extends Module
!$this->registerHook('actionObjectProductUpdateAfter') ||
!$this->registerHook('actionObjectProductDeleteAfter') ||
!$this->registerHook('categoryUpdate') ||
!$this->registerHook('actionShopDataDuplication') ||
!$this->installDB())
return false;
return true;
......@@ -341,7 +342,7 @@ class Blocktopmenu extends Module
$this->_html .= '
<fieldset>
<legend><img src="../img/admin/add.gif" alt="" title="" />'.$this->l('Add Menu Top Link').'</legend>
<legend>tptptp<img src="../img/admin/add.gif" alt="" title="" />'.$this->l('Add Menu Top Link').'</legend>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" id="form">
';
......@@ -855,4 +856,37 @@ class Blocktopmenu extends Module
{
$this->_clearCache('blocktopmenu.tpl');
}
public function hookActionShopDataDuplication($params)
{
$linksmenutop = Db::getInstance()->executeS('
SELECT *
FROM '._DB_PREFIX_.'linksmenutop
WHERE id_shop = '.(int)$params['old_id_shop']
);
foreach($linksmenutop as $id => $link)
{
Db::getInstance()->execute('
INSERT IGNORE INTO '._DB_PREFIX_.'linksmenutop (id_linksmenutop, id_shop, new_window)
VALUES (null, '.(int)$params['new_id_shop'].', '.(int)$link['new_window'].')');
$linksmenutop[$id]['new_id_linksmenutop'] = Db::getInstance()->Insert_ID();
}
foreach($linksmenutop as $id => $link)
{
$lang = Db::getInstance()->executeS('
SELECT id_lang, '.(int)$params['new_id_shop'].', label, link
FROM '._DB_PREFIX_.'linksmenutop_lang
WHERE id_linksmenutop = '.(int)$link['id_linksmenutop'].' AND id_shop = '.(int)$params['old_id_shop']);
foreach($lang as $l)
Db::getInstance()->execute('
INSERT IGNORE INTO '._DB_PREFIX_.'linksmenutop_lang (id_linksmenutop, id_lang, id_shop, label, link)
VALUES ('.(int)$link['new_id_linksmenutop'].', '.(int)$l['id_lang'].', '.(int)$params['new_id_shop'].', '.(int)$l['label'].', '.(int)$l['link'].' )');
}
}
}
......@@ -29,8 +29,6 @@ class MenuTopLinks
{
public static function gets($id_lang, $id_linksmenutop = null, $id_shop)
{
$id_shop = (int)((bool) Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE')) ? $id_shop : 0;
$sql = 'SELECT l.id_linksmenutop, l.new_window, ll.link, ll.label
FROM '._DB_PREFIX_.'linksmenutop l
LEFT JOIN '._DB_PREFIX_.'linksmenutop_lang ll ON (l.id_linksmenutop = ll.id_linksmenutop AND ll.id_lang = '.(int)$id_lang.' AND ll.id_shop='.(int)$id_shop.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment