Top Tier Category - ignored in MultiSearch search results
2 posts by 2 authors in: Forums > CMS Builder
Last Post: August 10, 2012 (RSS)
By Mikey - August 9, 2012 - edited: August 9, 2012
I've created a category menu called "Businesses" that has two levels, a top tier category and a child category of the top tier similar to:
The top tier and child categories flow similar to:
Accounting
• Company A
• Company B
• Company C
• Company D
Banks
• Company E
• Company F
• Company G
• Company H
Communication
• Company I
• Company J
• Company K
• Company L
Is it possible to create a Field Type pulldown list within the "Businesses" category menu that loads only the top tier category records such as:
Accounting
Banks
Communication
Second Part to the question
Is it possible to make the default value for the Field Type pulldown list that of the top tier category for the child category. So that if the Child Category "Company A" belongs to the top tier category "Accounting" then the Field Type pulldown list would automatically populate with the top tier category for the Child category.
The purpose for this is so I can make the MultiSearch search the Field Type pulldown list instead of the record's title - thereby producing MultiSearch search results that only list the child categories.... and so the top tier records that contain no information other than a title do not appear in the MultiSearch results.
I hope this makes since.
Zick
The top tier and child categories flow similar to:
Accounting
• Company A
• Company B
• Company C
• Company D
Banks
• Company E
• Company F
• Company G
• Company H
Communication
• Company I
• Company J
• Company K
• Company L
Is it possible to create a Field Type pulldown list within the "Businesses" category menu that loads only the top tier category records such as:
Accounting
Banks
Communication
Second Part to the question
Is it possible to make the default value for the Field Type pulldown list that of the top tier category for the child category. So that if the Child Category "Company A" belongs to the top tier category "Accounting" then the Field Type pulldown list would automatically populate with the top tier category for the Child category.
The purpose for this is so I can make the MultiSearch search the Field Type pulldown list instead of the record's title - thereby producing MultiSearch search results that only list the child categories.... and so the top tier records that contain no information other than a title do not appear in the MultiSearch results.
I hope this makes since.
Zick
Re: [zick] Top Tier Category - ignored in MultiSearch search results
By Jason - August 10, 2012
Hi,
Sure, to create your list field, you can use the "Get options from MYSQL query (advanced)" option.
You can then use a query like this:
A depth of 0 indicates a top level category
I don't think there would be a way to default to the child's parent record without using a custom plugin.
If the entire purpose of this is for searching for records based on their parent, there may be an easier way.
If in your search field you output a drop down list with only top level categories, and use the "num" field as a value, you can then search against the "parentNum" field in your category section. Top level categories have no value for parentNum, so you wouldn't need to worry about filtering those out.
Hope this helps get you started.
Sure, to create your list field, you can use the "Get options from MYSQL query (advanced)" option.
You can then use a query like this:
SELECT name, name
FROM `<?php echo $TABLE_PREFIX ?>businesses`
WHERE depth = 0
A depth of 0 indicates a top level category
I don't think there would be a way to default to the child's parent record without using a custom plugin.
If the entire purpose of this is for searching for records based on their parent, there may be an easier way.
If in your search field you output a drop down list with only top level categories, and use the "num" field as a value, you can then search against the "parentNum" field in your category section. Top level categories have no value for parentNum, so you wouldn't need to worry about filtering those out.
Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/