diff --git a/modules/blocktopmenu/blocktopmenu.php b/modules/blocktopmenu/blocktopmenu.php
index dbb3ca1fa..b0aa07377 100644
--- a/modules/blocktopmenu/blocktopmenu.php
+++ b/modules/blocktopmenu/blocktopmenu.php
@@ -25,7 +25,7 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-require dirname(__FILE__).'/menutoplinks.class.php';
+require (dirname(__FILE__).'/menutoplinks.class.php');
class Blocktopmenu extends Module
{
@@ -52,7 +52,7 @@ class Blocktopmenu extends Module
{
$this->name = 'blocktopmenu';
$this->tab = 'front_office_features';
- $this->version = 1.4;
+ $this->version = 1.5;
$this->author = 'PrestaShop';
parent::__construct();
@@ -79,15 +79,15 @@ class Blocktopmenu extends Module
`id_linksmenutop` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`id_shop` INT UNSIGNED NOT NULL,
`new_window` TINYINT( 1 ) NOT NULL,
- `link` VARCHAR( 128 ) NOT NULL,
INDEX (`id_shop`)
) ENGINE = '._MYSQL_ENGINE_.' CHARACTER SET utf8 COLLATE utf8_general_ci;') &&
- Db::getInstance()->execute('
+ Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` (
`id_linksmenutop` INT NOT NULL,
`id_lang` INT NOT NULL,
`id_shop` INT NOT NULL,
`label` VARCHAR( 128 ) NOT NULL ,
+ `link` VARCHAR( 128 ) NOT NULL ,
INDEX ( `id_linksmenutop` , `id_lang`, `id_shop`)
) ENGINE = '._MYSQL_ENGINE_.' CHARACTER SET utf8 COLLATE utf8_general_ci;'));
}
@@ -116,6 +116,7 @@ class Blocktopmenu extends Module
$default_language = (int)Configuration::get('PS_LANG_DEFAULT');
$labels = Tools::getValue('label') ? array_filter(Tools::getValue('label'), 'strlen') : array();
+ $links_label = Tools::getValue('link') ? array_filter(Tools::getValue('link'), 'strlen') : array();
$spacer = str_repeat(' ', $this->spacer_size);
$divLangName = 'link_label';
@@ -130,9 +131,9 @@ class Blocktopmenu extends Module
else if (Tools::isSubmit('submitBlocktopmenuLinks'))
{
- if ((Tools::getValue('link') == '') && (!count($labels)))
+ if ((!count($links_label)) && (!count($labels)))
;
- else if (Tools::getValue('link') == '')
+ else if (!count($links_label))
$this->_html .= $this->displayError($this->l('Please, fill the "Link" field'));
else if (!count($labels))
$this->_html .= $this->displayError($this->l('Please add a label'));
@@ -151,6 +152,24 @@ class Blocktopmenu extends Module
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'));
}
+ else if (Tools::isSubmit('submitBlocktopmenuEdit'))
+ {
+ $id_linksmenutop = (int)Tools::getValue('id_linksmenutop', 0);
+ $id_shop = (int)Shop::getContextShopID();
+
+ if (!Tools::isSubmit('link'))
+ {
+ $tmp = MenuTopLinks::getLinkLang($id_linksmenutop, $id_shop);
+ $links_label_edit = $tmp['link'];
+ $labels_edit = $tmp['label'];
+ $new_window_edit = $tmp['new_window'];
+ }
+ else
+ {
+ MenuTopLinks::update(Tools::getValue('link'), Tools::getValue('label'), Tools::getValue('new_window', 0), (int)$id_shop, (int)$id_linksmenutop, (int)$id_linksmenutop);
+ $this->_html .= $this->displayConfirmation($this->l('The link has been edited'));
+ }
+ }
$this->_html .= '