Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Advanced Search: Only list products on stock


Mfred

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
Link to comment
Share on other sites

  • 4 weeks later...
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

Link to comment
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

Link to comment
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 :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...