Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search by Attribute


gscreations

Recommended Posts

Posted

Has anyone done something like this ?

 

On index where products are listed, i would like customers to be able to search based on the attribute of a product. eg:

 

Products will have attribute colour

 

So when looking at list of products in a category, they are able to select from a dropdown list the colour and then the list shows only those products that come in the colour they selected.

 

further from that i would like mulitple searches on attributes, so search on colour, size, region etc

 

any ideas ?

  • 4 months later...
Posted

Looking for the same thing. Any contribution that does something like that?

Patty

Posted

Tks for your reply, enigma. I'm already using these two contributions, along with another one for advanced search on the quick search box.

 

The second one you mentioned would be exactly what I need, except that it doesn't search on attributes, but on categories. Unless I missed something.

 

The first one does exactly that, but on the advanced search page only. What I need is a way to merge them and show the search for attributes on the products listing page. I tried merging the code for the first one, but it gives errors on the page. Since I'm no programmer, I don't know how to code so I can't do it right. Could you please give me a little hand here and tell me the exact code to use on the second contribution?

 

It would be even better if it was possible to show only size, for instance, instead of all attributes. But if it gets too complicated, don't worry. I'll take the whole thing. :)

 

Tks a lot for your help.

Patty

Posted

I tried that one too. It's very similar to the one I'm using, Quick research box: http://www.oscommerce.com/community/contributions,3930

 

Here's the code from Advanced Search - Attributes that I'm trying to use on

Advanced Search on Product List Page with Attributes and the Quick research box. I think there might be some code on advanced_search_result.php that goes with that, but I can't tell. Sorry... :blush:

 

 

advanced_search.php

 

<?php
		  // ********************************************************************************
********
		  // ********************************************************************************
********
		  // This code has been added in order to make the attributes on products searchable by selecting
		  // the attribute through a drop down list box, if you notice on your advanced_search.php page
		  // that a select box is empty it means there are no option values for that option
		  // Please leave these commented lines in this file.  This contribution was built by Adam,
		  // If it helps you, then you can help me by donating through paypal, my email address is: [email protected]
		  $attributes_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "'");
 while ($attributes = tep_db_fetch_array($attributes_query)) {?>
  <tr>
			<td class="fieldKey"><?php echo $attributes["products_options_name"]; ?></td>
			<?php 
			$option_values_query = tep_db_query("select pv.products_options_values_id, pv.products_options_values_name from products_options_values pv, products_options po, products_options_values_to_products_options popv where popv.products_options_id = po.products_options_id and pv.products_options_values_id = popv.products_options_values_id and popv.products_options_id =" . $attributes["products_options_id"] . " and po.language_id =". (int)$languages_id . " group by products_options_values_id, products_options_values_name");
			echo '<td class="fieldValue">';
			echo '<select name="'.$attributes["products_options_name"].'">';
			echo '<option selected></option>';
			while ($option_values = tep_db_fetch_array($option_values_query)) {
			 echo '<option value="'.$option_values["products_options_values_id"].'">'.$option_values["products_options_values_name"].'</option>';
			}
			echo '</select>'; ?>
			</td>
		  </tr><?php
 }
 //// End of code added to advanced_search.php
 /////////////////////////////////////////////
 // ********************************************************************************
********
 // ********************************************************************************
********
	?>

Patty

Posted

I still can't make it work. Can somebody pleeeease give a little help here?? I'm no coder, so this is really difficult for me to figure out.

Patty

Posted

Nobody to help???? I thought this was an easy thing to do for those with php knowledge....

Patty

  • 2 months later...
  • 4 months later...

Archived

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

×
×
  • Create New...