Jump to content
Sign in to follow this  
Mfred

Advanced Search: Only list products on stock

Recommended Posts

Hi,

 

I am searching for a contribution which is to my understanding really easy to implement.

 

In Advanced Search I wanna have a Checkbox with "Only list products on stock"

 

a) Is there a contrib already?

b) Who could write it? (Just a simple sql query - only I dont know how to implement it correctly in osc)

 

thx,

mfred

Edited by Mfred

Share this post


Link to post
Share on other sites

Unless I am mistaken. The default OSC install already has a checkbox for "Search In Stock Products Only" on the advanced_search.php page.

 

Unless you are meaning for some other type of search action.

Share this post


Link to post
Share on other sites
Unless I am mistaken. The default OSC install already has a checkbox for "Search In Stock Products Only" on the advanced_search.php page.

 

Unless you are meaning for some other type of search action.

 

you are mistaken.


Treasurer MFC

Share this post


Link to post
Share on other sites
Hi,

 

I am searching for a contribution which is to my understanding really easy to implement.

 

In Advanced Search I wanna have a Checkbox with "Only list products on stock"

 

a) Is there a contrib already?

B) Who could write it? (Just a simple sql query - only I dont know how to implement it correctly in osc)

 

thx,

mfred

 

in advanced_search.php

 

after this:

 

$info_box_contents[] = array('align' => 'right', 'text' => tep_draw_checkbox_field('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION);

 

add:

 

$info_box_contents[] = array('align' => 'right', 'text' => tep_draw_checkbox_field('iso', '1') . ' ' . 'In stock Only');

 

 

in advanced_search_results.php

 

after this:

 

if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {

$where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

 

you add:

 

if (isset($HTTP_GET_VARS['iso']) && ($HTTP_GET_VARS['iso'] == '1')) {

$where_str .= " and p.products_quantity > 0 ";

}

 

 

and make sure you add p.products_quantity to the select statement as currently it is only added if display of it is selected:

 

$select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";


Treasurer MFC

Share this post


Link to post
Share on other sites

thx that did it!

 

just for info for others:

 

I implemented it in advanced_search on the bottom of search options:

 

<tr>

<td class="fieldKey"><?php echo ENTRY_ON_STOCK; ?></td>

<td class="smallText"><?php echo tep_draw_checkbox_field('iso', '1'); ?></td>

</tr>

 

I think it fits there better :)

Share this post


Link to post
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
Sign in to follow this  

×