DARKF3D3 Posted January 19, 2015 Share Posted January 19, 2015 I added a link to the products page of my website: <a class="iframe" href="http:www.website.com/shipping/?content_only=1">Shipping cost</a> The problem it's that it doesn't open it in a fancybox. I lookedat the "ProductController.php" but I don't find what to modify to let this link opens in a fancybox instead of in a new page. Someone know how can I do that? Link to comment Share on other sites More sharing options...
sandipchandela Posted January 20, 2015 Share Posted January 20, 2015 have you included javascript in productController.php ?? see method in file public function setMedia() Link to comment Share on other sites More sharing options...
DARKF3D3 Posted January 25, 2015 Author Share Posted January 25, 2015 Hi, in ProductController I have this code this setMedia funcion: public function setMedia() { parent::setMedia(); if (count($this->errors)) return ; if (!$this->useMobileTheme()) { $this->addCSS(_THEME_CSS_DIR_.'product.css'); $this->addCSS(_THEME_CSS_DIR_.'print.css', 'print'); $this->addJqueryPlugin(array('fancybox', 'idTabs', 'scrollTo', 'serialScroll', 'bxslider')); $this->addJS(array( _THEME_JS_DIR_.'tools.js', // retro compat themes 1.5 _THEME_JS_DIR_.'product.js' )); } else { $this->addJqueryPlugin(array('scrollTo', 'serialScroll')); $this->addJS(array( _THEME_JS_DIR_.'tools.js', // retro compat themes 1.5 _THEME_MOBILE_JS_DIR_.'product.js', _THEME_MOBILE_JS_DIR_.'jquery.touch-gallery.js' )); } if (Configuration::get('PS_DISPLAY_JQZOOM') == 1) $this->addJqueryPlugin('jqzoom'); } This code "$this->addJqueryPlugin(array('fancybox'" shouldn't let iframe works on product pages? Link to comment Share on other sites More sharing options...
bellini13 Posted January 25, 2015 Share Posted January 25, 2015 all you did was ensure that the fancybox plugin gets loaded into the browser. you still need to add javascript code that will apply fancybox to your anchor (<a>) Link to comment Share on other sites More sharing options...
DARKF3D3 Posted January 25, 2015 Author Share Posted January 25, 2015 Where? Into the product.js file? Which is one js file that has the code that i have to copy? Link to comment Share on other sites More sharing options...
vekia Posted January 25, 2015 Share Posted January 25, 2015 you will have to use something like <script type="text/javascript"> $('a.iframe').fancybox({ 'type' : 'iframe', 'width':600, 'height':600 }); </script> Link to comment Share on other sites More sharing options...
DARKF3D3 Posted January 25, 2015 Author Share Posted January 25, 2015 There's not a file where i can take the code used for other pages? Because I notice that on some other page i can open link in fancybox simply adding the class, but not on product pages. Link to comment Share on other sites More sharing options...
sandipchandela Posted January 26, 2015 Share Posted January 26, 2015 (edited) <a class="various" data-fancybox-type="iframe" href="http://www.website.com/shipping/?content_only=1">Iframe</a> in product.tpl or your selection file href tag value should be not http: it should be followed protocols rules. Correct href tag value should be : http://www.website.com {literal} <script> $(document).ready(function() { $(".various").fancybox({ maxWidth : 800, maxHeight : 600, fitToView : false, width : '70%', height : '70%', autoSize : false, closeClick : false, openEffect : 'none', closeEffect : 'none' }); }); </script> {/literal} Edited January 26, 2015 by sandipchandela (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 26, 2015 Share Posted January 26, 2015 There's not a file where i can take the code used for other pages? Because I notice that on some other page i can open link in fancybox simply adding the class, but not on product pages. this is why in product.js file you have to use $('a.iframe').fancybox({ 'type' : 'iframe', 'width':600, 'height':600 }); 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