Jump to content

Filter out of stock items using a checkbox


Recommended Posts

Hi everyone,

I am selling items that each have one quantity. Although I can disable the viewing of sold items using the the method laid out here:"Disable Item when out of stock",
I would like to enable the user to decide if they want to see sold items by use of a checkbox. (See picture 1)


I have created a simple module that hooks where I want it, and a simple form in the .tpl file as follows:

<!-- Block sold module -->


<form name="sold_check" id="SoldFilter" action="" method="post">


<input name="sold_query" type="checkbox" checked="checked">
{l s='Display Sold?' mod='sold'}


</form>


<!-- /Block sold module -->


My question is, how do I send the value of the checkbox to Classes/Search.php such that:

if checkbox is ticked {
$whereArray[] = ' p.id_product '.($word[0] == '-' ? 'NOT' : '').' IN (
....
....
}
else {
$whereArray[] = ' p.`quantity` > 0 AND p.id_product '.($word[0] == '-' ? 'NOT' : '').' IN (

}

Any ideas?
Maybe there is a method to value the value to global / cookie and retrieve it when the 'Search' button is pressed?

Thank you for you help

Mike

The website in question is:
Judaica-Online http://judaica-online.co.uk

41199_OoZuG8BBVEIxNmAEwPnQ_t

Link to comment
Share on other sites

Hi angora, thanks for your quick reply.

Your response sounds very nice and logical, unfortunately I am not sure how to implement your suggestion! :(

I am also new to checkboxes and am unaware about how to send the value from one form and receive its value in an other :(
I will look at the smarty website maybe it will give me a clue about how to use variables etc.

Do you have any other suggestions?

I also like your idea of ' display in-stock only [x] '!!! THANK YOU*** :D

Thank you, Mike.

Link to comment
Share on other sites

  • 10 months later...
×
×
  • Create New...