Developer forum

Forum » Development » Search all products

Search all products

Lars Hejgaard Sørensen
Reply
Hi,

I've set up a free-text product search and tried a couple of different things, but it seams that it will only search match products if the containing group is specified on the paragraph? I would like it to search all products in the database. Am I doing something wrong?

BR.
Lars

Replies

 
Pavel Volgarev
Reply
Hi Lars,

This is by design. The default query constraint consists not only of groups that you select on a paragraph settings. It also includes the current eCommerce language, "In stock" configuration (Management Center) and some other things.

The "groups" criterion can represent only the current group if the corresponding "GroupID" query-string parameter is not empty.

-- Pavel 
 
Lars Hejgaard Sørensen
Reply
So if I want to search all products regardless og group relationships, how would I accomplish this?

BR.
Lars
 
Pavel Volgarev
Reply
Hi Lars,

Here's what you can do:

Filters setup:

  1. Create new filter group (Management Center -> eCommerce settings -> Product catalog -> Search filters).
  2. Add new delimit filter with the following setup:
    1. Name: "Default groups"
    2. Field: "GroupHierarchy"
    3. Values: [Group IDs that you want to show the products from]
    4. Applied: "Only without other filters"
  3. Add new free text search filter.
Paragraph setup:

  1. Create new paragraph with eCom catalog module.
  2. Make sure that no product groups are selected ("Product groups" selector displays "No groups added!"). Note that clearing previously selected groups probably won't work (seems like a bug in this control).
  3. Disable the "Groups" view ("Groups" checkbox under the "Templates" section must be cleared).
  4. Select the filter group that you've created earlier.
  5. View the page (delimit filter is applied so you will see some products even if you didn't select any target groups). Test your free text search filter (delimit filter won't be applied because of its "Apply mode" and you should be able to search within the entire eCommerce products database).
Hope this helps.

-- Pavel 
 
Mikkel Høst
Reply
If u don't add any groups at all i pretty sure it searches all products :)

 
Pavel Volgarev
Reply
Hi Mikkel,

Yes, but then you won't see any products until you actually start searching for something. The trick with Delimit filter is made in order to have some default view instead of seeing  "No products found" message.

-- Pavel 
 
Mikkel Høst
Reply
 Hi Pavel

Oh yes, good point. But in most cases you have a search field where u search and after searching you reach a "search" page where the results are displayed. But good to know if u want a search page with some default products displayed.




 

 

You must be logged in to post in the forum