Open Product Detail Pages in a Modal Window

If you want to open your detail pages in a modal window from the category page, you’ll want to remove the get_header() and get_footer() calls from the foxyshop-single-product.php template file and add this to the jQuery script section of foxyshop-single-category.php. Only tested in 0.7.2.

$(".foxyshop_product_list .foxyshop_product_box a").each(function() {
    $(this).attr("href", $(this).attr("href") + "?modal=true")
});
$(".foxyshop_product_list .foxyshop_product_box a").colorbox();
$("form.foxyshop_product").submit(function() {
	$.colorbox.close();
});

You may also want to consider adding writing a conditional into the foxyshop-single-product.php template to check for the isset($_GET['modal']) querystring variable so that direct links to the product pages will still show a nicely formatted page.

Posted in: Helpful Code Snippets