Jump to content

Open a link on product page in a fancybox


Recommended Posts

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


in ProductController I have this code this setMedia funcion:

	public function setMedia()
		if (count($this->errors))
			return ;

		if (!$this->useMobileTheme())
			$this->addCSS(_THEME_CSS_DIR_.'print.css', 'print');
			$this->addJqueryPlugin(array('fancybox', 'idTabs', 'scrollTo', 'serialScroll', 'bxslider'));
				_THEME_JS_DIR_.'tools.js',  // retro compat themes 1.5
			$this->addJqueryPlugin(array('scrollTo', 'serialScroll'));
				_THEME_JS_DIR_.'tools.js',  // retro compat themes 1.5

		if (Configuration::get('PS_DISPLAY_JQZOOM') == 1)

This code "$this->addJqueryPlugin(array('fancybox'" shouldn't let iframe works on product pages?

Link to comment
Share on other sites

<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

$(document).ready(function() {
		maxWidth	: 800,
		maxHeight	: 600,
		fitToView	: false,
		width		: '70%',
		height		: '70%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none'
Edited by sandipchandela (see edit history)
Link to comment
Share on other sites

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 

		'type' : 'iframe',
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...