Jump to content

Problem with module Category Message


Recommended Posts

Hello,

 

I have a problem with the module Category Message, I cn not install it, when i do it , there is message like that:

[PrestaShop] Fatal error in module categorymessage:
Call to undefined method Category::hideCategoryPosition()

 

Help me please!

 

Best regards

Link to comment
Share on other sites

It's doesn't work for me, in categorymessage.php i dont have the same , my code is:

 

<?php
 
class CategoryMessage extends Module
 
{
 
private $_pageHtml = '';
 
private $editInProgress=0;
 
private $ErrorAdd=0;
 
public function __construct() {
 
$this->name = 'categorymessage';
 
$this->tab = 'Tools';
 
$this->version = 1.1;
 
parent::__construct();
 
$this->page = basename(__FILE__, '.php');
 
$this->displayName = $this->l('Category messages.');
 
$this->description = $this->l('Enable messages or advertising on category.');
 
}
 
 
 
public function install() {
 
if(!parent::install() || 
 
  !$this->registerHook('top') || 
 
  !Configuration::updateValue('MOD_PAGECATEGORY_ACTIVE', 'on') || 
 
  !$this->installDB())
 
return false;
 
else
 
return true;
 
}
 
 
 
public function installDb() {
 
Db::getInstance()->ExecuteS('
 
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'category_page` (
 
 `id_page` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
 
 `name` VARCHAR(50) NOT NULL,
 
 `display` VARCHAR(10) NULL,
 
 `mode` VARCHAR(10) NULL,
 
 `color` VARCHAR(10) NULL,
 
 `opacity` INT NOT NULL, 
 
 `width` INT NULL,
 
 `height` INT NULL,
 
 `active` INT NOT NULL
 
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
 
Db::getInstance()->ExecuteS('
 
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'category_page_lang` (
 
 `id_page` INT NOT NULL ,
 
 `id_lang` TINYINT( 1 ) NOT NULL,
 
 `description` BLOB NULL
 
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
 
Db::getInstance()->ExecuteS('
 
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'category_page_category` (
 
 `id_page` INT  NOT NULL,
 
 `id_category` INT NOT NULL
 
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
 
return true;
 
}
 
 
 
public function uninstall()
 
{
 
if(!parent::uninstall() || 
 
  !Configuration::deleteByName('MOD_PAGECATEGORY_ACTIVE') || 
 
  !$this->uninstallDb())
 
 return false;
 
return true;
 
}
 
 
 
private function uninstallDb() {
 
Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'category_page`');
 
Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'category_page_lang`');
 
Db::getInstance()->ExecuteS('DROP TABLE `'._DB_PREFIX_.'category_page_category`');
 
return true;
 
}
 
 
 
function recurseCategory($indexedCategories, $categories, $current, $id_category = 1, $id_category_default = NULL, $CategorySelected)
 
{
 
global $done;
 
static $irow;
 
if(!is_array($CategorySelected))
 
$CategorySelected = array();
 
$id_obj = intval(Tools::getValue($this->identifier));
 
if (!isset($done[$current['infos']['id_parent']]))
 
$done[$current['infos']['id_parent']] = 0;
 
$done[$current['infos']['id_parent']] += 1;
 
 
 
$todo = sizeof($categories[$current['infos']['id_parent']]);
 
$doneC = $done[$current['infos']['id_parent']];
 
 
 
$level = $current['infos']['level_depth'] + 1;
 
$img = $level == 1 ? 'lv1.gif' : 'lv'.$level.'_'.($todo == $doneC ? 'f' : 'b').'.gif';
 
 
 
$this->_pageHtml .= '
 
<tr class="'.($irow++ % 2 ? 'alt_row' : '').'">
 
<td>
 
<input type="checkbox" name="categoryBox[]" class="categoryBox'.($id_category_default != NULL ? ' id_category_default' : '').'" id="categoryBox_'.$id_category.'" value="'.$id_category.'"'.(((in_array($id_category, $indexedCategories) OR (intval(Tools::getValue('id_category')) == $id_category AND !intval($id_obj))) OR in_array($id_category, $CategorySelected)) ? ' checked="checked"' : '').' />
 
</td>
 
<td>
 
'.$id_category.'
 
</td>
 
<td>
 
<img src="../img/admin/'.$img.'" alt="" />  <label for="categoryBox_'.$id_category.'" class="t">'.stripslashes(Category::hideCategoryPosition($current['infos']['name'])).'</label>
 
</td>
 
</tr>';
 
 
 
if (isset($categories[$id_category]))
 
foreach ($categories[$id_category] AS $key => $row)
 
if ($key != 'infos')
 
$this->recurseCategory($indexedCategories, $categories, $categories[$id_category][$key], $key, NULL, $CategorySelected);
 
}
 
 
 
public function getContent()
 
{
 
global $cookie;
 
global $editInProgress;
 
global $ErrorAdd;
 
$output = "";
 
if (Tools::isSubmit('actionForm'))
 
{
 
switch(trim(Tools::getValue('actionForm'))) {
 
case 'add':
 
$languages = Language::getLanguages();
 
(Tools::getValue('categoryBox') == '') ? $errors[$p++] = $this->l('category') : false;
 
(Tools::getValue('name') == '') ? $errors[$p++] = $this->l('name') : false;
 
(Tools::getValue('color') == '') ? $errors[$p++] = $this->l('color') : false;
 
(Tools::getValue('opacity') == '') ? $errors[$p++] = $this->l('opacity') : false;
 
(Tools::getValue('width') == '') ? $errors[$p++] = $this->l('width') : false;
 
(Tools::getValue('height') == '') ? $errors[$p++] = $this->l('height') : false;
 
(Tools::getValue('activeSpecialPage') == '') ? $errors[$p++] = $this->l('activeSpecialPage') : false;
 
if(count($errors)!=0) {
 
$output .= $this->displayError($this->l('Unable to add this special page.'));
 
$ErrorAdd = 1;
 
}
 
else {
 
Db::getInstance()->autoExecute(
 
 _DB_PREFIX_.'category_page',
 
 array(
 
'name'=>Tools::getValue('name'),
 
'display'=>Tools::getValue('DisplayType'),
 
'mode'=>Tools::getValue('mode'),
 
'color'=>Tools::getValue('color'),
 
'opacity'=>Tools::getValue('opacity'),
 
'width'=>Tools::getValue('width'),
 
'height'=>Tools::getValue('height'),
 
'active'=>Tools::getValue('activeSpecialPage')
 
 ),
 
 'INSERT'
 
);
 
$id_SpecialPage = Db::getInstance()->Insert_ID();
 
foreach ($languages as $language) {
 
Db::getInstance()->autoExecute(
 
 _DB_PREFIX_.'category_page_lang',
 
 array(
 
'id_page'=>$id_SpecialPage,
 
'id_lang'=>intval($language['id_lang']),
 
'description'=>addslashes(Tools::getValue('body_message_'.$language['id_lang']))
 
 ),
 
 'INSERT'
 
);
 
}
 
 
 
foreach(Tools::getValue('categoryBox') as $id_cat=>$cat) {
 
 Db::getInstance()->autoExecute(
 
_DB_PREFIX_.'category_page_category',
 
array(
 
 'id_page'=>$id_SpecialPage,
 
 'id_category'=>$cat
 
),
 
'INSERT'
 
 );
 
}
 
$output .= $this->displayConfirmation($this->l('The special page has been added'));
 
}
 
break;
 
case 'delete':
 
Db::getInstance()->delete(_DB_PREFIX_.'category_page', "id_page = ".Tools::getValue('SpecialPageEditDelete')); 
 
Db::getInstance()->delete(_DB_PREFIX_.'category_page_lang', "id_page = ".Tools::getValue('SpecialPageEditDelete')); 
 
Db::getInstance()->delete(_DB_PREFIX_.'category_page_category', "id_page = ".Tools::getValue('SpecialPageEditDelete'));
 
$output .= $this->displayConfirmation($this->l('The special page has been deleted'));
 
break;
 
case 'edit':
 
$editInProgress = 1;
 
 
 
break;
 
case 'update':
 
$languages = Language::getLanguages();
 
(Tools::getValue('categoryBox') == '') ? $errors[$p++] = $this->l('category') : false;
 
(Tools::getValue('name') == '') ? $errors[$p++] = $this->l('name') : false;
 
(Tools::getValue('color') == '') ? $errors[$p++] = $this->l('color') : false;
 
(Tools::getValue('opacity') == '') ? $errors[$p++] = $this->l('opacity') : false;
 
(Tools::getValue('width') == '') ? $errors[$p++] = $this->l('width') : false;
 
(Tools::getValue('height') == '') ? $errors[$p++] = $this->l('height') : false;
 
(Tools::getValue('activeSpecialPage') == '') ? $errors[$p++] = $this->l('activeSpecialPage') : false;
 
if(count($errors)!=0) {
 
$output .= $this->displayError($this->l('Unable to update this special page.'));
 
$ErrorAdd = 1;
 
}
 
else {
 
Db::getInstance()->Execute('
 
UPDATE '._DB_PREFIX_.'category_page SET 
 
name="'.Tools::getValue('name').'", 
 
display="'.Tools::getValue('DisplayType').'",
 
mode="'.Tools::getValue('mode').'",
 
color="'.Tools::getValue('color').'",
 
opacity="'.Tools::getValue('opacity').'", 
 
width="'.Tools::getValue('width').'",
 
height="'.Tools::getValue('height').'", 
 
active="'.Tools::getValue('activeSpecialPage').'" WHERE id_page='.Tools::getValue('idSpecialPageToUpdate').'
 
');
 
 
 
Db::getInstance()->delete(_DB_PREFIX_.'category_page_lang', "id_page = ".Tools::getValue('idSpecialPageToUpdate')); 
 
foreach ($languages as $language) {
 
 Db::getInstance()->autoExecute(
 
_DB_PREFIX_.'category_page_lang',
 
array(
 
 'id_page'=>Tools::getValue('idSpecialPageToUpdate'),
 
 'id_lang'=>intval($language['id_lang']),
 
 'description'=>Tools::getValue('body_message_'.$language['id_lang'])
 
),
 
'INSERT'
 
 );
 
}
 
 
 
Db::getInstance()->delete(_DB_PREFIX_.'category_page_category', "id_page = ".Tools::getValue('idSpecialPageToUpdate'));
 
 
 
foreach(Tools::getValue('categoryBox') as $id_cat=>$cat) {
 
 Db::getInstance()->autoExecute(
 
_DB_PREFIX_.'category_page_category',
 
array(
 
 'id_page'=>Tools::getValue('idSpecialPageToUpdate'),
 
 'id_category'=>$cat
 
),
 
'INSERT'
 
 );
 
}
 
$output .= $this->displayConfirmation($this->l('The special page has been updated.'));
 
}
 
break;
 
}
 
}
 
return $output.$this->displayForm();
 
}
 
 
 
static public function getSpecialList() {
 
return Db::getInstance()->ExecuteS('
 
SELECT *
 
FROM '._DB_PREFIX_.'category_page' );
 
}
 
 
 
static public function getSpecialListEdit($id_SpecialPage) {
 
return Db::getInstance()->ExecuteS('
 
SELECT *  
 
FROM '._DB_PREFIX_.'category_page WHERE `id_page`='.$id_SpecialPage );
 
}
 
static public function getSpecialListEditLang($id_SpecialPage) {
 
return Db::getInstance()->ExecuteS('
 
SELECT id_lang, description 
 
FROM '._DB_PREFIX_.'category_page_lang WHERE `id_page`='.$id_SpecialPage );
 
}
 
static public function getSpecialListEditCategory($id_SpecialPage) {
 
return Db::getInstance()->ExecuteS('
 
SELECT id_category 
 
FROM '._DB_PREFIX_.'category_page_category WHERE `id_page`='.$id_SpecialPage );
 
}
 
static public function getCategoryProduct($idProduct) {
 
return Db::getInstance()->ExecuteS('
 
SELECT id_category     
 
FROM '._DB_PREFIX_.'category_product WHERE id_product='.$idProduct);
 
}
 
 
 
static public function getSpecialListTpl($id_lang, $idCategoryPage) {
 
return Db::getInstance()->ExecuteS('
 
SELECT tb.color, tb.width, tb.height, tb.opacity, tbll.description, tb.display, tb.mode     
 
FROM ('._DB_PREFIX_.'category_page tb INNER JOIN '._DB_PREFIX_.'category_page_category tbl ON
 
(tb.id_page=tbl.id_page)) INNER JOIN '._DB_PREFIX_.'category_page_lang tbll ON 
 
(tb.id_page=tbll.id_page) WHERE tb.active=1 AND tbl.id_category='.$idCategoryPage.' AND tbll.id_lang='.$id_lang );
 
}
 
 
 
private function displayForm()
 
{
 
global $cookie;
 
global $editInProgress;
 
global $ErrorAdd;
 
global $irow;
 
$tab_category = array();
 
$tab_descriptions = array();
 
$tabCategorySelected = array();
 
if($editInProgress==1) {
 
$SpecialListEdit = $this->getSpecialListEdit(Tools::getValue('SpecialPageEditDelete'));
 
$SpecialListEditLang = $this->getSpecialListEditLang(Tools::getValue('SpecialPageEditDelete'));
 
$SpecialListEditCategory = $this->getSpecialListEditCategory(Tools::getValue('SpecialPageEditDelete'));
 
if(count($SpecialListEditLang)!=0)
 
foreach($SpecialListEditLang as $k)
 
$tab_descriptions[$k['id_lang']] = $k['description'];
 
if(count($SpecialListEditCategory)!=0)
 
foreach($SpecialListEditCategory as $k)
 
$tabCategorySelected[$k['id_category']] = $k['id_category'];
 
}
 
$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
 
$languages = Language::getLanguages();
 
$iso = Language::getIsoById($defaultLanguage);
 
$this->_pageHtml = '
 
<link rel="stylesheet" href="../modules/categorymessage/css/colorpicker.css" type="text/css" />
 
<link rel="stylesheet" href="../modules/categorymessage/css/layout.css" type="text/css"/>
 
<script type="text/javascript" src="../modules/categorymessage/js/colorpicker.js"></script>
 
<script type="text/javascript" src="../modules/categorymessage/js/eye.js"></script>
 
<script type="text/javascript" src="../modules/categorymessage/js/layout.js?ver=1.0.2"></script>
 
<script type="text/javascript" src="../modules/categorymessage/js/utils.js"></script>
 
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/jquery.tinymce.js"></script>
 
<script type="text/javascript">
 
function tinyMCEInit(element)
 
{
 
$().ready(function() {
 
$(element).tinymce({
 
// Location of TinyMCE script
 
script_url : \''.__PS_BASE_URI__.'js/tinymce/jscripts/tiny_mce/tiny_mce.js\',
 
// General options
 
theme : "advanced",
 
plugins : "safari,pagebreak,style,layer,table,advimage,advlink,inlinepopups,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen",
 
// Theme options
 
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
 
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
 
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,media,|,|,ltr,rtl,|,fullscreen",
 
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,pagebreak",
 
theme_advanced_toolbar_location : "top",
 
theme_advanced_toolbar_align : "left",
 
theme_advanced_statusbar_location : "bottom",
 
theme_advanced_resizing : true,
 
elements : "nourlconvert",
 
convert_urls : false, 
 
content_css : "'.__PS_BASE_URI__.'themes/'._THEME_NAME_.'/css/global.css",
 
// Drop lists for link/image/media/template dialogs
 
template_external_list_url : "lists/template_list.js",
 
external_link_list_url : "lists/link_list.js",
 
external_image_list_url : "lists/image_list.js",
 
media_external_list_url : "lists/media_list.js"
 
});
 
});
 
}
 
tinyMCEInit(\'textarea.rte\');
 
</script>
 
<script type="text/javascript">id_language = Number('.$defaultLanguage.');</script>
 
<form action="'.$_SERVER['REQUEST_URI'].'" method="post" name="SpecialPageForm">';
 
$this->_pageHtml .='<fieldset>
 
<legend><img src="'.$this->_path.'logo.gif">'.$this->l('Special pages list for categories').'</legend>
 
<table cellpadding="0" class="table" width="100%">
 
<TR>
 
<Th width="20">'.$this->l('ID').'</Th>
 
<th>'.$this->l('name').'</th>
 
<th width="20">'.$this->l('Status').'</th>
 
<th width="40" colspan="2">'.$this->l('Actions').'</th>
 
</TR>
 
';
 
$lng = 0;
 
$SpecialPageList = $this->getSpecialList();
 
if(count($SpecialPageList)!=0)
 
foreach ($SpecialPageList as $SpecialPage) {
 
$this->_pageHtml .= '<TR class="'.($lng++ % 2 ? 'alt_row' : '').'"><TD width="20">'.$SpecialPage['id_page'].'</TD><TD>'.$SpecialPage['name'].'</TD><TD align="center">'.(($SpecialPage['active']==1) ? '<img src="../img/admin/enabled.gif">' : '<img src="../img/admin/disabled.gif">').'</TD><TD width="20"><img src="../img/admin/edit.gif" title="'.$this->l('Edit').'" onClick="editSpecialPage(\''.$SpecialPage['id_page'].'\')" style="cursor:pointer"></TD><TD width="20"><img src="../img/admin/disabled.gif" title="'.$this->l('Delete').'" onClick="deleteSpecialPage(\''.$SpecialPage['id_page'].'\')" style="cursor:pointer"></TD></TR>';
 
}
 
$this->_pageHtml .='</table>';
 
$this->_pageHtml .='<input type="hidden" id="SpecialPageEditDelete" name="SpecialPageEditDelete" value="">';
 
$this->_pageHtml .='</fieldset><BR />';
 
 
 
$this->_pageHtml .= '<fieldset><legend><img src="'.$this->_path.'images/parametres.gif" alt="" title="" />'.$this->l('Settings').'</legend>
 
';
 
$this->_pageHtml .='<label>'.$this->l('Name').': </label>';
 
$this->_pageHtml .='<div class="margin-form">
 
<input type ="text" id="name" name="name" value="'.(($editInProgress==1) ? $SpecialListEdit[0]['name'] : (($ErrorAdd==1) ? Tools::getValue('name') : false)).'"><sup> *</sup>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Categories').': </label>
 
<div class="margin-form">
 
<table cellspacing="0" cellpadding="0" class="table" width="100%">
 
<tr>
 
<th width="20"><input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, \'categoryBox[]\', this.checked)" /></th>
 
<th width="20">'.$this->l('ID').'</th>
 
<th>'.$this->l('Name').'</th>
 
</tr>
 
<tr class="">
 
<td width="20"><input type="checkbox" name="categoryBox[]" class="categoryBox" value="0" '.(in_array("0", $tabCategorySelected) ? " checked" : "").'/></td>
 
<td width="20">0</td>
 
<td> <label for="categoryBox_'.$id_category.'" class="t">'.$this->l('Home page').'</label></td>
 
</tr>';
 
$irow = 0;
 
$done = array();
 
$index = array();
 
$indexedCategories = array();
 
$categories = Category::getCategories(intval($cookie->id_lang), false);
 
foreach ($indexedCategories AS $k => $row)
 
$index[] = $row['id_category'];
 
$this->recurseCategory($index, $categories, $categories[0][1], 1, $obj->id, $tabCategorySelected);
 
$this->_pageHtml .='
 
</table>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Message').'</label>
 
<div class="margin-form">';
 
foreach ($languages as $language) {
 
$existing_message = ($ErrorAdd==1) ? Tools::getValue('body_message_'.$language['id_lang']) : $tab_descriptions[$language['id_lang']];
 
$this->_pageHtml .= '
 
<div id="InformMessage_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';float: left;">
 
<textarea class="rte" cols="70" rows="30" id="body_message_'.$language['id_lang'].'" name="body_message_'.$language['id_lang'].'">' . $existing_message . '</textarea>
 
</div>';
 
}
 
$this->_pageHtml .= $this->displayFlags($languages, $defaultLanguage, 'InformMessage', 'InformMessage', true);
 
$this->_pageHtml .='</div><div class="clear pspace"></div>';
 
$this->_pageHtml .='<label>'.$this->l('Mode').': </label>';
 
$this->_pageHtml .='<div class="margin-form">
 
<select id="mode" name="mode">';
 
$this->_pageHtml .= '<option value="confirm" '.(($editInProgress==1) ? (($SpecialListEdit[0]['mode']=='confirm') ? " selected" : "") : ((Tools::getValue('display')=='confirm') ? (($ErrorAdd==1) ? " selected" : "") : "")).'>'.$this->l('Confirmation').'</option>';
 
$this->_pageHtml .= '<option value="close" '.(($editInProgress==1) ? (($SpecialListEdit[0]['mode']=='close') ? " selected" : "") : ((Tools::getValue('display')=='mode') ? (($ErrorAdd==1) ? " selected" : "") : "")).'>'.$this->l('Close').'</option>';
 
$this->_pageHtml .='</select>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Display').': </label>';
 
$this->_pageHtml .='<div class="margin-form">
 
<select id="DisplayType" name="DisplayType">';
 
$this->_pageHtml .= '<option value="always" '.(($editInProgress==1) ? (($SpecialListEdit[0]['display']=='always') ? " selected" : "") : ((Tools::getValue('display')=='always') ? (($ErrorAdd==1) ? " selected" : "") : "")).'>'.$this->l('Always').'</option>';
 
$this->_pageHtml .= '<option value="once" '.(($editInProgress==1) ? (($SpecialListEdit[0]['display']=='once') ? " selected" : "") : ((Tools::getValue('display')=='once') ? (($ErrorAdd==1) ? " selected" : "") : "")).'>'.$this->l('One time').'</option>';
 
$this->_pageHtml .='</select>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Mask').': </label><div class="margin-form">
 
<div id="customWidget">
 
<input type="hidden" name="color" value="'.(($editInProgress==1) ? $SpecialListEdit[0]['color'] : (($ErrorAdd==1) ? Tools::getValue('color') : "000000")).'" id="HiddenColor2">
 
<div id="colorSelector2"><div style="background-color: #'.(($editInProgress==1) ? $SpecialListEdit[0]['color'] : (($ErrorAdd==1) ? Tools::getValue('color') : "000000")).'"></div></div>
 
<div id="colorpickerHolder2" style="z-index : 1001">
 
</div>
 
</div>
 
<p>'.$this->l('Background color of the mask.').'</p>
 
</div>
 
';
 
$this->_pageHtml .='<label>'.$this->l('Opacity').': </label>';
 
$this->_pageHtml .='<div class="margin-form">
 
<select id="opacity" name="opacity">';
 
for($o=10; $o<=100; $o=$o+10)
 
$this->_pageHtml .= '<option value="'.$o.'" '.(($editInProgress==1) ? (($SpecialListEdit[0]['opacity']==$o) ? " selected" : "") : ((Tools::getValue('opacity')==$o) ? (($ErrorAdd==1) ? " selected" : "") : "")).'>'.$o.'%</option>';
 
$this->_pageHtml .='</select>
 
<p>'.$this->l('Opacity mask.').'</p>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Width').': </label>';
 
$this->_pageHtml .='<div class="margin-form">
 
<input type ="text" id="width" name="width" value="'.(($editInProgress==1) ? $SpecialListEdit[0]['width'] : (($ErrorAdd==1) ? Tools::getValue('width') : false)).'"> px<sup> *</sup>
 
<p>'.$this->l('Frame width in special page.').'</p>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Height').': </label>';
 
$this->_pageHtml .='<div class="margin-form">
 
<input type ="text" id="height" name="height" value="'.(($editInProgress==1) ? $SpecialListEdit[0]['height'] : (($ErrorAdd==1) ? Tools::getValue('height') : false)).'"> px<sup> *</sup>
 
<p>'.$this->l('Frame height in special page.').'</p>
 
</div>';
 
$this->_pageHtml .='<label>'.$this->l('Status').': </label>
 
<div class="margin-form">
 
<input type="radio" name="activeSpecialPage" value="1" '.(($editInProgress==1) ? (($SpecialListEdit[0]['active']==1) ? " checked" : "") : ((Tools::getValue('activeSpecialPage')=='1') ? (($ErrorAdd==1) ? " checked" : "") : "")).'/>
 
<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
 
<input type="radio" name="activeSpecialPage" value="0" '.(($editInProgress==1) ? (($SpecialListEdit[0]['active']==0) ? " checked" : "") : ((Tools::getValue('activeSpecialPage')=='0') ? (($ErrorAdd==1) ? " checked" : "") : "")).'/>
 
<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
 
<p>'.$this->l('Enable or disable special page').'</p>
 
</div>
 
<input type="hidden" id="actionForm" name="actionForm" value="add">
 
<div class="margin-form">';
 
if($editInProgress==1) {
 
$this->_pageHtml .= '<input type="button" value="'.$this->l('   Update   ').'" name="submitSpecialPage" class="button" onClick="updateSpecialPage(\''.$SpecialListEdit[0]['id_page'].'\')" />
 
<input type="hidden" id="idSpecialPageToUpdate" name="idSpecialPageToUpdate" value="'.$SpecialListEdit[0]['id_page'].'">';
 
}
 
else
 
$this->_pageHtml .= '<input type="submit" value="'.$this->l('   Save   ').'" name="submitSpecialPage" class="button" />';
 
$this->_pageHtml .= '</div>
 
</fieldset>
 
</form>';
 
return $this->_pageHtml;
 
}
 
 
 
function hookTop($params)
 
{
 
global $cookie;
 
global $smarty;
 
if(Configuration::get('MOD_PAGECATEGORY_ACTIVE')=='on') {
 
if (basename($_SERVER['PHP_SELF'])=="index.php") {
 
$SpecialPageCategoryBlock = $this->getSpecialListTpl($cookie->id_lang, 0);
 
if(count($SpecialPageCategoryBlock)>0) {
 
$IdPageTpl = ($SpecialPageCategoryBlock[0]['display']!='always') ? $SpecialPageCategoryBlock[0]['id_page'] : -1;
 
$smarty->assign(array(
 
'colorBackground' => $SpecialPageCategoryBlock[0]['color'],
 
'widthBox' => $SpecialPageCategoryBlock[0]['width'],
 
'heightBox' => $SpecialPageCategoryBlock[0]['height'],
 
'positionLeftBox' => (($SpecialPageCategoryBlock[0]['width']/2) * -1),
 
'positionTopBox' => (($SpecialPageCategoryBlock[0]['height']/2)*-1),
 
'positionLeftClose' => ($SpecialPageCategoryBlock[0]['width']/2)-16,
 
'positionTopClose' => (($SpecialPageCategoryBlock[0]['height']/2)*-1)-16,
 
'heightTextBox' => $SpecialPageCategoryBlock[0]['height']-25,
 
'opaciteBackground' => $SpecialPageCategoryBlock[0]['opacity'],
 
'descriptionBox' => $SpecialPageCategoryBlock[0]['description'], 
 
'mode' => $SpecialPageCategoryBlock[0]['mode'],
 
'jsIdPage' => $IdPageTpl
 
));
 
return $this->display(__FILE__, 'categorymessage.tpl');
 
}
 
}
 
else {
 
if (isset($_GET['id_category']) AND Validate::isUnsignedId($_GET['id_category'])) {
 
$SpecialPageCategoryBlock = $this->getSpecialListTpl($cookie->id_lang, $_GET['id_category']);
 
if(count($SpecialPageCategoryBlock)>0) {
 
$IdPageTpl = ($SpecialPageCategoryBlock[0]['display']!='always') ? $SpecialPageCategoryBlock[0]['id_page'] : -1;
 
$smarty->assign(array(
 
'colorBackground' => $SpecialPageCategoryBlock[0]['color'],
 
'widthBox' => $SpecialPageCategoryBlock[0]['width'],
 
'heightBox' => $SpecialPageCategoryBlock[0]['height'],
 
'positionLeftBox' => (($SpecialPageCategoryBlock[0]['width']/2) * -1),
 
'positionTopBox' => (($SpecialPageCategoryBlock[0]['height']/2)*-1),
 
'positionLeftClose' => ($SpecialPageCategoryBlock[0]['width']/2)-16,
 
'positionTopClose' => (($SpecialPageCategoryBlock[0]['height']/2)*-1)-16,
 
'heightTextBox' => $SpecialPageCategoryBlock[0]['height']-25,
 
'opaciteBackground' => $SpecialPageCategoryBlock[0]['opacity'],
 
'descriptionBox' => $SpecialPageCategoryBlock[0]['description'], 
 
'mode' => $SpecialPageCategoryBlock[0]['mode'],
 
'jsIdPage' => $IdPageTpl
 
));
 
return $this->display(__FILE__, 'categorymessage.tpl');
 
}
 
}
 
if (isset($_GET['id_product']) AND Validate::isUnsignedId($_GET['id_product'])) {
 
$IdCategoryProduct = $this->getCategoryProduct($_GET['id_product']);
 
$SpecialPageCategoryBlock = $this->getSpecialListTpl($cookie->id_lang, $IdCategoryProduct[0]['id_category']);
 
if(count($SpecialPageCategoryBlock)>0) {
 
$IdPageTpl = ($SpecialPageCategoryBlock[0]['display']!='always') ? $SpecialPageCategoryBlock[0]['id_page'] : -1;
 
if(intval($IdPageTpl)!=999999999) {
 
$smarty->assign(array(
 
'colorBackground' => $SpecialPageCategoryBlock[0]['color'],
 
'widthBox' => $SpecialPageCategoryBlock[0]['width'],
 
'heightBox' => $SpecialPageCategoryBlock[0]['height'],
 
'positionLeftBox' => (($SpecialPageCategoryBlock[0]['width']/2) * -1),
 
'positionTopBox' => (($SpecialPageCategoryBlock[0]['height']/2)*-1),
 
'positionLeftClose' => ($SpecialPageCategoryBlock[0]['width']/2)-16,
 
'positionTopClose' => (($SpecialPageCategoryBlock[0]['height']/2)*-1)-16,
 
'heightTextBox' => $SpecialPageCategoryBlock[0]['height']-25,
 
'opaciteBackground' => $SpecialPageCategoryBlock[0]['opacity'],
 
'descriptionBox' => $SpecialPageCategoryBlock[0]['description'], 
 
'mode' => $SpecialPageCategoryBlock[0]['mode'],
 
'jsIdPage' => $IdPageTpl
 
));
 
return $this->display(__FILE__, 'categorymessage.tpl');
 
}
 
}
 
}
 
}
 
}
 
}
 
}
 
 
 
?>
Link to comment
Share on other sites

×
×
  • Create New...