From: Anthony Talarico Date: Mon, 28 Dec 2015 19:10:57 +0000 (-0500) Subject: adjusted conditional to show filtered products X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=b636c8d17d89b7697ef2e3ce095bff41c2d1e353;p=WP-Themes%2Fmichsci.git adjusted conditional to show filtered products --- diff --git a/js/app.js b/js/app.js index 0ecd75f..0c0b44d 100644 --- a/js/app.js +++ b/js/app.js @@ -23,7 +23,7 @@ $(document).ready(function () { "use strict"; document.cookie = "catView=grid"; // don't display products on the main "products page" - if ((window.location.href.indexOf("products-2") >= 0)){ + if ((window.location.href.indexOf("products") >= 0)){ $("#gridView").css("display", "none"); $("#listView").css("display", "none"); $("#grid").on("click", function (e) { @@ -36,7 +36,7 @@ $(document).ready(function () { }); } // hide product display initially - if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){ + if ((window.location.href.indexOf("products/?michsci_category") >= 0)){ $("#productsView").css("display", "inherit"); $("#categoriesView").css("display", "none"); $("#gridView").css("display", "inherit"); @@ -46,7 +46,7 @@ $(document).ready(function () { } // navigate back to products page if on single product page - if ((window.location.href.indexOf("products-2/?pagename") >= 0)) { + if ((window.location.href.indexOf("products/?pagename") >= 0)) { // $("#viewBtns").css("display", "none"); $("#grid").on("click", function (e) { document.cookie = "view=grid"; @@ -58,7 +58,7 @@ $(document).ready(function () { }); } // change output view from list to grid - if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) { + if (!(window.location.href.indexOf("products/?pagename") >= 0)) { $("#grid").on("click", function (e) { document.cookie = "view=grid"; location.reload(); @@ -82,17 +82,18 @@ $(document).ready(function () { $("#gridView").css("display", "inherit"); $("#listView").css("display", "inherit"); $("#categoriesGridView").hide(); - $("3categoriesListView").hide() + $("#categoriesListView").hide() $("#tagBox :checkbox:checked").each(function() { $("." + $(this).val()).show(); }); // hide products on front page, show all products if on products page - if($("#tagBox :checkbox:checked").length === 0){ - $(".product").show(); + if($("#tagBox :checkbox:checked").length === 0 && !(window.location.href.indexOf("products/?michsci_category") >= 0)){ $("#categoriesGridView").show(); $("#categoriesListView").show(); $("#gridView").css("display", "none"); $("#listView").css("display", "none"); + } else if ($("#tagBox :checkbox:checked").length === 0){ + $(".product").show(); } }); }); diff --git a/js/custom/upcp.js b/js/custom/upcp.js index ea3291d..d40484b 100644 --- a/js/custom/upcp.js +++ b/js/custom/upcp.js @@ -3,7 +3,7 @@ $(document).ready(function () { "use strict"; document.cookie = "catView=grid"; // don't display products on the main "products page" - if ((window.location.href.indexOf("products-2") >= 0)){ + if ((window.location.href.indexOf("products") >= 0)){ $("#gridView").css("display", "none"); $("#listView").css("display", "none"); $("#grid").on("click", function (e) { @@ -16,7 +16,7 @@ $(document).ready(function () { }); } // hide product display initially - if ((window.location.href.indexOf("products-2/?michsci_category") >= 0)){ + if ((window.location.href.indexOf("products/?michsci_category") >= 0)){ $("#productsView").css("display", "inherit"); $("#categoriesView").css("display", "none"); $("#gridView").css("display", "inherit"); @@ -26,7 +26,7 @@ $(document).ready(function () { } // navigate back to products page if on single product page - if ((window.location.href.indexOf("products-2/?pagename") >= 0)) { + if ((window.location.href.indexOf("products/?pagename") >= 0)) { // $("#viewBtns").css("display", "none"); $("#grid").on("click", function (e) { document.cookie = "view=grid"; @@ -38,7 +38,7 @@ $(document).ready(function () { }); } // change output view from list to grid - if (!(window.location.href.indexOf("products-2/?pagename") >= 0)) { + if (!(window.location.href.indexOf("products/?pagename") >= 0)) { $("#grid").on("click", function (e) { document.cookie = "view=grid"; location.reload(); @@ -62,17 +62,18 @@ $(document).ready(function () { $("#gridView").css("display", "inherit"); $("#listView").css("display", "inherit"); $("#categoriesGridView").hide(); - $("3categoriesListView").hide() + $("#categoriesListView").hide() $("#tagBox :checkbox:checked").each(function() { $("." + $(this).val()).show(); }); // hide products on front page, show all products if on products page - if($("#tagBox :checkbox:checked").length === 0){ - $(".product").show(); + if($("#tagBox :checkbox:checked").length === 0 && !(window.location.href.indexOf("products/?michsci_category") >= 0)){ $("#categoriesGridView").show(); $("#categoriesListView").show(); $("#gridView").css("display", "none"); $("#listView").css("display", "none"); + } else if ($("#tagBox :checkbox:checked").length === 0){ + $(".product").show(); } }); });