aaeq16 Posted October 3, 2015 Share Posted October 3, 2015 (edited) El módulo llamado posextention carga imágenes sin el protocolo https, por lo que genera contenido mixto en la página web. ¿Hay alguna forma de introducir un código en el módulo que fuerze el https? Si es necesario la página es: Mi Mundo de Peluche Edited October 3, 2015 by aaeq16 (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted October 8, 2015 Share Posted October 8, 2015 pon aqui el codigo de los archivos .tpl que incluye el modulo, en alguno de esos esta la llamada a las imagenes Link to comment Share on other sites More sharing options...
aaeq16 Posted October 8, 2015 Author Share Posted October 8, 2015 (edited) ... Edited October 8, 2015 by aaeq16 (see edit history) Link to comment Share on other sites More sharing options...
aaeq16 Posted October 8, 2015 Author Share Posted October 8, 2015 Gracias por tu respuesta, Módulo: posstaticblocks Archivo: block.tpl {foreach from=$staticblocks key=key item=block} {if $block.active == 1} <p class ="title_block"> {l s={$block.title} } </p> {/if} {$block.description} {if $block.insert_module == 1} {$block.block_module} {/if} {/foreach} Módulo: posstaticblocks Archivo: slideshow.tpl <div class="pos-slideshow"> <div class="flexslider ma-nivoslider"> <div class="pos-loading"></div> <div id="pos-slideshow-home" class="slides"> {$count=0} {foreach from=$slides key=key item=slide} <img style ="display:none" src="{$slide.image}" data-thumb="{$slide.image}" alt="" title="#htmlcaption{$slide.id_pos_slideshow}" /> {/foreach} </div> {if $slideOptions.show_caption != 0} {foreach from=$slides key=key item=slide} <div id="htmlcaption{$slide.id_pos_slideshow}" class="pos-slideshow-caption nivo-html-caption nivo-caption"> <div class="timethai" style=" position:absolute; top:0; left:0; background-color: rgba(49, 56, 72, 0.298); height:5px; -webkit-animation: myfirst {$slideOptions.pause_time}ms ease-in-out; -moz-animation: myfirst {$slideOptions.pause_time}ms ease-in-out; -ms-animation: myfirst {$slideOptions.pause_time}ms ease-in-out; animation: myfirst {$slideOptions.pause_time}ms ease-in-out; "> </div> <!-- <div class="pos-slideshow-title"> <h3>{$slide.title}</h3> </div> --> <div class="pos_description"> {$slide.description} </div> <!-- {if $slide.link} <div class="pos-slideshow-readmore"> <a href="{$slide.link}" {l s=('Read more') mod= 'posslideshow'}>{l s=('Read more') mod= 'posslideshow'}</a> </div> {/if} --> </div> {/foreach} {/if} </div> </div> <script type="text/javascript"> $(window).load(function() { $(document).off('mouseenter').on('mouseenter', '.pos-slideshow', function(e){ $('.pos-slideshow .timethai').addClass('pos_hover'); }); $(document).off('mouseleave').on('mouseleave', '.pos-slideshow', function(e){ $('.pos-slideshow .timethai').removeClass('pos_hover'); }); $('#pos-slideshow-home').nivoSlider({ effect: '{if $slideOptions.animation_type != ''}{$slideOptions.animation_type}{else}random{/if}', slices: 15, boxCols: 8, boxRows: 4, animSpeed: '{if $slideOptions.animation_speed != ''}{$slideOptions.animation_speed}{else}600{/if}', pauseTime: '{if $slideOptions.pause_time != ''}{$slideOptions.pause_time}{else}5000{/if}', startSlide: {if $slideOptions.start_slide != ''}{$slideOptions.start_slide}{else}0{/if}, directionNav: {if $slideOptions.show_arrow != 0}{$slideOptions.show_arrow}{else}false{/if}, controlNav: {if $slideOptions.show_navigation != 0}{$slideOptions.show_navigation}{else}false{/if}, controlNavThumbs: false, pauseOnHover: true, manualAdvance: false, prevText: '<i class="icon-angle-left"></i>', nextText: '<i class="icon-angle-right"></i>', afterLoad: function(){ $('.pos-loading').css("display","none"); }, beforeChange: function(){ $('.bannerSlideshow1').removeClass("pos_in"); $('.bannerSlideshow2').removeClass("pos_in"); $('.bannerSlideshow3').removeClass("pos_in"); }, afterChange: function(){ $('.bannerSlideshow1').addClass("pos_in"); $('.bannerSlideshow2').addClass("pos_in"); $('.bannerSlideshow3').addClass("pos_in"); } }); }); </script> Archivo: /views/templates/admin/helpers/uploader {if isset($files) && $files|count > 0} {assign var='show_thumbnail' value=false} {foreach $files as $file} {if isset($file.image) && $file.type == 'image'} {assign var='show_thumbnail' value=true} {/if} {/foreach} {if $show_thumbnail} <div class="form-group"> <div class="col-lg-12" id="{$id}-images-thumbnails"> {foreach $files as $file} {if isset($file.image) && $file.type == 'image'} <div> {$file.image} {if isset($file.size)}<p>{l s='File size'} {$file.size}kb</p>{/if} {if isset($file.delete_url)} <p> <a class="btn btn-default" href="{$file.delete_url}"> <i class="icon-trash"></i> {l s='Delete'} </a> </p> {/if} </div> {/if} {/foreach} </div> </div> {/if} {/if} {if isset($max_files) && $files|count >= $max_files} <div class="row"> <div class="alert alert-warning">{l s='You have reached the limit (%s) of files to upload, please remove files to continue uploading' sprintf=$max_files}</div> </div> {else} <div class="form-group"> <div class="col-sm-6"> <input id="{$id}" type="file" name="{$name}"{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide" /> <div class="dummyfile input-group"> <span class="input-group-addon"><i class="icon-file"></i></span> <input id="{$id}-name" type="text" name="filename" readonly /> <span class="input-group-btn"> <button id="{$id}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default"> <i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if} </button> {if (!isset($multiple) || !$multiple) && isset($files) && $files|count == 1 && isset($files[0].download_url)} <a href="{$files[0].download_url}"> <button type="button" class="btn btn-default"> <i class="icon-cloud-download"></i> {if isset($size)}{l s='Download current file (%skb)' sprintf=$size}{else}{l s='Download current file'}{/if} </button> </a> {/if} </span> </div> </div> </div> <script type="text/javascript"> {if isset($multiple) && isset($max_files)} var {$id}_max_files = {$max_files - $files|count}; {/if} $(document).ready(function(){ $('#{$id}-selectbutton').click(function(e) { $('#{$id}').trigger('click'); }); $('#{$id}-name').click(function(e) { $('#{$id}').trigger('click'); }); $('#{$id}-name').on('dragenter', function(e) { e.stopPropagation(); e.preventDefault(); }); $('#{$id}-name').on('dragover', function(e) { e.stopPropagation(); e.preventDefault(); }); $('#{$id}-name').on('drop', function(e) { e.preventDefault(); var files = e.originalEvent.dataTransfer.files; $('#{$id}')[0].files = files; $(this).val(files[0].name); }); $('#{$id}').change(function(e) { if ($(this)[0].files !== undefined) { var files = $(this)[0].files; var name = ''; $.each(files, function(index, value) { name += value.name+', '; }); $('#{$id}-name').val(name.slice(0, -2)); } else // Internet Explorer 9 Compatibility { var name = $(this).val().split(/[\\/]/); $('#{$id}-name').val(name[name.length-1]); } }); if (typeof {$id}_max_files !== 'undefined') { $('#{$id}').closest('form').on('submit', function(e) { if ($('#{$id}')[0].files.length > {$id}_max_files) { e.preventDefault(); alert('{l s='You can upload a maximum of %s files'|sprintf:$max_files}'); } }); } }); </script> {/if} Adjuntos los módulos. Si pudiera servir para una mejor revisión. posstaticblocks.zip posslideshow.zip Link to comment Share on other sites More sharing options...
aaeq16 Posted October 21, 2015 Author Share Posted October 21, 2015 ¿Crees que podrías ayudarme? Link to comment Share on other sites More sharing options...
pedros650 Posted January 22, 2016 Share Posted January 22, 2016 the problem was solved at the source, postheme.com : fixed /modules/poslogo/posslideshow.php: <?php // Security if (!defined('_PS_VERSION_')) exit; // Checking compatibility with older PrestaShop and fixing it if (!defined('_MYSQL_ENGINE_')) define('_MYSQL_ENGINE_', 'MyISAM'); // Loading Models require_once(_PS_MODULE_DIR_ . 'posslideshow/models/Nivoslideshow.php'); class Posslideshow extends Module { private $_html = ''; private $_postErrors = array(); public function __construct() { $this->name = 'posslideshow'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'posthemes'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6'); parent::__construct(); $this->displayName = $this->l('Pos Slideshow'); $this->description = $this->l('block config'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); $this->admin_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/admin/'; } public function install() { //create folder blocklogo $path = _PS_IMG_DIR_.'blockslideshow'; if (!file_exists($path)) { mkdir($path, 0777, true); } // Install SQL include(dirname(__FILE__).'/sql/install.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Install Tabs if(!(int)Tab::getIdFromClassName('AdminPosMenu')) { $parent_tab = new Tab(); // Need a foreach for the language foreach (Language::getLanguages() as $language) $parent_tab->name[$language['id_lang']] = $this->l('PosExtentions'); $parent_tab->class_name = 'AdminPosMenu'; $parent_tab->id_parent = 0; // Home tab $parent_tab->module = $this->name; $parent_tab->add(); } $tab = new Tab(); // Need a foreach for the language foreach (Language::getLanguages() as $language) $tab->name[$language['id_lang']] = $this->l('Manage Slideshow'); $tab->class_name = 'AdminPosslideshow'; $tab->id_parent = (int)Tab::getIdFromClassName('AdminPosMenu'); $tab->module = $this->name; $tab->add(); if(!Configuration::updateValue($this->name.'_enable_md', 1) OR !Configuration::updateValue($this->name.'_animation_type', 'random')OR !Configuration::updateValue($this->name.'_pause_time', 6000) OR !Configuration::updateValue($this->name.'_animation_speed', 1000)OR !Configuration::updateValue($this->name.'_qty_item', 8) OR !Configuration::updateValue($this->name.'_show_arrow', 0) OR !Configuration::updateValue($this->name.'_show_caption', 1) OR !Configuration::updateValue($this->name.'_show_navigation', 1) OR !Configuration::updateValue($this->name.'_start_slide', 0)) {return false;} // Set some defaults return parent::install() && $this->registerHook('actionObjectSlideshowAddAfter') && $this->registerHook('homeBanner7')&& $this->_installHookCustomer()&& $this->registerHook('displayHeader'); } public function uninstall() { Configuration::deleteByName('POSSLIDESHOW'); // Uninstall Tabs //$tab = new Tab((int)Tab::getIdFromClassName('AdminPosMenu')); //$tab->delete(); $tab = new Tab((int)Tab::getIdFromClassName('AdminPosslideshow')); $tab->delete(); Configuration::deleteByName($this->name.'_enable_md'); Configuration::deleteByName($this->name.'_animation_type'); Configuration::deleteByName($this->name.'_pause_time'); Configuration::deleteByName($this->name.'_animation_speed'); Configuration::deleteByName($this->name.'_qty_item'); Configuration::deleteByName($this->name.'_show_thumbnail'); Configuration::deleteByName($this->name.'_show_arrow'); Configuration::deleteByName($this->name.'_show_caption'); Configuration::deleteByName($this->name.'_show_navigation'); Configuration::deleteByName($this->name.'_start_slide'); //uninstall db include(dirname(__FILE__).'/sql/uninstall_sql.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Uninstall Module if (!parent::uninstall()) return false; // !$this->unregisterHook('actionObjectExampleDataAddAfter') return true; } private function _postValidation() { } private function _postProcess() { Configuration::updateValue($this->name.'_enable_md', Tools::getValue('enable_md')); Configuration::updateValue($this->name.'_animation_type', Tools::getValue('animation_type')); Configuration::updateValue($this->name.'_pause_time', Tools::getValue('pause_time')); Configuration::updateValue($this->name.'_animation_speed', Tools::getValue('animation_speed')); Configuration::updateValue($this->name.'_qty_item', Tools::getValue('qty_item')); Configuration::updateValue($this->name.'_show_thumbnail', Tools::getValue('show_thumbnail')); Configuration::updateValue($this->name.'_show_arrow', Tools::getValue('show_arrow')); Configuration::updateValue($this->name.'_show_caption', Tools::getValue('show_caption')); Configuration::updateValue($this->name.'_show_navigation', Tools::getValue('show_navigation')); Configuration::updateValue($this->name.'_start_slide', Tools::getValue('start_slide')); $this->_html .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>'; } public function getContent() { $this->_html .= '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submit')) { $this->_postValidation(); if (!sizeof($this->_postErrors)) $this->_postProcess(); else { foreach ($this->_postErrors AS $err) { $this->_html .= '<div class="alert error">'.$err.'</div>'; } } } $this->_displayForm(); return $this->_html; } public function getAttrFromImage($image = NULL){ $doc = new DOMDocument(); $doc->loadHTML($image); $imageTags = $doc->getElementsByTagName('img'); foreach ($imageTags as $tag) { if($tag->getAttribute('src')) { return $tag->getAttribute('src'); break; } } return NULL; } public function getSlideshow() { $id_shop = (int)Context::getContext()->shop->id; $id_lang = (int)$this->context->language->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_slideshow` ps'; $sql .= ' LEFT JOIN `'. _DB_PREFIX_ . 'pos_slideshow_lang` psl'; $sql .= ' ON ps.id_pos_slideshow = psl.id_pos_slideshow'; $sql .= ' LEFT JOIN `' . _DB_PREFIX_ . 'pos_slideshow_shop` pss '; $sql .= ' ON ps.id_pos_slideshow = pss.id_pos_slideshow'; $sql .= ' where pss.`id_shop` ='.$id_shop ; $sql .= ' AND psl.`id_lang` ='.$id_lang ; $sql .=' AND ps.`active` =1'; $sql .= ' ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { if($limit == Configuration::get($this->name.'_qty_item')) break; $limit ++; //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='image'){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'img/blockslideshow/'.$slideArray['id_pos_slideshow'].'.jpg'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $v = str_replace('http://','https://',$v); } } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } //echo "<Pre>"; print_r($arraySlides); return $arraySlides; } private function _displayForm() { $this->_html .= ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset> <legend><img src="../img/admin/cog.gif" alt="" class="middle" />' . $this->l('Settings') . '</legend> <label>' . $this->l('Transition Type') . '</label> <div class="margin-form"> <select name ="animation_type">'; $animationCurrent = Tools::getValue('animation_type'); foreach($this->getTransitionTypeArray() as $key => $val){ if($animationCurrent == $key) { $this->_html.='<option value='.$key.' selected="selected" > '.$val.'</option>'; }else { $this->_html.='<option value='.$key.'>'.$val.'</option>'; } } $this->_html.='</select> </div> <label>'.$this->l('Pause Time: ').'</label> <div class="margin-form"> <input type = "text" name="pause_time" value ='. (Tools::getValue('pause_time')?Tools::getValue('pause_time'): Configuration::get($this->name.'_pause_time')).' ></input> </div> <label>'.$this->l('Start from slide: ').'</label> <div class="margin-form"> <input type = "text" name="start_slide" value ='.(Tools::getValue('start_slide')?Tools::getValue('start_slide'): Configuration::get($this->name.'_start_slide')).' ></input> </div> <label>'.$this->l('Animation Speed: ').'</label> <div class="margin-form"> <input type = "text" name="animation_speed" value ='.(Tools::getValue('animation_speed')?Tools::getValue('animation_speed'): Configuration::get($this->name.'_animation_speed')).' ></input> </div> <label>'.$this->l('Qty of items: ').'</label> <div class="margin-form"> <input type = "text" name="qty_item" value ='.(Tools::getValue('qty_item')?Tools::getValue('qty_item'): Configuration::get($this->name.'_qty_item')).' ></input> </div> <label>'.$this->l('Show Caption: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'show_caption', (Tools::getValue('title') ? Tools::getValue('show_caption') : Configuration::get($this->name . '_show_caption'))); $this->_html .=' </div> <label>'.$this->l('Show Next/Back: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'show_arrow', (Tools::getValue('title') ? Tools::getValue('show_arrow') : Configuration::get($this->name . '_show_arrow'))); $this->_html .=' </div> <label>'.$this->l('Show navigation control: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'show_navigation', (Tools::getValue('title') ? Tools::getValue('show_navigation') : Configuration::get($this->name . '_show_navigation'))); $this->_html .=' </div> <input type="submit" name="submit" value="'.$this->l('Update').'" class="button" /> </fieldset> </form>'; } public function getSelectOptionsHtml($options = NULL, $name = NULL, $selected = NULL) { $html = ""; $html .='<select name ='.$name.'>'; if(count($options)>0) { foreach($options as $key => $val) { if(trim($key) == trim($selected)) { $html .='<option value='.$key.' selected="selected">'.$val.'</option>'; } else { $html .='<option value='.$key.'>'.$val.'</option>'; } } } $html .= '</select>'; return $html; } public function getTransitionTypeArray() { return array( "random" => "random", "sliceDown" => "sliceDown", "sliceDownLeft" => "sliceDownLeft", "sliceUp" => "sliceUp", "sliceUpLeft" => "sliceUpLeft", "sliceUpDown" => "sliceUpDown", "sliceUpDownLeft" => "sliceUpDownLeft", "fold" => "fold", "fade" => "fade", "slideInRight" => "slideInRight", "slideInLeft" => "slideInLeft", "boxRandom" => "boxRandom", "boxRain" => "boxRain", "boxRainReverse" => "boxRainReverse", "boxRainGrow" => "boxRainGrow", "boxRainGrowReverse" => "boxRainGrowReverse", ); } public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/nivo-slider/nivo-slider.css'); $this->context->controller->addJS($this->_path.'js/nivo-slider/jquery.nivo.slider.pack.js'); } function hookhomeBanner7($params) { $options = array( 'enable_md' => Configuration::get($this->name.'_enable_md'), 'animation_type' => Configuration::get($this->name.'_animation_type'), 'pause_time' => Configuration::get($this->name.'_pause_time'), 'animation_speed' => Configuration::get($this->name.'_animation_speed'), 'qty_item' => Configuration::get($this->name.'_qty_item'), 'show_thumbnail' => Configuration::get($this->name.'_show_thumbnail'), 'show_caption' => Configuration::get($this->name.'_show_caption'), 'show_arrow' => Configuration::get($this->name.'_show_arrow'), 'show_navigation' => Configuration::get($this->name.'_show_navigation'), 'start_slide' => Configuration::get($this->name.'_start_slide'), ); $slides = $this->getSlideshow(); $this->context->smarty->assign('slideOptions', $options); $this->context->smarty->assign('slides', $slides); return $this->display(__FILE__, 'slideshow.tpl'); } public function hookActionObjectSlideshowAddAfter($params) { return true; } private function _installHookCustomer(){ $hookspos = array( 'homeBanner7', ); foreach( $hookspos as $hook ){ if( Hook::getIdByName($hook) ){ } else { $new_hook = new Hook(); $new_hook->name = pSQL($hook); $new_hook->title = pSQL($hook); $new_hook->add(); $id_hook = $new_hook->id; } } return true; } } fixed /modules/poslogo/poslogo.php: <?php // Security if (!defined('_PS_VERSION_')) exit; // Checking compatibility with older PrestaShop and fixing it if (!defined('_MYSQL_ENGINE_')) define('_MYSQL_ENGINE_', 'MyISAM'); // Loading Models require_once(_PS_MODULE_DIR_ . 'poslogo/models/Logo.php'); class poslogo extends Module { private $_html = ''; private $_postErrors = array(); public function __construct() { $this->name = 'poslogo'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'posthemes'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6'); parent::__construct(); $this->displayName = $this->l('Pos Logo'); $this->description = $this->l('block config'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); $this->admin_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/admin/'; } public function install() { //create folder blocklogo $path = _PS_IMG_DIR_.'blocklogo'; if (!file_exists($path)) { mkdir($path, 0777, true); } // Install SQL include(dirname(__FILE__).'/sql/install.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Install Tabs if(!(int)Tab::getIdFromClassName('AdminPosMenu')) { $parent_tab = new Tab(); // Need a foreach for the language $parent_tab->name[$this->context->language->id] = $this->l('PosExtentions'); $parent_tab->class_name = 'AdminPosMenu'; $parent_tab->id_parent = 0; // Home tab $parent_tab->module = $this->name; $parent_tab->add(); } $tab = new Tab(); foreach (Language::getLanguages() as $language) $tab->name[$language['id_lang']] = $this->l('Manage Logo'); $tab->class_name = 'AdminPosLogo'; $tab->id_parent = (int)Tab::getIdFromClassName('AdminPosMenu'); $tab->module = $this->name; $tab->add(); Configuration::updateValue($this->name . '_auto', 0); Configuration::updateValue($this->name . '_speed_slide', '1000'); Configuration::updateValue($this->name . '_a_speed', '1000'); Configuration::updateValue($this->name . '_qty_products', 9); Configuration::updateValue($this->name . '_qty_items', 9); Configuration::updateValue($this->name . '_width_item', 212); Configuration::updateValue($this->name . '_show_nextback', 1); Configuration::updateValue($this->name . '_show_control', 0); Configuration::updateValue($this->name . '_min_item', 1); Configuration::updateValue($this->name . '_max_item', 5); Configuration::updateValue($this->name . '_mode_dir', 'vertical'); // Set some defaults return parent::install() && $this->registerHook('top')&& $this->registerHook('leftColumn')&& $this->registerHook('rightColumn')&& $this->_installHookCustomer()&& $this->registerHook('brandSlider')&& $this->registerHook('displayFooter')&& $this->registerHook('displayHeader'); } public function uninstall() { Configuration::deleteByName('poslogo'); // Uninstall Tabs $tab = new Tab((int)Tab::getIdFromClassName('AdminPosLogo')); $tab->delete(); Configuration::deleteByName($this->name . '_auto'); Configuration::deleteByName($this->name . '_speed_slide'); Configuration::deleteByName($this->name . '_a_speed'); // Configuration::deleteByName($this->name . '_show_price'); //Configuration::deleteByName($this->name . '_show_des'); Configuration::deleteByName($this->name . '_qty_products'); Configuration::deleteByName($this->name . '_qty_items'); Configuration::deleteByName($this->name . '_width_item'); Configuration::deleteByName($this->name . '_show_nextback'); Configuration::deleteByName($this->name . '_show_control'); Configuration::deleteByName($this->name . '_min_item'); Configuration::deleteByName($this->name . '_max_item'); Configuration::deleteByName($this->name . '_mode_dir'); include(dirname(__FILE__).'/sql/uninstall_sql.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Uninstall Module if (!parent::uninstall()) return false; // !$this->unregisterHook('actionObjectExampleDataAddAfter') return true; } private function _postProcess() { Configuration::updateValue($this->name . '_auto', Tools::getValue('auto')); Configuration::updateValue($this->name . '_speed_slide', Tools::getValue('speed_slide')); Configuration::updateValue($this->name . '_a_speed', Tools::getValue('a_speed')); //Configuration::updateValue($this->name . '_show_price', Tools::getValue('show_price')); //Configuration::updateValue($this->name . '_show_des', Tools::getValue('show_des')); Configuration::updateValue($this->name . '_qty_products', Tools::getValue('qty_products')); Configuration::updateValue($this->name . '_qty_items', Tools::getValue('qty_items')); Configuration::updateValue($this->name . '_width_item', Tools::getValue('width_item')); Configuration::updateValue($this->name . '_show_nextback', Tools::getValue('show_nextback')); Configuration::updateValue($this->name . '_show_control', Tools::getValue('show_control')); Configuration::updateValue($this->name . '_min_item', Tools::getValue('min_item')); Configuration::updateValue($this->name . '_max_item', Tools::getValue('max_item')); Configuration::updateValue($this->name . '_mode_dir', Tools::getValue('mode_dir')); $this->_html .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>'; } public function getContent() { $this->_html .= '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitPostLogo')) { //$this->_postValidation(); if (!sizeof($this->_postErrors)) $this->_postProcess(); else { foreach ($this->_postErrors AS $err) { $this->_html .= '<div class="alert error">'.$err.'</div>'; } } } $this->_displayForm(); return $this->_html; } public function getAttrFromImage($image = NULL){ $doc = new DOMDocument(); $doc->loadHTML($image); $imageTags = $doc->getElementsByTagName('img'); foreach ($imageTags as $tag) { if($tag->getAttribute('src')) { return $tag->getAttribute('src'); break; } } return NULL; } public function getLogo() { $id_shop = (int)Context::getContext()->shop->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_logo` ps LEFT JOIN `' . _DB_PREFIX_ . 'pos_logo_shop` s ON ps.id_pos_logo = s.id_pos_logo where s.`id_shop` ='.$id_shop.' ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { if($limit == Configuration::get($this->name.'_qty_products')) break; $limit ++; //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='image'){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'img/blocklogo/'.$slideArray['id_pos_logo'].'.jpg'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $v = str_replace('http://','https://',$v); } } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } return $arraySlides; } public function getSelectOptionsHtml($options = NULL, $name = NULL, $selected = NULL) { $html = ""; $html .='<select name =' . $name . ' style="width:130px">'; if (count($options) > 0) { foreach ($options as $key => $val) { if (trim($key) == trim($selected)) { $html .='<option value=' . $key . ' selected="selected">' . $val . '</option>'; } else { $html .='<option value=' . $key . '>' . $val . '</option>'; } } } $html .= '</select>'; return $html; } private function _displayForm() { $this->_html .= ' <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <fieldset> <legend><img src="../img/admin/cog.gif" alt="" class="middle" />' . $this->l('Settings') . '</legend> <label>' . $this->l('Auto slide: ') . '</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0 => 'No', 1 => 'Yes'), 'auto', (Tools::getValue('auto') ? Tools::getValue('auto') : Configuration::get($this->name . '_auto'))); $this->_html .=' </div> <label>' . $this->l('Min Items: ') . '</label> <div class="margin-form"> <input type = "text" name="min_item" value =' . (Tools::getValue('min_item') ? Tools::getValue('min_item') : Configuration::get($this->name . '_min_item')) . ' ></input> </div> <label>' . $this->l('Max Items: ') . '</label> <div class="margin-form"> <input type = "text" name="max_item" value =' . (Tools::getValue('max_item') ? Tools::getValue('max_item') : Configuration::get($this->name . '_max_item')) . ' ></input> </div> <label>' . $this->l('Slideshow speed: ') . '</label> <div class="margin-form"> <input type = "text" name="speed_slide" value =' . (Tools::getValue('speed_slide') ? Tools::getValue('speed_slide') : Configuration::get($this->name . '_speed_slide')) . ' ></input> </div> <label>' . $this->l('Pause: ') . '</label> <div class="margin-form"> <input type = "text" name="a_speed" value =' . (Tools::getValue('a_speed_slide') ? Tools::getValue('a_speed') : Configuration::get($this->name . '_a_speed')) . ' ></input> </div> <label>' . $this->l('Qty of Logos : ') . '</label> <div class="margin-form"> <input type = "text" name="qty_products" value =' . (Tools::getValue('qty_products') ? Tools::getValue('qty_products') : Configuration::get($this->name . '_qty_products')) . ' ></input> </div> <label>' . $this->l('Width of Item: ') . '</label> <div class="margin-form"> <input type = "text" name="width_item" value =' . (Tools::getValue('width_item') ? Tools::getValue('width_item') : Configuration::get($this->name . '_width_item')) . ' ></input> </div> <label>' . $this->l('Show Next/Back control: : ') . '</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0 => 'No', 1 => 'Yes'), 'show_nextback', (Tools::getValue('show_nextback') ? Tools::getValue('show_nextback') : Configuration::get($this->name . '_show_nextback'))); $this->_html .=' </div> <label>' . $this->l('Show navigation control: : ') . '</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0 => 'No', 1 => 'Yes'), 'show_control', (Tools::getValue('show_control') ? Tools::getValue('show_control') : Configuration::get($this->name . '_show_control'))); $this->_html .=' </div> <input type="submit" name="submitPostLogo" value="' . $this->l('Update') . '" class="button" /> </fieldset> </form>'; return $this->_html; } public function hookDisplayHeader() { // $this->context->controller->addCSS(($this->_path) . 'css/logo.css', 'all'); // $this->context->controller->addJS($this->_path . 'js/pos.bxslider.min.js'); } function hookBrandSlider($params) { $options = array( 'auto' => Configuration::get($this->name . '_auto'), 'speed_slide' => Configuration::get($this->name . '_speed_slide'), 'a_speed' => Configuration::get($this->name . '_a_speed'), // 'show_price' => Configuration::get($this->name . '_show_price'), //'show_des' => Configuration::get($this->name . '_show_des'), 'qty_products' => Configuration::get($this->name . '_qty_products'), 'qty_items' => Configuration::get($this->name . '_qty_items'), 'width_item' => Configuration::get($this->name . '_width_item'), 'show_nexback' => Configuration::get($this->name . '_show_nextback'), 'show_control' => Configuration::get($this->name . '_show_control'), 'min_item' => Configuration::get($this->name . '_min_item'), 'max_item' => Configuration::get($this->name . '_max_item'), 'mode_dir' => Configuration::get($this->name . '_mode_dir'), //'show_addtocart' => Configuration::get($this->name . '_show_addtocart'), ); $logos = $this->getLogo(); if(count($logos)<1) return NULL; $this->context->smarty->assign('slideOptions', $options); $this->context->smarty->assign('logos', $logos); return $this->display(__FILE__, 'logo.tpl'); } private function _installHookCustomer(){ $hookspos = array( 'brandSlider', ); foreach( $hookspos as $hook ){ if( Hook::getIdByName($hook) ){ } else { $new_hook = new Hook(); $new_hook->name = pSQL($hook); $new_hook->title = pSQL($hook); $new_hook->add(); $id_hook = $new_hook->id; } } return true; } } Link to comment Share on other sites More sharing options...
aaeq16 Posted January 22, 2016 Author Share Posted January 22, 2016 the problem was solved at the source, postheme.com : fixed /modules/poslogo/posslideshow.php: <?php // Security if (!defined('_PS_VERSION_')) exit; // Checking compatibility with older PrestaShop and fixing it if (!defined('_MYSQL_ENGINE_')) define('_MYSQL_ENGINE_', 'MyISAM'); // Loading Models require_once(_PS_MODULE_DIR_ . 'posslideshow/models/Nivoslideshow.php'); class Posslideshow extends Module { private $_html = ''; private $_postErrors = array(); public function __construct() { $this->name = 'posslideshow'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'posthemes'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6'); parent::__construct(); $this->displayName = $this->l('Pos Slideshow'); $this->description = $this->l('block config'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); $this->admin_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/admin/'; } public function install() { //create folder blocklogo $path = _PS_IMG_DIR_.'blockslideshow'; if (!file_exists($path)) { mkdir($path, 0777, true); } // Install SQL include(dirname(__FILE__).'/sql/install.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Install Tabs if(!(int)Tab::getIdFromClassName('AdminPosMenu')) { $parent_tab = new Tab(); // Need a foreach for the language foreach (Language::getLanguages() as $language) $parent_tab->name[$language['id_lang']] = $this->l('PosExtentions'); $parent_tab->class_name = 'AdminPosMenu'; $parent_tab->id_parent = 0; // Home tab $parent_tab->module = $this->name; $parent_tab->add(); } $tab = new Tab(); // Need a foreach for the language foreach (Language::getLanguages() as $language) $tab->name[$language['id_lang']] = $this->l('Manage Slideshow'); $tab->class_name = 'AdminPosslideshow'; $tab->id_parent = (int)Tab::getIdFromClassName('AdminPosMenu'); $tab->module = $this->name; $tab->add(); if(!Configuration::updateValue($this->name.'_enable_md', 1) OR !Configuration::updateValue($this->name.'_animation_type', 'random')OR !Configuration::updateValue($this->name.'_pause_time', 6000) OR !Configuration::updateValue($this->name.'_animation_speed', 1000)OR !Configuration::updateValue($this->name.'_qty_item', 8) OR !Configuration::updateValue($this->name.'_show_arrow', 0) OR !Configuration::updateValue($this->name.'_show_caption', 1) OR !Configuration::updateValue($this->name.'_show_navigation', 1) OR !Configuration::updateValue($this->name.'_start_slide', 0)) {return false;} // Set some defaults return parent::install() && $this->registerHook('actionObjectSlideshowAddAfter') && $this->registerHook('homeBanner7')&& $this->_installHookCustomer()&& $this->registerHook('displayHeader'); } public function uninstall() { Configuration::deleteByName('POSSLIDESHOW'); // Uninstall Tabs //$tab = new Tab((int)Tab::getIdFromClassName('AdminPosMenu')); //$tab->delete(); $tab = new Tab((int)Tab::getIdFromClassName('AdminPosslideshow')); $tab->delete(); Configuration::deleteByName($this->name.'_enable_md'); Configuration::deleteByName($this->name.'_animation_type'); Configuration::deleteByName($this->name.'_pause_time'); Configuration::deleteByName($this->name.'_animation_speed'); Configuration::deleteByName($this->name.'_qty_item'); Configuration::deleteByName($this->name.'_show_thumbnail'); Configuration::deleteByName($this->name.'_show_arrow'); Configuration::deleteByName($this->name.'_show_caption'); Configuration::deleteByName($this->name.'_show_navigation'); Configuration::deleteByName($this->name.'_start_slide'); //uninstall db include(dirname(__FILE__).'/sql/uninstall_sql.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Uninstall Module if (!parent::uninstall()) return false; // !$this->unregisterHook('actionObjectExampleDataAddAfter') return true; } private function _postValidation() { } private function _postProcess() { Configuration::updateValue($this->name.'_enable_md', Tools::getValue('enable_md')); Configuration::updateValue($this->name.'_animation_type', Tools::getValue('animation_type')); Configuration::updateValue($this->name.'_pause_time', Tools::getValue('pause_time')); Configuration::updateValue($this->name.'_animation_speed', Tools::getValue('animation_speed')); Configuration::updateValue($this->name.'_qty_item', Tools::getValue('qty_item')); Configuration::updateValue($this->name.'_show_thumbnail', Tools::getValue('show_thumbnail')); Configuration::updateValue($this->name.'_show_arrow', Tools::getValue('show_arrow')); Configuration::updateValue($this->name.'_show_caption', Tools::getValue('show_caption')); Configuration::updateValue($this->name.'_show_navigation', Tools::getValue('show_navigation')); Configuration::updateValue($this->name.'_start_slide', Tools::getValue('start_slide')); $this->_html .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>'; } public function getContent() { $this->_html .= '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submit')) { $this->_postValidation(); if (!sizeof($this->_postErrors)) $this->_postProcess(); else { foreach ($this->_postErrors AS $err) { $this->_html .= '<div class="alert error">'.$err.'</div>'; } } } $this->_displayForm(); return $this->_html; } public function getAttrFromImage($image = NULL){ $doc = new DOMDocument(); $doc->loadHTML($image); $imageTags = $doc->getElementsByTagName('img'); foreach ($imageTags as $tag) { if($tag->getAttribute('src')) { return $tag->getAttribute('src'); break; } } return NULL; } public function getSlideshow() { $id_shop = (int)Context::getContext()->shop->id; $id_lang = (int)$this->context->language->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_slideshow` ps'; $sql .= ' LEFT JOIN `'. _DB_PREFIX_ . 'pos_slideshow_lang` psl'; $sql .= ' ON ps.id_pos_slideshow = psl.id_pos_slideshow'; $sql .= ' LEFT JOIN `' . _DB_PREFIX_ . 'pos_slideshow_shop` pss '; $sql .= ' ON ps.id_pos_slideshow = pss.id_pos_slideshow'; $sql .= ' where pss.`id_shop` ='.$id_shop ; $sql .= ' AND psl.`id_lang` ='.$id_lang ; $sql .=' AND ps.`active` =1'; $sql .= ' ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { if($limit == Configuration::get($this->name.'_qty_item')) break; $limit ++; //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='image'){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'img/blockslideshow/'.$slideArray['id_pos_slideshow'].'.jpg'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $v = str_replace('http://','https://',$v); } } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } //echo "<Pre>"; print_r($arraySlides); return $arraySlides; } private function _displayForm() { $this->_html .= ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset> <legend><img src="../img/admin/cog.gif" alt="" class="middle" />' . $this->l('Settings') . '</legend> <label>' . $this->l('Transition Type') . '</label> <div class="margin-form"> <select name ="animation_type">'; $animationCurrent = Tools::getValue('animation_type'); foreach($this->getTransitionTypeArray() as $key => $val){ if($animationCurrent == $key) { $this->_html.='<option value='.$key.' selected="selected" > '.$val.'</option>'; }else { $this->_html.='<option value='.$key.'>'.$val.'</option>'; } } $this->_html.='</select> </div> <label>'.$this->l('Pause Time: ').'</label> <div class="margin-form"> <input type = "text" name="pause_time" value ='. (Tools::getValue('pause_time')?Tools::getValue('pause_time'): Configuration::get($this->name.'_pause_time')).' ></input> </div> <label>'.$this->l('Start from slide: ').'</label> <div class="margin-form"> <input type = "text" name="start_slide" value ='.(Tools::getValue('start_slide')?Tools::getValue('start_slide'): Configuration::get($this->name.'_start_slide')).' ></input> </div> <label>'.$this->l('Animation Speed: ').'</label> <div class="margin-form"> <input type = "text" name="animation_speed" value ='.(Tools::getValue('animation_speed')?Tools::getValue('animation_speed'): Configuration::get($this->name.'_animation_speed')).' ></input> </div> <label>'.$this->l('Qty of items: ').'</label> <div class="margin-form"> <input type = "text" name="qty_item" value ='.(Tools::getValue('qty_item')?Tools::getValue('qty_item'): Configuration::get($this->name.'_qty_item')).' ></input> </div> <label>'.$this->l('Show Caption: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'show_caption', (Tools::getValue('title') ? Tools::getValue('show_caption') : Configuration::get($this->name . '_show_caption'))); $this->_html .=' </div> <label>'.$this->l('Show Next/Back: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'show_arrow', (Tools::getValue('title') ? Tools::getValue('show_arrow') : Configuration::get($this->name . '_show_arrow'))); $this->_html .=' </div> <label>'.$this->l('Show navigation control: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'show_navigation', (Tools::getValue('title') ? Tools::getValue('show_navigation') : Configuration::get($this->name . '_show_navigation'))); $this->_html .=' </div> <input type="submit" name="submit" value="'.$this->l('Update').'" class="button" /> </fieldset> </form>'; } public function getSelectOptionsHtml($options = NULL, $name = NULL, $selected = NULL) { $html = ""; $html .='<select name ='.$name.'>'; if(count($options)>0) { foreach($options as $key => $val) { if(trim($key) == trim($selected)) { $html .='<option value='.$key.' selected="selected">'.$val.'</option>'; } else { $html .='<option value='.$key.'>'.$val.'</option>'; } } } $html .= '</select>'; return $html; } public function getTransitionTypeArray() { return array( "random" => "random", "sliceDown" => "sliceDown", "sliceDownLeft" => "sliceDownLeft", "sliceUp" => "sliceUp", "sliceUpLeft" => "sliceUpLeft", "sliceUpDown" => "sliceUpDown", "sliceUpDownLeft" => "sliceUpDownLeft", "fold" => "fold", "fade" => "fade", "slideInRight" => "slideInRight", "slideInLeft" => "slideInLeft", "boxRandom" => "boxRandom", "boxRain" => "boxRain", "boxRainReverse" => "boxRainReverse", "boxRainGrow" => "boxRainGrow", "boxRainGrowReverse" => "boxRainGrowReverse", ); } public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/nivo-slider/nivo-slider.css'); $this->context->controller->addJS($this->_path.'js/nivo-slider/jquery.nivo.slider.pack.js'); } function hookhomeBanner7($params) { $options = array( 'enable_md' => Configuration::get($this->name.'_enable_md'), 'animation_type' => Configuration::get($this->name.'_animation_type'), 'pause_time' => Configuration::get($this->name.'_pause_time'), 'animation_speed' => Configuration::get($this->name.'_animation_speed'), 'qty_item' => Configuration::get($this->name.'_qty_item'), 'show_thumbnail' => Configuration::get($this->name.'_show_thumbnail'), 'show_caption' => Configuration::get($this->name.'_show_caption'), 'show_arrow' => Configuration::get($this->name.'_show_arrow'), 'show_navigation' => Configuration::get($this->name.'_show_navigation'), 'start_slide' => Configuration::get($this->name.'_start_slide'), ); $slides = $this->getSlideshow(); $this->context->smarty->assign('slideOptions', $options); $this->context->smarty->assign('slides', $slides); return $this->display(__FILE__, 'slideshow.tpl'); } public function hookActionObjectSlideshowAddAfter($params) { return true; } private function _installHookCustomer(){ $hookspos = array( 'homeBanner7', ); foreach( $hookspos as $hook ){ if( Hook::getIdByName($hook) ){ } else { $new_hook = new Hook(); $new_hook->name = pSQL($hook); $new_hook->title = pSQL($hook); $new_hook->add(); $id_hook = $new_hook->id; } } return true; } } fixed /modules/poslogo/poslogo.php: <?php // Security if (!defined('_PS_VERSION_')) exit; // Checking compatibility with older PrestaShop and fixing it if (!defined('_MYSQL_ENGINE_')) define('_MYSQL_ENGINE_', 'MyISAM'); // Loading Models require_once(_PS_MODULE_DIR_ . 'poslogo/models/Logo.php'); class poslogo extends Module { private $_html = ''; private $_postErrors = array(); public function __construct() { $this->name = 'poslogo'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'posthemes'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.5', 'max' => '1.6'); parent::__construct(); $this->displayName = $this->l('Pos Logo'); $this->description = $this->l('block config'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); $this->admin_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/admin/'; } public function install() { //create folder blocklogo $path = _PS_IMG_DIR_.'blocklogo'; if (!file_exists($path)) { mkdir($path, 0777, true); } // Install SQL include(dirname(__FILE__).'/sql/install.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Install Tabs if(!(int)Tab::getIdFromClassName('AdminPosMenu')) { $parent_tab = new Tab(); // Need a foreach for the language $parent_tab->name[$this->context->language->id] = $this->l('PosExtentions'); $parent_tab->class_name = 'AdminPosMenu'; $parent_tab->id_parent = 0; // Home tab $parent_tab->module = $this->name; $parent_tab->add(); } $tab = new Tab(); foreach (Language::getLanguages() as $language) $tab->name[$language['id_lang']] = $this->l('Manage Logo'); $tab->class_name = 'AdminPosLogo'; $tab->id_parent = (int)Tab::getIdFromClassName('AdminPosMenu'); $tab->module = $this->name; $tab->add(); Configuration::updateValue($this->name . '_auto', 0); Configuration::updateValue($this->name . '_speed_slide', '1000'); Configuration::updateValue($this->name . '_a_speed', '1000'); Configuration::updateValue($this->name . '_qty_products', 9); Configuration::updateValue($this->name . '_qty_items', 9); Configuration::updateValue($this->name . '_width_item', 212); Configuration::updateValue($this->name . '_show_nextback', 1); Configuration::updateValue($this->name . '_show_control', 0); Configuration::updateValue($this->name . '_min_item', 1); Configuration::updateValue($this->name . '_max_item', 5); Configuration::updateValue($this->name . '_mode_dir', 'vertical'); // Set some defaults return parent::install() && $this->registerHook('top')&& $this->registerHook('leftColumn')&& $this->registerHook('rightColumn')&& $this->_installHookCustomer()&& $this->registerHook('brandSlider')&& $this->registerHook('displayFooter')&& $this->registerHook('displayHeader'); } public function uninstall() { Configuration::deleteByName('poslogo'); // Uninstall Tabs $tab = new Tab((int)Tab::getIdFromClassName('AdminPosLogo')); $tab->delete(); Configuration::deleteByName($this->name . '_auto'); Configuration::deleteByName($this->name . '_speed_slide'); Configuration::deleteByName($this->name . '_a_speed'); // Configuration::deleteByName($this->name . '_show_price'); //Configuration::deleteByName($this->name . '_show_des'); Configuration::deleteByName($this->name . '_qty_products'); Configuration::deleteByName($this->name . '_qty_items'); Configuration::deleteByName($this->name . '_width_item'); Configuration::deleteByName($this->name . '_show_nextback'); Configuration::deleteByName($this->name . '_show_control'); Configuration::deleteByName($this->name . '_min_item'); Configuration::deleteByName($this->name . '_max_item'); Configuration::deleteByName($this->name . '_mode_dir'); include(dirname(__FILE__).'/sql/uninstall_sql.php'); foreach ($sql as $s) if (!Db::getInstance()->execute($s)) return false; // Uninstall Module if (!parent::uninstall()) return false; // !$this->unregisterHook('actionObjectExampleDataAddAfter') return true; } private function _postProcess() { Configuration::updateValue($this->name . '_auto', Tools::getValue('auto')); Configuration::updateValue($this->name . '_speed_slide', Tools::getValue('speed_slide')); Configuration::updateValue($this->name . '_a_speed', Tools::getValue('a_speed')); //Configuration::updateValue($this->name . '_show_price', Tools::getValue('show_price')); //Configuration::updateValue($this->name . '_show_des', Tools::getValue('show_des')); Configuration::updateValue($this->name . '_qty_products', Tools::getValue('qty_products')); Configuration::updateValue($this->name . '_qty_items', Tools::getValue('qty_items')); Configuration::updateValue($this->name . '_width_item', Tools::getValue('width_item')); Configuration::updateValue($this->name . '_show_nextback', Tools::getValue('show_nextback')); Configuration::updateValue($this->name . '_show_control', Tools::getValue('show_control')); Configuration::updateValue($this->name . '_min_item', Tools::getValue('min_item')); Configuration::updateValue($this->name . '_max_item', Tools::getValue('max_item')); Configuration::updateValue($this->name . '_mode_dir', Tools::getValue('mode_dir')); $this->_html .= '<div class="conf confirm">'.$this->l('Settings updated').'</div>'; } public function getContent() { $this->_html .= '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitPostLogo')) { //$this->_postValidation(); if (!sizeof($this->_postErrors)) $this->_postProcess(); else { foreach ($this->_postErrors AS $err) { $this->_html .= '<div class="alert error">'.$err.'</div>'; } } } $this->_displayForm(); return $this->_html; } public function getAttrFromImage($image = NULL){ $doc = new DOMDocument(); $doc->loadHTML($image); $imageTags = $doc->getElementsByTagName('img'); foreach ($imageTags as $tag) { if($tag->getAttribute('src')) { return $tag->getAttribute('src'); break; } } return NULL; } public function getLogo() { $id_shop = (int)Context::getContext()->shop->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_logo` ps LEFT JOIN `' . _DB_PREFIX_ . 'pos_logo_shop` s ON ps.id_pos_logo = s.id_pos_logo where s.`id_shop` ='.$id_shop.' ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { if($limit == Configuration::get($this->name.'_qty_products')) break; $limit ++; //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='image'){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'img/blocklogo/'.$slideArray['id_pos_logo'].'.jpg'; if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $v = str_replace('http://','https://',$v); } } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } return $arraySlides; } public function getSelectOptionsHtml($options = NULL, $name = NULL, $selected = NULL) { $html = ""; $html .='<select name =' . $name . ' style="width:130px">'; if (count($options) > 0) { foreach ($options as $key => $val) { if (trim($key) == trim($selected)) { $html .='<option value=' . $key . ' selected="selected">' . $val . '</option>'; } else { $html .='<option value=' . $key . '>' . $val . '</option>'; } } } $html .= '</select>'; return $html; } private function _displayForm() { $this->_html .= ' <form action="' . $_SERVER['REQUEST_URI'] . '" method="post"> <fieldset> <legend><img src="../img/admin/cog.gif" alt="" class="middle" />' . $this->l('Settings') . '</legend> <label>' . $this->l('Auto slide: ') . '</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0 => 'No', 1 => 'Yes'), 'auto', (Tools::getValue('auto') ? Tools::getValue('auto') : Configuration::get($this->name . '_auto'))); $this->_html .=' </div> <label>' . $this->l('Min Items: ') . '</label> <div class="margin-form"> <input type = "text" name="min_item" value =' . (Tools::getValue('min_item') ? Tools::getValue('min_item') : Configuration::get($this->name . '_min_item')) . ' ></input> </div> <label>' . $this->l('Max Items: ') . '</label> <div class="margin-form"> <input type = "text" name="max_item" value =' . (Tools::getValue('max_item') ? Tools::getValue('max_item') : Configuration::get($this->name . '_max_item')) . ' ></input> </div> <label>' . $this->l('Slideshow speed: ') . '</label> <div class="margin-form"> <input type = "text" name="speed_slide" value =' . (Tools::getValue('speed_slide') ? Tools::getValue('speed_slide') : Configuration::get($this->name . '_speed_slide')) . ' ></input> </div> <label>' . $this->l('Pause: ') . '</label> <div class="margin-form"> <input type = "text" name="a_speed" value =' . (Tools::getValue('a_speed_slide') ? Tools::getValue('a_speed') : Configuration::get($this->name . '_a_speed')) . ' ></input> </div> <label>' . $this->l('Qty of Logos : ') . '</label> <div class="margin-form"> <input type = "text" name="qty_products" value =' . (Tools::getValue('qty_products') ? Tools::getValue('qty_products') : Configuration::get($this->name . '_qty_products')) . ' ></input> </div> <label>' . $this->l('Width of Item: ') . '</label> <div class="margin-form"> <input type = "text" name="width_item" value =' . (Tools::getValue('width_item') ? Tools::getValue('width_item') : Configuration::get($this->name . '_width_item')) . ' ></input> </div> <label>' . $this->l('Show Next/Back control: : ') . '</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0 => 'No', 1 => 'Yes'), 'show_nextback', (Tools::getValue('show_nextback') ? Tools::getValue('show_nextback') : Configuration::get($this->name . '_show_nextback'))); $this->_html .=' </div> <label>' . $this->l('Show navigation control: : ') . '</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0 => 'No', 1 => 'Yes'), 'show_control', (Tools::getValue('show_control') ? Tools::getValue('show_control') : Configuration::get($this->name . '_show_control'))); $this->_html .=' </div> <input type="submit" name="submitPostLogo" value="' . $this->l('Update') . '" class="button" /> </fieldset> </form>'; return $this->_html; } public function hookDisplayHeader() { // $this->context->controller->addCSS(($this->_path) . 'css/logo.css', 'all'); // $this->context->controller->addJS($this->_path . 'js/pos.bxslider.min.js'); } function hookBrandSlider($params) { $options = array( 'auto' => Configuration::get($this->name . '_auto'), 'speed_slide' => Configuration::get($this->name . '_speed_slide'), 'a_speed' => Configuration::get($this->name . '_a_speed'), // 'show_price' => Configuration::get($this->name . '_show_price'), //'show_des' => Configuration::get($this->name . '_show_des'), 'qty_products' => Configuration::get($this->name . '_qty_products'), 'qty_items' => Configuration::get($this->name . '_qty_items'), 'width_item' => Configuration::get($this->name . '_width_item'), 'show_nexback' => Configuration::get($this->name . '_show_nextback'), 'show_control' => Configuration::get($this->name . '_show_control'), 'min_item' => Configuration::get($this->name . '_min_item'), 'max_item' => Configuration::get($this->name . '_max_item'), 'mode_dir' => Configuration::get($this->name . '_mode_dir'), //'show_addtocart' => Configuration::get($this->name . '_show_addtocart'), ); $logos = $this->getLogo(); if(count($logos)<1) return NULL; $this->context->smarty->assign('slideOptions', $options); $this->context->smarty->assign('logos', $logos); return $this->display(__FILE__, 'logo.tpl'); } private function _installHookCustomer(){ $hookspos = array( 'brandSlider', ); foreach( $hookspos as $hook ){ if( Hook::getIdByName($hook) ){ } else { $new_hook = new Hook(); $new_hook->name = pSQL($hook); $new_hook->title = pSQL($hook); $new_hook->add(); $id_hook = $new_hook->id; } } return true; } } That's found! Thank you very much Link to comment Share on other sites More sharing options...
gruponor Posted December 8, 2017 Share Posted December 8, 2017 llevaba semanas como loco para ver como podía quitar el contenido mixto, de esta web: suspirelove.com y no había forma (eestuvo mirando el código detalladamente y nada), Gracias a este post, he podido solucionarlo.. Realmente solo he aplicado las líneas (fila 204); if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { $v = str_replace('http://','https://',$v); } en los archivos poslogo.php y posslidershow.php,,, y se me soluciono el problema, ahora sale el candado en la web.. os quiero dar las enormes gracias, un saludo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now