Jump to content

Blocklayered module stops working after Quickview Opened in Fancybox


Recommended Posts

Hello everyone. I decided to modify the Quick View plugin to fit my needs by adding a few lines of code to the global.js file. The code I edited is:

 

function quick_view()
{
	$(document).on('click', '.quick-view:visible, .quick-view-mobile:visible', function(e){
		e.preventDefault();
		var url = this.rel;
		var anchor = '';
		

		if (url.indexOf('#') != -1)
		{
			anchor = url.substring(url.indexOf('#'), url.length);
			url = url.substring(0, url.indexOf('#'));
		}

		if (url.indexOf('?') != -1)
			url += '&';
		else
			url += '?';

		if (!!$.prototype.fancybox)
		var myfancybox	= $.fancybox({

				'padding':  0,
				'width':    800,
				'height':   610,
				'autoSize': false,
				'type':     'ajax',


				'href':     url + 'content_only=1' + anchor,

					beforeShow: function(){
					$('#short_description_content').remove();
					//$("#availability_statut").appendTo("#product_reference");
					$("#availability_statut").remove();
					$("#views_block").hide();
					$("#views_block").hide();
					$(".resetimg").hide();
					$(".attribute_label").hide();
					$(".unit-price").remove();
					$("#feedback_quick_order").remove();
					$("#product_reference").insertAfter("h1");
					$(".content_prices").insertAfter(".product_attributes");
					$("#quantity_wanted_p").insertAfter("#attributes");

					$('<p id="add_to_cart1" class="buttons_bottom_block popup_second no-print" style="padding: 13px 0px 20px;"> <button type="submit" name="Submit" class="exclusive noicon" style="float: right;"> <span>Оформить заказ</span> </button></p>').insertAfter(".box-cart-bottom div");
					$('<p id="add_to_cart" class="buttons_bottom_block popup_first no-print" style="padding: 13px 0px 20px;"> <button type="submit" name="Submit" class="exclusive noicon" style="float: right;"> <span>Продолжить покупку</span> </button><a title="Закрыть" class="popup_close" href="javascript:;"></a></p>').insertAfter(".box-cart-bottom div");
					

					$(".pb-center-column").appendTo(".pb-right-column");
					$(".pb-center-column").removeClass("col-xs-12 col-sm-4");
					$(".pb-right-column").removeClass("col-sm-4 col-md-3").addClass("col-sm-7");
					$(".primary_block.row").css({margin: "0 auto"});
					$("#quantity_wanted_p").css({float: "right", marginTop: "6px", width: "177px"});
					$(".product_attributes").css({height: "199px", boxShadow: "none", padding: "0px 19px 17px"});
					$(".content_prices").css({float: "left", padding: "0px 19px"});
					$("#our_price_display").css({fontSize: "27px"});
					$(".exclusive").css({float: "right"});
					$(".box-info-product").css({boxShadow: "none"});
					$(".box-cart-bottom").css({boxShadow: "none"});
					$(".buttons_bottom_block").css({padding: "13px 0px 20px"});
					$(".box-cart-bottom").css({maxWidth: "380px"});
					$(".pb-left-column").css({padding: "0px"});
					$(".pb-center-column").css({clear: "both", maxWidth: "380px", marginTop: "42px", paddingLeft: "18px"});
			
					
				}
				 
				 
			});
	});
}

Instead of (type: Iframe) I used (type: ajax) and added BeforeShow callback. The fancybox Quick view opens fine, but after closing it I can't go to the next page using the blocklayered module. As soon as you try to change the page, it throws an error $(...).slider is not a function. When you reload the page, you can change the page just fine using the same plugin blocklayered, but if you click Quick View once, then that's it, you are stack with the loading page circle on top with that error in the JavaScript console. If I use (type: Iframe) I don't get that error, but I can't modify the content using BeforeShow callback. I also tried to remove the BeforeShow, but still no luck. I guess that fancybox removes some Js from cache for the blocklayered module on load. Is there any work around or a fix for this? The Prestashop version is 1.6.1.9. Any help will be appreciated. 

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...