- Posts: 45
COMMUNITY FORUM
Sort itemAuthorLatest in itemView by custom field
- Gerben
- Topic Author
- Offline
- Senior Member
Less
More
10 years 11 months ago #119290
by Gerben
Sort itemAuthorLatest in itemView by custom field was created by Gerben
Hi there,
I know how to sort the items (to create a menu item and link it to a user)
How can this be done for all the users in once? I made a custom field in the database that users can update so they can set the items on top of there page.
I have the same problem on the userView page. The items in the userItemList are sorting by date but i want to sort them by custom field.
Where can i set this to a custom database field?
Really looking forward to a answer to this, trying to find a solution for a week but just can't find it :)
Geppie
I know how to sort the items (to create a menu item and link it to a user)
How can this be done for all the users in once? I made a custom field in the database that users can update so they can set the items on top of there page.
I have the same problem on the userView page. The items in the userItemList are sorting by date but i want to sort them by custom field.
Where can i set this to a custom database field?
Really looking forward to a answer to this, trying to find a solution for a week but just can't find it :)
Geppie
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 11 months ago #119291
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Sort itemAuthorLatest in itemView by custom field
Hello Geppie,
By default K2 does not support this functionality, however there are several extensions posted ad the JED or at the extend K2 section of this site that offer filtering from extrafields.
By default K2 does not support this functionality, however there are several extensions posted ad the JED or at the extend K2 section of this site that offer filtering from extrafields.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gerben
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 45
10 years 11 months ago - 10 years 11 months ago #119292
by Gerben
Replied by Gerben on topic Re: Sort itemAuthorLatest in itemView by custom field
Hi Krikor,
Thank you for your quick reply. I found a way to filter the itemAuthorLatest items.
I did this by modify the models/itemlist.php
function getAuthorLatest and then added ORDER BY i.neworder ASC"; on row 856
But i can not find the way how the sort to userItemList in the userview.
Do you know where i can find this or add this option?
Thank you for your quick reply. I found a way to filter the itemAuthorLatest items.
I did this by modify the models/itemlist.php
function getAuthorLatest and then added ORDER BY i.neworder ASC"; on row 856
But i can not find the way how the sort to userItemList in the userview.
Do you know where i can find this or add this option?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 11 months ago #119293
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Sort itemAuthorLatest in itemView by custom field
The query is built using cases. Try looking for case 'user'.
Although I strongly recommend you against doing this because it is a core hack.
In the next update you will lose all of your changes and you wlll need to reapply them.
Although I strongly recommend you against doing this because it is a core hack.
In the next update you will lose all of your changes and you wlll need to reapply them.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gerben
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 45
10 years 11 months ago #119294
by Gerben
Replied by Gerben on topic Re: Sort itemAuthorLatest in itemView by custom field
Thank you for warning me Krikor but i have to filter by this custom field.
I found the case user but can't see where to put the "ORDER BY i.neworder ASC"
I will keep on trying :) Can you give me another push in the right direction?
Thanks
I found the case user but can't see where to put the "ORDER BY i.neworder ASC"
I will keep on trying :) Can you give me another push in the right direction?
Thanks
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 11 months ago #119295
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Sort itemAuthorLatest in itemView by custom field
$query is the variable for building the $query, so you need to edit this variable.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gerben
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 45
10 years 11 months ago #119296
by Gerben
Replied by Gerben on topic Re: Sort itemAuthorLatest in itemView by custom field
Yes, i was thinking that but how can i order the query :)
$query .= " AND i.created_by={$id} AND i.created_by_alias='' ";
Must be this?
$query .= " AND i.created_by={$id} AND i.created_by_alias=' ' ORDER BY i.neworder ASC" ;
But is not working..
$query .= " AND i.created_by={$id} AND i.created_by_alias='' ";
Must be this?
$query .= " AND i.created_by={$id} AND i.created_by_alias=' ' ORDER BY i.neworder ASC" ;
But is not working..
Please Log in or Create an account to join the conversation.
- Gerben
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 45
10 years 11 months ago #119297
by Gerben
Replied by Gerben on topic Re: Sort itemAuthorLatest in itemView by custom field
Krikor, any idea how to set the sort/order option?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 11 months ago #119298
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Sort itemAuthorLatest in itemView by custom field
There are several cases for $ordering switch ($ordering)
Make sure these predefined values are not overriding your query, eg. make sure the 'user' case is not inheriting these values.
Make sure these predefined values are not overriding your query, eg. make sure the 'user' case is not inheriting these values.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Gerben
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 45
10 years 11 months ago #119299
by Gerben
Replied by Gerben on topic Re: Sort itemAuthorLatest in itemView by custom field
That's a lot more difficult to do then it sounds :D
I added to the ordering switch ($ordering)
case 'neworder' :
$orderby = 'i.neworder ASC';
break;
But how can i insert this into the case 'user' ?
It's breaking my mind for more then a week now :D
I added to the ordering switch ($ordering)
case 'neworder' :
$orderby = 'i.neworder ASC';
break;
But how can i insert this into the case 'user' ?
It's breaking my mind for more then a week now :D
Please Log in or Create an account to join the conversation.