Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attribute filter Drop-downs


Recommended Posts

Hello

I have install Attribute filter Drop-downs add-on http://addons.oscommerce.com/info/5997 .  on osCommerce 2.3 BS Edge,

and it work well.

I edited that the  Attribute filter Drop-downs box will be hidden on the  index page and show when another pages,

So I would like that when I chose some category that  the Attribute filter will look from chosen category not from all categories.

any advice?

here is the code

  <?php 
 
//return the setting options

// consists of: Shape 5, Type 1, Size 6, Material 7
//if a value has been selected, it will show as selected.

$opts = array( 1 => 'Size', 2 => 'Colour');

// the number before the word represents the option ID in the `product_options` table
// the word after contains the displayed name of the dropdown box, which would usually be the same as the name

//title of the box

$heading = 'Shop By:';

// you should not need to edit below this line 
//------------------------

$mainhtml = ""; //the var to hold all of the html

foreach ( $opts as $opt => $name) {
	
	unset($html);
	
	$html = "<tr><td width='125px'>
				$name 
			</td></tr>
			<tr><td>
			<SELECT name='$opt' onchange='document.m_srch.submit();'>
			<OPTION value='not'>---</OPTION>";//print the name of the box and start the drop down
	
	$sql = "SELECT `products_options_values_id` from `products_options_values_to_products_options` WHERE `products_options_id`='$opt'"; 
	$res = tep_db_query($sql);// get the values of all the options for that catagory
	while($id = tep_db_fetch_array($res)){
	
		$optnamear = tep_db_query("SELECT `products_options_values_name` from `products_options_values` WHERE `products_options_values_id`='$id[products_options_values_id]'");
		
		$optname = tep_db_fetch_array($optnamear);
		
		//create the dropdown
		
		$html .= "<OPTION value='$id[products_options_values_id]' ";
		
		if($_GET[$opt] == $id['products_options_values_id']){
			$html .= "selected='selected'"; // if the product has already been selected keep it selected!
			} 
		
		$html .= ">$optname[products_options_values_name]</OPTION>";
		
		
		}
		
		$mainhtml .= $html."</SELECT></td></tr>";
		
		
	
	} 


echo "<tr><td>
<table border='0' width='100%' cellspacing='0' cellpadding='0'>
  <tr>
    <td  width='100%' height='14' class='infoBoxHeading'>$heading</td>
	</tr>
	</table>
	<table border='0' width='100%' cellspacing='0' cellpadding='1' class='infoBox'>
			<tr><td>
			<table class='infoBoxContents'>
			<FORM name='m_srch' action='advanced_search_result.php' method='get'>
			<INPUT type='hidden' value='1' name='m_op'> <INPUT type='hidden' value='1' name='keywords'> \n
			$mainhtml
			</table>
			</td></tr>
			</FORM>
		</table>
	</td></tr>";  

?> 

 Or if some one have some add-on close to this that work on products_listing page?.

BR

Omar

Get the latest Responsive osCommerce CE (community edition) here .

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...