Forums / Setup & design / Canned Advanced Search

Canned Advanced Search

Author Message

Philip Redmon

Tuesday 13 July 2004 1:22:31 pm

I'm trying to set up a 'canned' advanced search page to force users to choose from existing values within a specific attribute across a class. ie:

Class: Article
Attributes: Title, Intro, Body

sample data:
Title: Dog
Intro: About a Dog
Body: Body

Title: Cat
Intro: About a Cat
Body: Body

Title: Dog
Intro: About a Cat
Body: Body

I want to create a search form that grabs the desired attributes (Title, Intro), places them into a select box, populates another select box existing attribute values (Dog, Cat for one, About a Dog, About a Cat for the other), and then implements the search on those selections.

My code for the select boxes is:

<select name="Content_search_attribute_fulltext_value[]">
<option value="dog">dog</option>
<option value="cat">cat</option>
</select>

<select name="Content_search_attribute_fulltext_classattribute_id[]">
<option value="163">Title</option>
<option value="165">Intro</option>
</select>

So, I need a fetch that will that will populate the select box with the values (dog, cat) of the attribute (Title, Intro) within the specific class (Article).

Edit:
I _have_ spent a lot of time searching for the proper code, and what I have found has gotten me close,

{section loop=fetch( 'content', 'class_attribute_list', hash( 'class_id', 14 ) )}
  {$:item.name|wash}
{/section}

{let class_attribute=fetch( 'content', 'class_attribute', hash( 'attribute_id', 163 ) )}
  {$class_attribute.name|wash}
{/let}

The first of which gets me a list of the attributes from the class_id, and the second which gets me the name of the attribute from the attribute_id. There's 'object_by_attribute' as well, but I'm looking for something that fetches all values of an attribute. I'm beginning to question whether this is possible?!

Philip Redmon

Tuesday 20 July 2004 2:26:03 pm

Upon further inspection, I don't think I can get what I want by using a fetch, as there exists no such functionality.

I've tested multiple attribute searching using search boxes,
ie.
Title: Search Box
Intro: Search Box

and it works just fine, so I'll probably end up having multiple attribute searching and populate the attribute list (dog, cat, etc) in a class, and call that class to be listed in a select box. It'll be something like the select box above, but just add a fetch to populate the options by looping through the canned class.