Sorting by custom fields |
Post Reply |
Author | |
sdesantis
Newbie Joined: 21-December-2006 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
Posted: 21-December-2006 at 5:53pm |
Is there a way to sort by a customfield's data. I'm setting up some links as predefined searches and I would like the order to go according to the customfield data. I feel like creating another case in this snippet from showsearchresults.asp would work... but... what would the syntax be? if strORD<>"" then Select Case StrORD Case "1": strORD1="products.idproduct ASC" Case "2": strORD1="products.sku ASC" Case "3": strORD1="products.description ASC" Case "4": strORD1="products.price ASC" Case "5": strORD1="products.price DESC" Case "6": strORD1="products.custom1 DESC" End Select Else strORD="1" strORD1="products.idproduct ASC" End If -------- Any guidance would be appreciated. thanks, sean Edited by sdesantis - 21-December-2006 at 5:54pm |
|
netprofits
Certified ProductCart Developers Joined: 05-January-2006 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
|
This will be tough because each product can actually have up to 3 custom fields. The custom1, custom2 and custom3 fields only hold the record # pointing back to the customfields table. The content1, content2 and content3 fields in the products table actually hold the values that you probably want to sort on. If you only have one custom field per product then you could try sorting on: If you actually want to sort by the real custom field names you would need to modify the whole SQL statement to join the customfields table. That could cause your searches to slow down. I would recommend an outer join so you don't lose records that have no custom field values. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |