Developer forum

Forum » Ecommerce - Standard features » New Index Get Groups from Product List

New Index Get Groups from Product List

António Ramos
Reply

Hi guys,

With the new index we need to get the group names from the current product list. Is there any way to accomplish this?

Best regards,

António Ramos


Replies

 
Nicolai Høeg Pedersen
Reply

You can create a facet on the groupnames[] field

 
António Ramos
Reply

Thanks Nicolai. How can i retrieve the group id related with the facet option?

BR

 
Nicolai Høeg Pedersen
Reply

You cannot. If you want to use ID's use the GroupIds[] field instead.

If it is for value in the querystring for searching, simply use the groupname directly in the querystring, ie. "&groupnames=cool shirts,warm pants" and add a parameter called groupnames as string[] and an expression using GroupNames[] match any groupnames parameter.

BR Nicolai

 
Mikkel Toustrup Olsen
Reply

Hi Nicolai,

Isn't it possible to add the groups to the index in order to retrieve these in e.g. a freetext search? - so mixing the results with groups, products and so on..

So if you search for a specific Bike make, lets say "Kildemoes", you'd get the Kildemoes group (with link etc), and products in this group afterwards?

BR Mikkel

 
Nicolai Pedersen
Reply

Hi Mikkel

No, that is not possible with the current index. You can of course add groups to the index, but that will not work when rendering af product list.

So you have 2 options

  1. Create another index using the SQL index builder to index the groups. When searching, search both indexes (Ajax maybe?), and show first one list, then the other.
  2. Add groups to the current product index. Use the query publisher (not the catalog) to display results - problem is you do no get catalog features like pricing, images etc.

Do you have a screen dump of what you are trying to achieve?

BR Nicolai

 
Mikkel Toustrup Olsen
Reply

Hey Nicolai,

Basically we want the same logic as this website is currently using (not dw though): http://www.hounisen.com/

Try to search for: Rør, and you'll see what we're trying to archieve :)

Furthermore I would like you to take a look at the following when possible: http://doc.dynamicweb.com/forum/development/development/index-data-is-null-when-building I have been through our version control to see how the index, repo files etc. differs, without any luck though. Feel free to contribute on the thread to keep things sorted :)

Thanks

BR Mikkel

 
Nicolai Pedersen
Reply

Yes, that would be 2 different searches on 2 indexes using ajax. Should be fairly simple to do.

 
Mikkel Toustrup Olsen
Reply

Hi Nicolai,

OK, I successfully created a new Group index with the SqlIndexBuilder, and it worked just fine.

I have added 3 fields, as I don't know if there is any supported schemaextender for this (I don't reckon the productindexschema would be neccessary here).

See attached image (ss_GroupIndex.png).

My query is setup as shown in attached image (ss_GroupQuery.png).

As I am working from a wrap solution, I have a Search page with an ecom module attached and a AjaxPage for the typeahead search. Both of these I changed to utilize the group index and its corresponding query. 

However, I don't get any results.

The group-list-json.html file for the ajax page is as follows:

[<!--@LoopStart(Subgroups)--><!--@If(Subgroups.LoopCounter>1)-->,<!--@EndIf-->{
"id": "<!--@Ecom:GroupID-->",
}<!--@LoopEnd(Subgroups)-->
]

And I made a new template for Search page itself for testing..

Do I need to change the setup on the modules itself from List to Groups instead and set appropriate templates for this?

It is a bit confusing :)

BR Mikkel

ss_GroupIndex.PNG ss_GroupQuery.PNG
 
Nicolai Pedersen
Reply

Your setup looks ok for the index. You cannot use productindexschema as it provides product data, and you are indexing group data. So you are all set. Except maybe you need to take language into consideratioin.

You search also looks fine. Except you use contains for the groupid which I do not see make sense.

To publish the results of the groups, you need to use the QueryPublisher - and not the product catalog. And create a json feed for that. When you do that, you might need to add some extra fields to your index to get enough data (i.e. group title, group image etc.)

BR Nicolai

 
Mikkel Toustrup Olsen
Reply

Hi Nicolai,

It makes sense regarding the schema extender and yeah I was thinking the same thing about the groupid.

Yeah those 3 fields were just for testing purposes, obviously I need to add more on the go.

Will I be able to render links for the groups as well? - If not I guess I have to do some custom logic afterwards :)

Regarding the Query Publisher, does that app require any specific license? - I don't seem to have it in my app list.

See attached image. 

Regarding the json feed, i guess it should follow the same structure loop etc as the shipped List template for the module?

See attached (ss_QueryPublisherListTemplate.png)

BR Mikkel

 

ss_Apps.PNG ss_QueryPublisherListTemplate.PNG
 
Mikkel Toustrup Olsen
Reply

Hi Nicolai,

Update on this one.

I got my json feed to work, and I am now able to call both indexes with ajax utilizing the typeahead functionality in the wrap solution. So thats nice.

However, I am thinking if its possible to some how fetch the group structure/hierachy and in some way render that for the user. 

Our approach is to make the search utilize somehow the same logic as their current - www.hounisen.com - where you're getting Main Groups, Sub Groups and products in the end. So you, as a user, has to make a choice of either entering a main category, a subcategory or lastly a specific product. If that makes sense.

I dont know if that hierachy can be accomplished in the Group Index (sqlindexbuild) or I have to create another index containing the subgroups.

Any thoughts on this? :)

BR Mikkel

 
Nicolai Pedersen
Reply

Hi Mikkel

On the groupindex, make sure to index the parent group(s) as well - then you can handle it when rendering - if the group has a parent id it is a subgroup, otherwise a main group.

BR Nicolai

 
Mikkel Toustrup Olsen
Reply

 Hi Nicolai,

That makes sense, however to do this I need to make a join of some sorts on EcomGroups and EcomGroupRelations in order to fetch these, right and parse that to the IndexSqlBuilder query?

As far as I can see the EcomGroups table does not contain information regarding relations which makes sense :)

BR Mikkel

 
Nicolai Pedersen
Reply

It does not - because it is a many to many relationship why your parentgroup field will also be a string array (or should be).

 
Mikkel Toustrup Olsen
Reply

Hi Nicolai,

Sure thing. But do I understand it correctly if my SqlIndexBuilder query should contain somewhat of a join in order to fetch EcomGroups information as well as EcomGroupRelations information (ParentID/ParentIDs).

BR Mikkel

 

You must be logged in to post in the forum