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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Custom Search - Categories / Products


Go to End


4 Posts   1489 Views

Avatar
SS SS

Community Member, 24 Posts

1 November 2011 at 3:42am

Edited: 01/11/2011 3:52am

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

Community Member, 49 Posts

1 November 2011 at 9:57am

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

Community Member, 24 Posts

1 November 2011 at 10:06pm

Edited: 01/11/2011 10:41pm

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

Community Member, 49 Posts

2 November 2011 at 8:36am

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