Support Forums

Old 02-11-2008, 10:11 AM   #1
Senior Member
 
Join Date: Jan 2007
Posts: 123
Rep Power: 13
HotAir is on a distinguished road
Default Sort order by extra field

Hi,

I've added a couple extra fields and have modified category.php to assign them to smarty variables so I can display them in subcategories.tpl.php.

I've like the page to display these listings sorted by one of the new extra fields.
The current sort order is defined in category.php like this:
Code:
$sSQL .= " ORDER BY ".MAIN_PRODUCT_SORT." ".MAIN_PRODUCT_SORT_OPTION.", p.dateadded DESC";
I'd like to replace p.dateadded with the correct extra field, but do not know how it should be referenced. The field I want to sort by is defined in the smarty degug console as 'StartDate' in the listing's array, and is displayed on the template with $entry.StartDate. The fID for this field is 6.

How do I reference this extra field to sort with it?

Thanks,
Jim
__________________
V3.1.10 Developer - live
V4.1.0 Beta 2 - sandbox
HotAir is offline   Reply With Quote
Old 02-11-2008, 10:22 AM   #2
Coder
 
Join Date: Mar 2006
Posts: 4,574
Rep Power: 111
Lhotch is just really niceLhotch is just really nice
Default

Are you talking about the javascript sort when the ads are displayed or you want to sort the query itself?
__________________
Larry.
Lhotch is offline   Reply With Quote
Old 02-11-2008, 10:39 AM   #3
Senior Member
 
Join Date: Jan 2007
Posts: 123
Rep Power: 13
HotAir is on a distinguished road
Default

I want to sort the query - I'm not using the javascript sort.

Thanks,
Jim
__________________
V3.1.10 Developer - live
V4.1.0 Beta 2 - sandbox
HotAir is offline   Reply With Quote
Old 02-11-2008, 11:03 AM   #4
Coder
 
Join Date: Mar 2006
Posts: 4,574
Rep Power: 111
Lhotch is just really niceLhotch is just really nice
Default

Quote:
Originally Posted by HotAir View Post
I want to sort the query - I'm not using the javascript sort.

Thanks,
Jim
I have not found an easy way to accomplish this. Due to the flexibility of extra fields and the fact that some categories can have them and others may not the Extra fields are actually made up from two different database tables. One that holds the extra fields name and another that holds the extra fields value.

This means you would somehow need to include the extra fields in the main product query itself as opposed to collecting them after the inital query so they can be used to sort the data and I am not sure this is doable. I played around with it at one time and was having a heck of a time building a query to do it but I am far from an sql expert. If someone can build a query to do this I would also be interested.

I think in V4 this functionality is supposed to be built in.
__________________
Larry.
Lhotch is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
admin > category > extra fields info disappearing kgrinsteiner v3.1 Questions & Support 0 12-16-2007 07:27 PM
Extra Search Field Greg H v3.1 Modules & Modifications 2 10-04-2007 12:04 AM
Adding extra field to search.php... abkeller v3.1 Modules & Modifications 4 06-05-2007 12:15 AM
listing extra field value when it is an array? Mike-N-Tosh v3.1 Modules & Modifications 13 04-21-2007 09:31 AM


All times are GMT -4. The time now is 01:03 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0