Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Sorting products based on two categories View modes: 
User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/8/2011 6:36:55 AM
   
Sorting products based on two categories
Hi there,
ive created a document type called 'products' which has 8 checkboxes which corresponds to 8 different categories. so yea each product can have more than one category.

now, the website has 8 links corresponding to category names which when clicked takes you to the page which display products belonging to that category.

to do this i created a repeater wid a where condition 'category1 like 'yes'' -works fine but in this way i ended up creating 8 different templates each having its own repeater with a perticular where condition -which is a bit messy, is there any better way to achieve it? :)
cheers

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 6/8/2011 8:00:38 AM
   
RE:Sorting products based on two categories
Hi,


did you consider using built-in categories? Please see the Categories documentation. It would solve the issue for you.

If you cannot use it, please explain to us if you use 8 fields for the categories or 1 field with a Multiple choice form control (how do you specify the choices then?)


Best regards,
Helena Grulichova

User avatar
Certified Developer 10
Certified Developer 10
varinder-kudosweb - 6/8/2011 2:34:07 PM
   
RE:Sorting products based on two categories
helo,
actualy im using 8 different fields, each having 1 checkbox which returns 'yes' when checked.

my initial idea was to pass a query string to be used by the repeater's where part,
something like: categories.aspx?category1=yes

and filtering it with something like: category1 LIKE {%category1%} OR category2 LIKE {%category2%}...OR category8 LIKE {%category8%}

but, the above query doesnt seems to work (it ends up showing all the products in a random order)
so, i reduced it to one where condition for each category repeater which works, i mean, now the link category1 takes you to a page called category1.aspx?category1=yes which has a repeater with a where condition like, category1 LIKE {%category1%}. and the other link takes you to a page called category2.aspx?category2=yes which again has a repeater with a where condition like, category2 LIKE {%category2%}.

But, in this way i ended up adding 8 different webparts doing pretty much the same thing.

so yea, my question is, whats the best way to approach this situation?
- hope im clear,
cheers :)

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 6/9/2011 7:30:47 AM
   
RE:Sorting products based on two categories
Hello,


Could you please try to test a condition like:

(category1 LIKE '{%category1|(default)No%}') OR (category2 LIKE '{%category2|(default)No%}')...OR (category8 LIKE '{%category8|(default)No%}')

It should work.


Best regards,
Helena Grulichova


User avatar
Member
Member
yogeshbad-cybage - 9/16/2013 8:11:31 AM
   
RE:Sorting products based on two categories
I am new to Kentico.

I have a doubt about usage of Categories. I have a product list (documents) and I have two categories too. I have assigned each product one category.

I want to know usage of Categories - like I know sorting is one of the use.

Can somebody describe or provide me some link to understand how sorting is achieved using categories - step by step. And also other usages as well if any.

User avatar
Member
Member
kentico_sandroj - 9/17/2013 5:56:37 PM
   
RE:Sorting products based on two categories
Hello,

Categories are used to group similar to related documents. Sorting is achieved by using the appropriate category column in the WHERE condition for the repeater or viewer which is loading the data. Typically, categories are used to filter out documents based on the selected category but you can use the functionality for anything that may be of use to you. It may help to install the sample Corporate Site to see how categories are used there.

Please let me know if you have any additional questions.

Best Regards,
Sandro