Developer forum

Forum » Dynamicweb 10 » Querypublisher on productdetail page to get articles

Querypublisher on productdetail page to get articles

Andreas Rundgren
Reply

Hi,

I have article pages in solution and on each page i have a page field which is a product selector to select 1 or more products.

This is my property for itemtype "Page properties"

In my post index i can see this field when i inspect my article page

Now i want to have a querypublisher that get the post index and ProductId parameter to match any page which that product has been selected on that page.
I have created a parameter on my index which is ProductId. But now i need to get the current productid to use it as parameter but i cant seem to get it. 

 

Here i have my App which is the query post. And i guess i need to override the default parameters here which i have my productid.

When i open override default parameters i can only type in something and not select my product id.


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Andreas,

The Override" option is meant to allow you to use specific values for some parameters.

You have to predefine an Expression in your Query (Post - Product Articles) to use the Parameter ProductId for filtering. This way, the list will always be based on your context.

Adrian

 
Andreas Rundgren
Reply

Hi,

I have this as an expression in my query. So this should not be type parameter instead i should use productid directly i guess but i cant seem to find the current productid in this state.

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Andreas,

The Expression looks fine. You should use the ProductId parameter, which will be read every time you access a ProductDetailPage.

Maybe you should check the values you have in ProductArticles. If you have multiple ProductIds separated with a comma, you should probably define the ProductArticles field as a String array instead of a string and change the Expression accordingly (Match Any instead of Contains).
Contains will only check the beginning of the string. Contains Extended will check the entire string, but it may generate some performance issues if you have a lot of data in that field.

Adrian

 

You must be logged in to post in the forum