Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Custom Search - Categories / Products


Reply

4 Posts   821 Views

Avatar
ss-ss

1 November 2011 at 3:42am (Last edited: 1 November 2011 3:52am), Community Member, 15 Posts

I have around 20-25 products under couple of categories. Looking for some sort of example code showing custom search resulting category / product pages only.

Hope someone can help.

Avatar
Scott Farmer

1 November 2011 at 9:57am Community Member, 35 Posts

This might help.

http://www.silverstripe.org/all-other-modules/show/6641?start=24

I downloaded the code from the 4th page here and worked very well.

Cheers
Scott

Avatar
ss-ss

1 November 2011 at 10:06pm (Last edited: 1 November 2011 10:41pm), Community Member, 15 Posts

Cheers Scott,

I did look at the code. I have not implemented categories and products as DOM (DataObjectManager).

My requirement is to implement custom search snippet on the category/product pages when searched will get results only from product pages (Title / Content).

There will be another website search which will only show results from simple pages excluding product pages.

Is that possible? Sorry very new to SilverStripe.

Avatar
Scott Farmer

2 November 2011 at 8:36am Community Member, 35 Posts

Take a look at this tutorial on how to extend and create your own page types:

http://doc.silverstripe.org/sapphire/en/tutorials/2-extending-a-basic-site

Once you have got that working, you should be able to search your new product type custom fields. By default the normal search only searches the title and content fields.

By default the custom search will search "all" pages and any classes you tell it to search. Once you have this working I can tell you how to modify this.

Hope that helps.

Regards
Scott