canvastig Posted August 9, 2017 Share Posted August 9, 2017 Good evening,I am working with prestashop for over a year now and currently using prestashop 1.6.1.14I have bought a theme from themeforest called post optima and everything works fine, but I noticed that all of the images that I upload into the slide turns out to be unsecured and therefore I get the following message: (index):533 Mixed Content: The page at 'https://www.canvastig.nl/nl/' was loaded over HTTPS, but requested an insecure image 'http://www.canvastig.nl/modules/possequence/images/bgimage_7.jpg'. This content should also be served over HTTPS. I tried searching the web for answers, but nothing seem to work, therefor I would like to ask if someone could help me out with this issue. I already have SSL enabled for all pages in the backoffice including the friendly url.I am looking forward to any suggestion and my apologies for my bad grammar. Link to comment Share on other sites More sharing options...
Scully Posted August 9, 2017 Share Posted August 9, 2017 Have you already contacted the themes programmer? Why do I ask this? Unfortunately it is still a common problem tha theme developers do not respect the SSL settings and somethimes just rely on http - with the consequences you have described. To fix the problem, you first needed to find the .tpl file your module uses to show the images. .tpl are the files responsible for screen output. I would first look into your themes path / modules / possequence If you don't find it there, look into / modules / possequence The file ends with .tpl. Report back, when you have found the file in question. Link to comment Share on other sites More sharing options...
canvastig Posted August 9, 2017 Author Share Posted August 9, 2017 Hi Scully,Thank you for the fast reply!Unfortunately my support ran out since august 2 and I just noticed the error.Therefore Im not sure If i can get any support from them.I have found the .tpl file if I open it I get the following message: div id="sequence-theme"> <div id="sequence"> {if $slideOptions.show_arrow} <ul class="controls"> <a class="sequence-prev">{l s='Prev' mod='possequence'}</a> <a class="sequence-next">{l s='Next' mod='possequence'}</a> </ul> {/if} <ul class="sequence-canvas"> {foreach from=$slides key=key item=slide} {if $slide.kind_effect==1} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title1} <h2 class ="title">{$slide.title1}</h2> {/if} {if $slide.title2} <h3 class ="subtitle">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model" src="{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model" src="{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link subtitle"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==2} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title-slider2">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle-slider2">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model-slider2" src="{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model-slider2" src="{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link-slider2 subtitle-slider2"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==3} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title-slider3">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle-slider3">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model-slider3" src="{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model-slider3" src="{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link-slider3 subtitle-slider3"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==4} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title slider2">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle slider2">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model slider2" src="{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model" src="{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link subtitle slider2"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {/if} {/foreach} </ul> {if $slideOptions.show_navigation} <ul class="sequence-pagination"> {foreach from=$slides key=key item=slide} {$count= $count+1} <li><a href="javascript:void(0)">{$count} </a></li> {/foreach} </ul> {/if} </div> </div> <script type ="text/javascript"> //<![CDATA[ $(document).ready(function(){ var options = { autoPlay: {if $slideOptions.auto_slide != 0}true{else}false{/if}, // auto change slides autoPlayDelay: {if $slideOptions.pause_time != ''}{$slideOptions.pause_time}{else}3000{/if}, pauseOnHover: {if $slideOptions.hover != 0}{$slideOptions.hover}{else}false{/if}, hidePreloaderDelay: 500, nextButton: true, prevButton: true, pauseButton: true, preloader: true, pagination:true, hidePreloaderUsingCSS: false, animateStartingFrameIn: true, navigationSkipThreshold: 750, preventDelayWhenReversingAnimations: true, customKeyEvents: { 80: "pause" } }; var sequence = $("#sequence").sequence(options).data("sequence"); }); //]]> </script>I hope you can help me out.I am looking forward to your reply. Link to comment Share on other sites More sharing options...
Scully Posted August 9, 2017 Share Posted August 9, 2017 $slide.image contains the image URL - so my guess. You coud try to append this this: {Tools::getShopProtocol()} for every img src - so instead of <img class="model" src="{$slide.image}" alt="Image" /> you use <img class="model" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> But: if $slide.image already contains the (wrong) protocol this wouln't work. In that case you had to change the .php file from this module in order to get the correct protocol set. Link to comment Share on other sites More sharing options...
canvastig Posted August 10, 2017 Author Share Posted August 10, 2017 (edited) Hi Scully, Thanks again for your help.I tried editing the .tpl file into the following: <div id="sequence-theme"> <div id="sequence"> {if $slideOptions.show_arrow} <ul class="controls"> <a class="sequence-prev">{l s='Prev' mod='possequence'}</a> <a class="sequence-next">{l s='Next' mod='possequence'}</a> </ul> {/if} <ul class="sequence-canvas"> {foreach from=$slides key=key item=slide} {if $slide.kind_effect==1} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title1} <h2 class ="title">{$slide.title1}</h2> {/if} {if $slide.title2} <h3 class ="subtitle">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link subtitle"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==2} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title-slider2">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle-slider2">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model-slider2" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model-slider2" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link-slider2 subtitle-slider2"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==3} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title-slider3">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle-slider3">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model-slider3" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model-slider3" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link-slider3 subtitle-slider3"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==4} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title slider2">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle slider2">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model slider2" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link subtitle slider2"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {/if} {/foreach} </ul> {if $slideOptions.show_navigation} <ul class="sequence-pagination"> {foreach from=$slides key=key item=slide} {$count= $count+1} <li><a href="javascript:void(0)">{$count} </a></li> {/foreach} </ul> {/if} </div> </div> <script type ="text/javascript"> //<![CDATA[ $(document).ready(function(){ var options = { autoPlay: {if $slideOptions.auto_slide != 0}true{else}false{/if}, // auto change slides autoPlayDelay: {if $slideOptions.pause_time != ''}{$slideOptions.pause_time}{else}3000{/if}, pauseOnHover: {if $slideOptions.hover != 0}{$slideOptions.hover}{else}false{/if}, hidePreloaderDelay: 500, nextButton: true, prevButton: true, pauseButton: true, preloader: true, pagination:true, hidePreloaderUsingCSS: false, animateStartingFrameIn: true, navigationSkipThreshold: 750, preventDelayWhenReversingAnimations: true, customKeyEvents: { 80: "pause" } }; var sequence = $("#sequence").sequence(options).data("sequence"); }); //]]> </script> This did not solve the problem, also I have found the .php file it has the following information: <?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_ . 'possequence/models/Sequence.php'); class Possequence extends Module { private $_html = ''; private $_postErrors = array(); public function __construct() { $this->name = 'possequence'; $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 Banner Sequence'); $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_MODULE_DIR_.'possequence/images'; 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(); // Need a foreach for the language foreach (Language::getLanguages() as $language) $tab->name[$language['id_lang']] = $this->l('Manage Banner Sequence'); $tab->class_name = 'AdminPossequence'; $tab->id_parent = (int)Tab::getIdFromClassName('AdminPosMenu'); $tab->module = $this->name; $tab->add(); if( !Configuration::updateValue($this->name.'_pause_time', 3000) OR !Configuration::updateValue($this->name.'_animation_speed', 3000)OR !Configuration::updateValue($this->name.'_show_arrow', 1) OR !Configuration::updateValue($this->name.'_show_navigation', 0) OR !Configuration::updateValue($this->name.'_auto_slide', 1) OR !Configuration::updateValue($this->name.'_hover', 0) ) {return false;} // Set some defaults return parent::install() && $this->registerHook('actionObjectSlideshowAddAfter') && $this->registerHook('top')&& $this->registerHook('bannerSequence')&& $this->registerHook('displayHeader'); } public function uninstall() { Configuration::deleteByName('POSSEQUENCE'); // Uninstall Tabs //$tab = new Tab((int)Tab::getIdFromClassName('AdminPosMenu')); //$tab->delete(); $tab = new Tab((int)Tab::getIdFromClassName('AdminPossequence')); $tab->delete(); Configuration::deleteByName($this->name.'_pause_time'); Configuration::deleteByName($this->name.'_animation_speed'); Configuration::deleteByName($this->name.'_show_arrow'); Configuration::deleteByName($this->name.'_show_navigation'); Configuration::deleteByName($this->name.'_auto_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.'_pause_time', Tools::getValue('pause_time')); Configuration::updateValue($this->name.'_animation_speed', Tools::getValue('animation_speed')); Configuration::updateValue($this->name.'_show_arrow', Tools::getValue('show_arrow')); Configuration::updateValue($this->name.'_show_navigation', Tools::getValue('show_navigation')); Configuration::updateValue($this->name.'_auto_slide', Tools::getValue('auto_slide')); Configuration::updateValue($this->name.'_hover', Tools::getValue('hover')); $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 getSlideshow() { $id_shop = (int)Context::getContext()->shop->id; $id_lang = (int)$this->context->language->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_sequence` ps LEFT JOIN `' . _DB_PREFIX_ . 'pos_sequence_lang` psl ON ps.id_pos_sequence = psl.id_pos_sequence LEFT JOIN `' . _DB_PREFIX_ . 'pos_sequence_shop` s ON ps.id_pos_sequence = s.id_pos_sequence WHERE s.`id_shop` ='.$id_shop.' AND psl.`id_lang` ='.$id_lang.' AND ps.`active` =1 ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='bgimage' ){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/bgimage_'.$slideArray['id_pos_sequence'].'.jpg'; } if($k=='image' ){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/image_'.$slideArray['id_pos_sequence'].'.jpg'; } if($k=='image2' ){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/image2_'.$slideArray['id_pos_sequence'].'.jpg'; } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } 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('Auto Slide: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'auto_slide', (Tools::getValue('auto_slide') ? Tools::getValue('auto_slide') : Configuration::get($this->name . '_auto_slide'))); $this->_html .=' </div> <label>'.$this->l('Delay 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('Pause on hover: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'hover', (Tools::getValue('hover') ? Tools::getValue('hover') : Configuration::get($this->name . '_hover'))); $this->_html .=' </div> <label>'.$this->l('Show Next/Back: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(false=>'No',true=>'Yes'),'show_arrow', (Tools::getValue('show_arrow') ? 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(false=>'No', true =>'Yes'),'show_navigation', (Tools::getValue('show_navigation') ? 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.'views/css/style.css'); $this->context->controller->addCSS($this->_path.'views/css/bannersequence.css'); $this->context->controller->addJS($this->_path.'views/js/jquery.sequence.js'); } function hookBannerSequence($params) { $options = array( 'pause_time' => Configuration::get($this->name.'_pause_time'), 'animation_speed' => Configuration::get($this->name.'_animation_speed'), 'show_arrow' => Configuration::get($this->name.'_show_arrow'), 'show_navigation' => Configuration::get($this->name.'_show_navigation'), 'auto_slide' => Configuration::get($this->name.'_auto_slide'), 'hover' => Configuration::get($this->name.'_hover'), ); $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( 'bannerSequence', ); 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; } } Hope you can help me out with this.Best Regards,Canvastig Edited August 10, 2017 by canvastig (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 10, 2017 Share Posted August 10, 2017 Try to format source code with <> button as code. Otherwise the code is almost unreadable. Link to comment Share on other sites More sharing options...
canvastig Posted August 10, 2017 Author Share Posted August 10, 2017 My apologies, as you should have noticed Im still a newbie The .tpl file : <div id="sequence-theme"> <div id="sequence"> {if $slideOptions.show_arrow} <ul class="controls"> <a class="sequence-prev">{l s='Prev' mod='possequence'}</a> <a class="sequence-next">{l s='Next' mod='possequence'}</a> </ul> {/if} <ul class="sequence-canvas"> {foreach from=$slides key=key item=slide} {if $slide.kind_effect==1} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title1} <h2 class ="title">{$slide.title1}</h2> {/if} {if $slide.title2} <h3 class ="subtitle">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link subtitle"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==2} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title-slider2">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle-slider2">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model-slider2" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model-slider2" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link-slider2 subtitle-slider2"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==3} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title-slider3">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle-slider3">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model-slider3" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model-slider3" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link-slider3 subtitle-slider3"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {elseif $slide.kind_effect==4} <li class="{$slide.animate}" id ="kind_effect{$slide.kind_effect}"> {if $slide.title} <h2 class ="title slider2">{$slide.title}</h2> {/if} {if $slide.title2} <h3 class ="subtitle slider2">{$slide.title2}</h3> {/if} {if $slide.description} <div class="intro subtitle"> {nl2br($slide.description)} </div> {/if} {if $slide.bgimage} <img class="slider-bg" src="{Tools::getShopProtocol()}{$slide.bgimage}" alt="Background Image" /> {/if} {if $slide.image} <img class="model slider2" src="{Tools::getShopProtocol()}{$slide.image}" alt="Image" /> {/if} {if $slide.image2} <img class="model" src="{Tools::getShopProtocol()}{$slide.image2}" alt="Image" /> {/if} {if $slide.link} <div class ="link subtitle slider2"> <a href ="{$slide.link}">{l s='Shop now' mod='possequence'}</a> </div> {/if} </li> {/if} {/foreach} </ul> {if $slideOptions.show_navigation} <ul class="sequence-pagination"> {foreach from=$slides key=key item=slide} {$count= $count+1} <li><a href="javascript:void(0)">{$count} </a></li> {/foreach} </ul> {/if} </div> </div> <script type ="text/javascript"> //<![CDATA[ $(document).ready(function(){ var options = { autoPlay: {if $slideOptions.auto_slide != 0}true{else}false{/if}, // auto change slides autoPlayDelay: {if $slideOptions.pause_time != ''}{$slideOptions.pause_time}{else}3000{/if}, pauseOnHover: {if $slideOptions.hover != 0}{$slideOptions.hover}{else}false{/if}, hidePreloaderDelay: 500, nextButton: true, prevButton: true, pauseButton: true, preloader: true, pagination:true, hidePreloaderUsingCSS: false, animateStartingFrameIn: true, navigationSkipThreshold: 750, preventDelayWhenReversingAnimations: true, customKeyEvents: { 80: "pause" } }; var sequence = $("#sequence").sequence(options).data("sequence"); }); //]]> </script> Followed by the .php file : <?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_ . 'possequence/models/Sequence.php'); class Possequence extends Module { private $_html = ''; private $_postErrors = array(); public function __construct() { $this->name = 'possequence'; $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 Banner Sequence'); $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_MODULE_DIR_.'possequence/images'; 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(); // Need a foreach for the language foreach (Language::getLanguages() as $language) $tab->name[$language['id_lang']] = $this->l('Manage Banner Sequence'); $tab->class_name = 'AdminPossequence'; $tab->id_parent = (int)Tab::getIdFromClassName('AdminPosMenu'); $tab->module = $this->name; $tab->add(); if( !Configuration::updateValue($this->name.'_pause_time', 3000) OR !Configuration::updateValue($this->name.'_animation_speed', 3000)OR !Configuration::updateValue($this->name.'_show_arrow', 1) OR !Configuration::updateValue($this->name.'_show_navigation', 0) OR !Configuration::updateValue($this->name.'_auto_slide', 1) OR !Configuration::updateValue($this->name.'_hover', 0) ) {return false;} // Set some defaults return parent::install() && $this->registerHook('actionObjectSlideshowAddAfter') && $this->registerHook('top')&& $this->registerHook('bannerSequence')&& $this->registerHook('displayHeader'); } public function uninstall() { Configuration::deleteByName('POSSEQUENCE'); // Uninstall Tabs //$tab = new Tab((int)Tab::getIdFromClassName('AdminPosMenu')); //$tab->delete(); $tab = new Tab((int)Tab::getIdFromClassName('AdminPossequence')); $tab->delete(); Configuration::deleteByName($this->name.'_pause_time'); Configuration::deleteByName($this->name.'_animation_speed'); Configuration::deleteByName($this->name.'_show_arrow'); Configuration::deleteByName($this->name.'_show_navigation'); Configuration::deleteByName($this->name.'_auto_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.'_pause_time', Tools::getValue('pause_time')); Configuration::updateValue($this->name.'_animation_speed', Tools::getValue('animation_speed')); Configuration::updateValue($this->name.'_show_arrow', Tools::getValue('show_arrow')); Configuration::updateValue($this->name.'_show_navigation', Tools::getValue('show_navigation')); Configuration::updateValue($this->name.'_auto_slide', Tools::getValue('auto_slide')); Configuration::updateValue($this->name.'_hover', Tools::getValue('hover')); $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 getSlideshow() { $id_shop = (int)Context::getContext()->shop->id; $id_lang = (int)$this->context->language->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_sequence` ps LEFT JOIN `' . _DB_PREFIX_ . 'pos_sequence_lang` psl ON ps.id_pos_sequence = psl.id_pos_sequence LEFT JOIN `' . _DB_PREFIX_ . 'pos_sequence_shop` s ON ps.id_pos_sequence = s.id_pos_sequence WHERE s.`id_shop` ='.$id_shop.' AND psl.`id_lang` ='.$id_lang.' AND ps.`active` =1 ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='bgimage' ){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/bgimage_'.$slideArray['id_pos_sequence'].'.jpg'; } if($k=='image' ){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/image_'.$slideArray['id_pos_sequence'].'.jpg'; } if($k=='image2' ){ $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/image2_'.$slideArray['id_pos_sequence'].'.jpg'; } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; } } 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('Auto Slide: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'auto_slide', (Tools::getValue('auto_slide') ? Tools::getValue('auto_slide') : Configuration::get($this->name . '_auto_slide'))); $this->_html .=' </div> <label>'.$this->l('Delay 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('Pause on hover: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(0=>'No',1=>'Yes'),'hover', (Tools::getValue('hover') ? Tools::getValue('hover') : Configuration::get($this->name . '_hover'))); $this->_html .=' </div> <label>'.$this->l('Show Next/Back: ').'</label> <div class="margin-form">'; $this->_html .= $this->getSelectOptionsHtml(array(false=>'No',true=>'Yes'),'show_arrow', (Tools::getValue('show_arrow') ? 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(false=>'No', true =>'Yes'),'show_navigation', (Tools::getValue('show_navigation') ? 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.'views/css/style.css'); $this->context->controller->addCSS($this->_path.'views/css/bannersequence.css'); $this->context->controller->addJS($this->_path.'views/js/jquery.sequence.js'); } function hookBannerSequence($params) { $options = array( 'pause_time' => Configuration::get($this->name.'_pause_time'), 'animation_speed' => Configuration::get($this->name.'_animation_speed'), 'show_arrow' => Configuration::get($this->name.'_show_arrow'), 'show_navigation' => Configuration::get($this->name.'_show_navigation'), 'auto_slide' => Configuration::get($this->name.'_auto_slide'), 'hover' => Configuration::get($this->name.'_hover'), ); $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( 'bannerSequence', ); 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...
Scully Posted August 10, 2017 Share Posted August 10, 2017 (edited) Revert back your changes. And this is the bad in your slider script: $v = _PS_BASE_URL_.__PS_BASE_URI__.'modules/possequence/images/bgimage_'.$slideArray['id_pos_sequence'].'.jpg'; Above code does not check for the correct protocol. Similar code occures at least on 3 lines - probably also more. The correct way would be similar to this (untested !) $v = ($this->ssl_enable ? _PS_BASE_URL_SSL_ : _PS_BASE_URL_) .__PS_BASE_URI__.'modules/possequence/images/bgimage_'.$slideArray['id_pos_sequence'].'.jpg'; It checks for SSL enabled and then prepends toe SSL or Non-SSL value from the respective constant. Edited August 10, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
canvastig Posted August 10, 2017 Author Share Posted August 10, 2017 (edited) Hi Scully,I tried to edit the lines in the following: function getSlideshow() { $id_shop = (int)Context::getContext()->shop->id; $id_lang = (int)$this->context->language->id; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'pos_sequence` ps LEFT JOIN `' . _DB_PREFIX_ . 'pos_sequence_lang` psl ON ps.id_pos_sequence = psl.id_pos_sequence LEFT JOIN `' . _DB_PREFIX_ . 'pos_sequence_shop` s ON ps.id_pos_sequence = s.id_pos_sequence WHERE s.`id_shop` ='.$id_shop.' AND psl.`id_lang` ='.$id_lang.' AND ps.`active` =1 ORDER BY `porder` ASC'; $slides = Db::getInstance()->ExecuteS($sql); if(is_array($slides)){ $limit = 0; $arraySlides = array(); foreach($slides as $key => $slideArray) { //echo "<pre>"; print_r($slideArray); $newSlide = array(); foreach($slideArray as $k => $v) { if($k=='bgimage' ){ $v = ($this->ssl_enable ? _PS_BASE_URL_SSL_ : _PS_BASE_URL_) .__PS_BASE_URI__.'modules/possequence/images/bgimage_'.$slideArray['id_pos_sequence'].'.jpg'; } if($k=='image' ){ $v = ($this->ssl_enable ? _PS_BASE_URL_SSL_ : _PS_BASE_URL_).__PS_BASE_URI__.'modules/possequence/images/image_'.$slideArray['id_pos_sequence'].'.jpg'; } if($k=='image2' ){ $v = ($this->ssl_enable ? _PS_BASE_URL_SSL_ :_PS_BASE_URL_) .__PS_BASE_URI__.'modules/possequence/images/image2_'.$slideArray['id_pos_sequence'].'.jpg'; } $newSlide[$k] = $v; } $arraySlides[$key] = $newSlide; Did I do something wrong with the script perhaps? Edited August 10, 2017 by canvastig (see edit history) Link to comment Share on other sites More sharing options...
Scully Posted August 10, 2017 Share Posted August 10, 2017 You have to check the servers error log to find out the cause. I just wrote freehand code without any testing. Link to comment Share on other sites More sharing options...
canvastig Posted August 10, 2017 Author Share Posted August 10, 2017 I still get the same errors: Mixed Content: The page at 'https://www.canvastig.nl/nl/' was loaded over HTTPS, but requested an insecure image 'http://www.canvastig.nl/modules/possequence/images/bgimage_7.jpg'. This content should also be served over HTTPS. Link to comment Share on other sites More sharing options...
Scully Posted August 10, 2017 Share Posted August 10, 2017 (edited) I know that. We haven't fixed the issue and since my change resulted in some kind of white page, my suggestion was to look at the servers error logfile to figure out the mistake in coding which caused the white page. It wasn't my meaning that the unsercure mixed content was resolved at this time. But even if you support run out - it might be worth to ask the developer for fixing that bug. The original code clearly shows that it isn't capable to handle the SSL protocol. This way might be easier to go than trying to troubleshoot changes which I cannot run on our hosts since I don't have the module installed. Edited August 10, 2017 by Scully (see edit history) Link to comment Share on other sites More sharing options...
canvastig Posted August 10, 2017 Author Share Posted August 10, 2017 Hi Scully, thanks for your help.The white page does not shows up anymore i guess I did something wrong.Also, I tried to message the developer to help me out and am still waiting for the response.In the meanwhile if someone has another idea, feel free to post. Link to comment Share on other sites More sharing options...
canvastig Posted August 12, 2017 Author Share Posted August 12, 2017 I contacted the developer he fixed the issue.Thanks for everything! Link to comment Share on other sites More sharing options...
Yar Posted September 28, 2018 Share Posted September 28, 2018 Hi "PrestaShop Fanatic" message helped was very simple you need to change _PS_BASE_URL_ to _PS_BASE_URL_SSL_ should look like this: 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