Developer forum

Forum » Feature requests » Undgå at loope hovedprodukt ud ved variantsøgning

Undgå at loope hovedprodukt ud ved variantsøgning

Kasper Vesth
Reply
I have a site which use the powerpack search filters. On the site there are some products, and each product has some variants which has a color.

We can search for products with a given color, and the search will loop out the products with the given color. It works fine, but one thing is puzzling to me.

When you add a new product to eCom it is automatically given a variant with the same details as the main product. This is fine, but if we for instance add a main product with the color black, the database will hold two entries with the same productid where the color is black. If you then search for products with the color black, both the main product and the variant will be looped out.

This makes sense in the sense that it is what a database search will return, but in my head it would make more sense if the main product wasn't looped out since your search should only return one of the same product.

My request is then. Would it be possible for you to make it an option to not loop out the main product if you apply a search filter? This makes sense in many cases since the variant will hold the same information as the main product, and unless you need to know what variants the product has, that information would be sufficient.

Replies

 
Kasper Vesth
Reply
http://dev.prodesigndenmark.com/en-US/Products.aspx?ID=2&eComQuery=&nzVariantColor=Black

You can see it here. The product that seems weird have is called Model 1212

 
Pavel Volgarev
Reply
This post has been marked as an answer
Hi Kasper,

You can use the Delimit filter with the following settings:

  1. Field = "IsVariant"
  2. Values = "True"
  3. Applied = "Only with other filters"
This will tell the system to return only variants and not main products.

-- Pavel  
Votes for this answer: 0
 
Kasper Vesth
Reply
Thank you it works like a charm :)
 
Kasper Vesth
Reply
Hi Kasper,

You can use the Delimit filter with the following settings:

  1. Field = "IsVariant"
  2. Values = "True"
  3. Applied = "Only with other filters"
This will tell the system to return only variants and not main products.

-- Pavel  
Hmm one extra little thing. Is it possible to only apply the delimit filter when a specific other filter is used? The case is here that the filter should only be applied when searching for color. When searching for material it should work like it always have.
 
Pavel Volgarev
Reply
Hi Kasper,

You will have to write some custom code in order to achieve this. In particular, you'll need to handle "AfterComposeQuery" notification and reset query generated by your Delimit filter if needed (in your case, if user searches for color).
 
I wrote a blog post about how to extend search filters. The last code example might be particularly useful for you:
 

-- Pavel 

 
Kasper Vesth
Reply
Hi Kasper,

You will have to write some custom code in order to achieve this. In particular, you'll need to handle "AfterComposeQuery" notification and reset query generated by your Delimit filter if needed (in your case, if user searches for color).
 
I wrote a blog post about how to extend search filters. The last code example might be particularly useful for you:
 

-- Pavel 

Hi Pavel

I am having trouble getting the notification events to fire. I have even tried subscribing to all the 5 different events just to see if any of them are made, but the OnNotify is never called it would seem, even though I apply filters to the search. Is there anything in particular I need to do or are there certain scenarios where the events are not fired?

It's still the same website as the earlier question.

 
Pavel Volgarev
Reply
Hi Kasper,

What version of the application are you using? Did you put your compiled assembly (.dll file) into the application /bin folder?

-- Pavel
 
Kasper Vesth
Reply
Hi Kasper,

What version of the application are you using? Did you put your compiled assembly (.dll file) into the application /bin folder?

-- Pavel
I am using version 19.2.4.1, and put the dll in the right folder :)
 
Kasper Vesth
Reply
Nevermind. I found my mistake, and it was a stupid one at that. The class I uploaded was not set to public which would explain the lack of recognition in the system.