Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HOW TO FILTER CATEGORIES & PRICE RANGE AT THE SAME TIME?


itprovid

Recommended Posts

Posted

Please help!

 

How can I filter the product categories & price range through dropdowns at the same time? Please visit www.gemdreamz.com/index2.php and see Search by Type on the left side, for reference.

 

I have a category and price range dropdowns so that when you hit the submit button, it will display the result according to the category and price range you selected. My form is not functioning well, it can just search and display the product category but not the price range.

 

I have asked this here in the forum several times and even tried to find answers but to no avail. Hope this time I'd be lucky!

 

Thank you.

Posted

Hi Itprovid

 

While I dont have the answer to your query I was interested in knowing how you did the "search by price" feature? I am trying to get my site to do the same. I am not a programmer so ideally I wanted to knowi fthere was a simple way to do this or use a existing contribution.

 

All help appreciated

Posted

Replace the code in your /includes/boxes/categories.php with the code below...

 

<?php

 

function tep_get_paths($categories_array = '', $parent_id = '0', $indent = '') {

global $languages_id;

 

if (!is_array($categories_array)) $categories_array = array();

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

if ($parent_id=='0'){

$categories_array[] = array('id' => $categories['categories_id'],

'text' => $indent . $categories['categories_name']);

}

else{

$categories_array[] = array('id' => $parent_id . '_' .$categories['categories_id'],

'text' => $indent . $categories['categories_name']);

}

 

if ($categories['categories_id'] != $parent_id) {

$categories_array = tep_get_paths($categories_array, $categories['categories_id'], $indent . '  ');

}

}

 

return $categories_array;

}

 

$info_box_contents = array();

$info_box_contents[] = array('align' => 'left',

'text' => BOX_HEADING_CATEGORIES

);

new infoBoxHeading($info_box_contents, true, false);

 

$info_box_contents = array();

$info_box_contents[] = array('form' => '<form action="' . tep_href_link(FILENAME_DEFAULT) . '" method="get">' . tep_hide_session_id(),

'align' => 'left',

'text' => tep_draw_pull_down_menu('cPath', tep_get_paths(array(array('id' => '', 'text' => PULL_DOWN_DEFAULT))), $cPath, 'onchange="this.form.submit();"')

);

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

 

 

 

Hi Itprovid

 

While I dont have the answer to your query I was interested in knowing how you did the "search by price" feature? I am trying to get my site to do the same. I am not a programmer so ideally I wanted to knowi fthere was a simple way to do this or use a existing contribution.

 

All help appreciated

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...