Developer forum

Forum » Templates » XSLT: Top products in productlist

XSLT: Top products in productlist

Michael Nielsen
Reply
I have created a product field called TopProducts as a checkbox. When the product is checked, I want to display these products at the top of the page, outside the normal product loop.

http://apotekeren.net.dynamicweb-cms.com/produkter/hudpleje/kosmetik.aspx

As you can see I've solved that part, but my problem is that the products also have to be sorted to the top, or my check for the TopProduct field won't register anything since the xml only holds the first number of products defined by your module settings, in my case 15.

Is there anyway I can avoid having to sort the products to the top other than setting products per page to 500?



Replies

 
Vladimir
Reply
This post has been marked as an answer
Hi Michael!
May be the better solution would be if you create new group to handle TopProducts.
And on the page with product catalog create a paragraph containing another product catalog module, but only with TopProducts category.

Best regards,
Vladimir

Votes for this answer: 0
 
Michael Nielsen
Reply
Hi Vladimir

Good idea, but couldn't I do that without creating a new productgroup? Just create another paragraph which shows 500 products and only show the products marked TopProduct? Can you elaborate why you would create a productgroup?

There would be a small problem in that when you go to page 2, the TopProducts would still be visible, currently they are only shown at page 1, but I guess I could create a check for PageNum in the URL so nothing is shown on other pages than the first.
 
Vladimir
Reply
Hi Michael!
It seems to me that the creation of group for top products (products actually are remains in theirs categories, you just add a relation to the topgroup) would be the way fastest to implement and effective in work - there is no need to select 500 products, to sort them, to add custom fields.

Best regards,
Vladimir
 
Michael Nielsen
Reply
Hi Vladimir

Well the only difference as I see it is if I want the paragraph to show from a specific group or have the template ignore products with a False value in the custom field. I all ready have the custom field and the template, and I feel that it is easier for a client to mark a checkbox then for them to add a product to a group.

I've marked your first answer as the correct answer as it will solve what I wanted to do.

 

You must be logged in to post in the forum