// Fix language error caused by blocktopmenu incorrect identifier
This commit is contained in:
@@ -36,7 +36,7 @@ class blocktopmenu extends Module
|
|||||||
{
|
{
|
||||||
$this->name = 'blocktopmenu';
|
$this->name = 'blocktopmenu';
|
||||||
$this->tab = 'front_office_features';
|
$this->tab = 'front_office_features';
|
||||||
$this->version = 1.3;
|
$this->version = 1.4;
|
||||||
$this->author = 'PrestaShop';
|
$this->author = 'PrestaShop';
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -60,7 +60,7 @@ class blocktopmenu extends Module
|
|||||||
{
|
{
|
||||||
return (Db::getInstance()->execute('
|
return (Db::getInstance()->execute('
|
||||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop` (
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop` (
|
||||||
`id_link` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
`id_linksmenutop` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
`id_shop` INT UNSIGNED NOT NULL,
|
`id_shop` INT UNSIGNED NOT NULL,
|
||||||
`new_window` TINYINT( 1 ) NOT NULL,
|
`new_window` TINYINT( 1 ) NOT NULL,
|
||||||
`link` VARCHAR( 128 ) NOT NULL,
|
`link` VARCHAR( 128 ) NOT NULL,
|
||||||
@@ -68,11 +68,11 @@ class blocktopmenu extends Module
|
|||||||
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;') AND
|
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;') AND
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('
|
||||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` (
|
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` (
|
||||||
`id_link` INT NOT NULL,
|
`id_linksmenutop` INT NOT NULL,
|
||||||
`id_lang` INT NOT NULL,
|
`id_lang` INT NOT NULL,
|
||||||
`id_shop` INT NOT NULL,
|
`id_shop` INT NOT NULL,
|
||||||
`label` VARCHAR( 128 ) NOT NULL ,
|
`label` VARCHAR( 128 ) NOT NULL ,
|
||||||
INDEX ( `id_link` , `id_lang`, `id_shop`)
|
INDEX ( `id_linksmenutop` , `id_lang`, `id_shop`)
|
||||||
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'));
|
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,9 +118,9 @@ class blocktopmenu extends Module
|
|||||||
}
|
}
|
||||||
if(Tools::isSubmit('submitBlocktopmenuRemove'))
|
if(Tools::isSubmit('submitBlocktopmenuRemove'))
|
||||||
{
|
{
|
||||||
$id_link = Tools::getValue('id_link', 0);
|
$id_linksmenutop = Tools::getValue('id_linksmenutop', 0);
|
||||||
MenuTopLinks::remove($id_link, (int)$this->context->shop->id);
|
MenuTopLinks::remove($id_linksmenutop, (int)$this->context->shop->id);
|
||||||
Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK'.$id_link.',', 'LNK'.$id_link), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS')));
|
Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', str_replace(array('LNK'.$id_linksmenutop.',', 'LNK'.$id_linksmenutop), '', Configuration::get('MOD_BLOCKTOPMENU_ITEMS')));
|
||||||
$this->_html .= $this->displayConfirmation($this->l('The link has been removed'));
|
$this->_html .= $this->displayConfirmation($this->l('The link has been removed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ class blocktopmenu extends Module
|
|||||||
$this->_html .= '<optgroup label="'.$this->l('Menu Top Links').'">';
|
$this->_html .= '<optgroup label="'.$this->l('Menu Top Links').'">';
|
||||||
$links = MenuTopLinks::gets($cookie->id_lang, null, (int)$this->context->shop->id);
|
$links = MenuTopLinks::gets($cookie->id_lang, null, (int)$this->context->shop->id);
|
||||||
foreach($links as $link)
|
foreach($links as $link)
|
||||||
$this->_html .= '<option value="LNK'.$link['id_link'].'" style="margin-left:10px;">'.$link['label'].'</option>';
|
$this->_html .= '<option value="LNK'.$link['id_linksmenutop'].'" style="margin-left:10px;">'.$link['label'].'</option>';
|
||||||
$this->_html .= '</optgroup>';
|
$this->_html .= '</optgroup>';
|
||||||
// END Menu Top Links
|
// END Menu Top Links
|
||||||
$this->_html .= '</select><br />
|
$this->_html .= '</select><br />
|
||||||
@@ -302,13 +302,13 @@ class blocktopmenu extends Module
|
|||||||
{
|
{
|
||||||
$this->_html .= '
|
$this->_html .= '
|
||||||
<tr>
|
<tr>
|
||||||
<td>'.$link['id_link'].'</td>
|
<td>'.$link['id_linksmenutop'].'</td>
|
||||||
<td>'.$link['label'].'</td>
|
<td>'.$link['label'].'</td>
|
||||||
<td>'.$link['link'].'</td>
|
<td>'.$link['link'].'</td>
|
||||||
<td>'.(($link['new_window']) ? $this->l('Yes') : $this->l('No')).'</td>
|
<td>'.(($link['new_window']) ? $this->l('Yes') : $this->l('No')).'</td>
|
||||||
<td>
|
<td>
|
||||||
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
|
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
|
||||||
<input type="hidden" name="id_link" value="'.$link['id_link'].'" />
|
<input type="hidden" name="id_linksmenutop" value="'.$link['id_linksmenutop'].'" />
|
||||||
<input type="submit" name="submitBlocktopmenuRemove" value="'.$this->l('Remove').'" class="button" />
|
<input type="submit" name="submitBlocktopmenuRemove" value="'.$this->l('Remove').'" class="button" />
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -27,21 +27,21 @@
|
|||||||
|
|
||||||
class MenuTopLinks
|
class MenuTopLinks
|
||||||
{
|
{
|
||||||
public static function gets($id_lang, $id_link = null, $id_shop)
|
public static function gets($id_lang, $id_linksmenutop = null, $id_shop)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT l.id_link, l.new_window, l.link, ll.label
|
SELECT l.id_linksmenutop, l.new_window, l.link, ll.label
|
||||||
FROM '._DB_PREFIX_.'linksmenutop l
|
FROM '._DB_PREFIX_.'linksmenutop l
|
||||||
LEFT JOIN '._DB_PREFIX_.'linksmenutop_lang ll ON (l.id_link = ll.id_link AND ll.id_lang = '.(int)$id_lang.' AND ll.id_shop='.(int)$id_shop.')
|
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.')
|
||||||
WHERE 1
|
WHERE 1
|
||||||
'.((!is_null($id_link)) ? ' AND l.id_link = "'.(int)$id_link.'"' : '').'
|
'.((!is_null($id_linksmenutop)) ? ' AND l.id_linksmenutop = "'.(int)$id_linksmenutop.'"' : '').'
|
||||||
AND l.id_shop IN (0, '.(int)$id_shop.')
|
AND l.id_shop IN (0, '.(int)$id_shop.')
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get($id_link, $id_lang, $id_shop)
|
public static function get($id_linksmenutop, $id_lang, $id_shop)
|
||||||
{
|
{
|
||||||
return self::gets($id_lang, $id_link, $id_shop);
|
return self::gets($id_lang, $id_linksmenutop, $id_shop);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function add($link, $label, $newWindow = 0, $id_shop)
|
public static function add($link, $label, $newWindow = 0, $id_shop)
|
||||||
@@ -58,13 +58,13 @@ class MenuTopLinks
|
|||||||
),
|
),
|
||||||
'INSERT'
|
'INSERT'
|
||||||
);
|
);
|
||||||
$id_link = Db::getInstance()->Insert_ID();
|
$id_linksmenutop = Db::getInstance()->Insert_ID();
|
||||||
foreach($label as $id_lang=>$label)
|
foreach($label as $id_lang=>$label)
|
||||||
{
|
{
|
||||||
Db::getInstance()->autoExecute(
|
Db::getInstance()->autoExecute(
|
||||||
_DB_PREFIX_.'linksmenutop_lang',
|
_DB_PREFIX_.'linksmenutop_lang',
|
||||||
array(
|
array(
|
||||||
'id_link'=>(int)$id_link,
|
'id_linksmenutop'=>(int)$id_linksmenutop,
|
||||||
'id_lang'=>(int)$id_lang,
|
'id_lang'=>(int)$id_lang,
|
||||||
'id_shop'=>(int)$id_shop,
|
'id_shop'=>(int)$id_shop,
|
||||||
'label'=>pSQL($label)
|
'label'=>pSQL($label)
|
||||||
@@ -74,10 +74,10 @@ class MenuTopLinks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function remove($id_link, $id_shop)
|
public static function remove($id_linksmenutop, $id_shop)
|
||||||
{
|
{
|
||||||
Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop', 'id_link = '.(int)$id_link.' AND id_shop = '.(int)$id_shop);
|
Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop', 'id_linksmenutop = '.(int)$id_linksmenutop.' AND id_shop = '.(int)$id_shop);
|
||||||
Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop_lang', 'id_link = '.(int)$id_link);
|
Db::getInstance()->delete(_DB_PREFIX_.'linksmenutop_lang', 'id_linksmenutop = '.(int)$id_linksmenutop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user