jaimeweb Posted October 17, 2013 Share Posted October 17, 2013 Hi,I need to open certain links with a Fancybox. I need it to be global so it works on all pages. I used to us this for previous versions of PS but it doesn't seem to work on latest 1.5.5.http://www.prestashop.com/forums/topic/216313-resolu-lancer-certaines-pages-cms-via-fancybox/?p=1068961&do=findComment&comment=1068961 Any ideas? Thanks Link to comment Share on other sites More sharing options...
jaimeweb Posted October 18, 2013 Author Share Posted October 18, 2013 Bump Link to comment Share on other sites More sharing options...
vekia Posted October 18, 2013 Share Posted October 18, 2013 but what kind of links you want to open in fancybox, everything depends on it Link to comment Share on other sites More sharing options...
jaimeweb Posted October 19, 2013 Author Share Posted October 19, 2013 Hi Vekia, On the previous way it accepted any link with a "class=iframe" in the href on any page within PS. Ideally I need that again... Thanks Link to comment Share on other sites More sharing options...
vekia Posted October 19, 2013 Share Posted October 19, 2013 add somewhere in header.tpl file (in <head></head> section) <script> {literal} $(document).ready(function() { $(".iframe").fancybox({ autoSize: false, autoDimensions: false, width: 630, height: 425, fitToView: false, padding: 0, title: this.title, href: $(this).attr('href'), type: 'iframe' }); }); {/literal} </script> and in addition to this, make sure that fancybox libraries are attached to <header> section. If they aren't - you will need to modify front controller (classes/frontcontroller.php) and its setmedia() function Link to comment Share on other sites More sharing options...
jaimeweb Posted October 19, 2013 Author Share Posted October 19, 2013 Hi Vekia, Thanks for your quick response on this but can you talk me through the second step in a bit more detail...not quite sure what to do. Sorry. Thanks again! Link to comment Share on other sites More sharing options...
vekia Posted October 19, 2013 Share Posted October 19, 2013 have you tried to add code that i mentioned to header.tpl file? Link to comment Share on other sites More sharing options...
jaimeweb Posted October 20, 2013 Author Share Posted October 20, 2013 Yes Link to comment Share on other sites More sharing options...
vekia Posted October 20, 2013 Share Posted October 20, 2013 ok so you probably need to add fancybox libraries to controllers (im not sure because i havent got access to your front office and i cant inspect code) you can try with: open: classes/Controllers/FrontController.php there is function setMedia(); add there: $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addJqueryPlugin('fancybox'); (add this code right after first bracket { ) it should look like: public function setMedia() { $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addJqueryPlugin('fancybox'); Link to comment Share on other sites More sharing options...
skinnybloke Posted December 11, 2013 Share Posted December 11, 2013 Hi - I wanted to do the same thing. I applied the code above and got an error telling me that jQuery was not loaded so I changed your code to the following which worked. public function setMedia() { $this->addjquery(); $this->addCSS(_PS_CSS_DIR_.'jquery.fancybox-1.3.4.css', 'screen'); $this->addJqueryPlugin('fancybox'); If possible could you please confirm that adding this extra line of code will not cause issues elsewhere due to duplication Link to comment Share on other sites More sharing options...
vekia Posted December 11, 2013 Share Posted December 11, 2013 the wierdest thing is fact, that jquery library is added there by default anyway, no worries, everything will works well Link to comment Share on other sites More sharing options...
Recommended Posts