Added on option to only show in-stock products on the /products page (closes #1388)

This commit is contained in:
Bernd Bestel
2021-07-06 20:08:02 +02:00
parent 6530d0f9df
commit 1ead23cb87
5 changed files with 50 additions and 8 deletions

View File

@@ -38,7 +38,14 @@ $("#clear-filter-button").on("click", function()
$("#product-group-filter").val("all");
productsTable.column(6).search("").draw();
productsTable.search("").draw();
$("#show-disabled").prop('checked', false);
if ($("#show-disabled").is(":checked") || $("#show-only-in-stock").is(":checked"))
{
$("#show-disabled").prop("checked", false);
$("#show-only-in-stock").prop("checked", false);
RemoveUriParam("include_disabled");
RemoveUriParam("only_in_stock");
window.location.reload();
}
});
if (typeof GetUriParam("product-group") !== "undefined")
@@ -90,12 +97,28 @@ $("#show-disabled").change(function()
{
if (this.checked)
{
window.location.href = U('/products?include_disabled');
UpdateUriParam("include_disabled", "true");
}
else
{
window.location.href = U('/products');
RemoveUriParam("include_disabled");
}
window.location.reload();
});
$("#show-only-in-stock").change(function()
{
if (this.checked)
{
UpdateUriParam("only_in_stock", "true");
}
else
{
RemoveUriParam("only_in_stock");
}
window.location.reload();
});
if (GetUriParam('include_disabled'))