- Posts: 23
COMMUNITY FORUM
[SOLVED] Order tags in Add Article Form
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
11 years 4 months ago #121749
by webloesung
[SOLVED] Order tags in Add Article Form was created by webloesung
Hello,
on our installation the tags are showed for selection (in Add article form in frontend,) ordered by TAG ID. This is not user friendly :(.
Is there any possibility how to show the tags ordered by NAME?
Can it be done somehow in itemform.php?
Thank you very much for feedback!
on our installation the tags are showed for selection (in Add article form in frontend,) ordered by TAG ID. This is not user friendly :(.
Is there any possibility how to show the tags ordered by NAME?
Can it be done somehow in itemform.php?
Thank you very much for feedback!
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
11 years 4 months ago #121750
by Yiota
Replied by Yiota on topic Re: Order tags in Add Article Form
I'm afraid that this cannot be done without tampering with the K2 core files.
Please Log in or Create an account to join the conversation.
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 4 months ago #121751
by webloesung
Replied by webloesung on topic Re: Order tags in Add Article Form
can i add somehow the "ORDER by NAME" for listing of availible tags within itemform.php (which is already modified and is placed in template html folder )?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #121752
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Order tags in Add Article Form
I don't think editing core files is the best approach here. You can add a simple JS script like this -> jsfiddle.net/stodolaj/De8Ku/ which will continue to work after you have updated K2 (no need for repatching).
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 4 months ago #121753
by webloesung
Replied by webloesung on topic Re: Order tags in Add Article Form
thank you! it works good with UL, but with SELECT element there is an issue :(:
the sorting is showing properly within the select list, but after saving some other tags are shown. Looks like the VALUE of SELECT OPTION is somehow not taken into concideration by sorting the select list.):
1. before the sorting the select list:
<option value="3">Vegan</option>
2. after soring of the select list:
<option value="3">APPARTMENTS</option>
systems saves value "3" what is actually "Vegan" and not selected after sorting "Appartments" ...
is it possible to sort with ids of values?
the sorting is showing properly within the select list, but after saving some other tags are shown. Looks like the VALUE of SELECT OPTION is somehow not taken into concideration by sorting the select list.):
1. before the sorting the select list:
<option value="3">Vegan</option>
2. after soring of the select list:
<option value="3">APPARTMENTS</option>
systems saves value "3" what is actually "Vegan" and not selected after sorting "Appartments" ...
is it possible to sort with ids of values?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #121754
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Order tags in Add Article Form
Have you checked this out: stackoverflow.com/questions/12073270/sorting-options-elements-alphabetically-using-jquery ?
Let me know if that did the trick.
Let me know if that did the trick.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 4 months ago #121755
by webloesung
Replied by webloesung on topic Re: Order tags in Add Article Form
going to be interresting :)
did the following:
did the following:
Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #121756
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Order tags in Add Article Form
I can see you are a purist. No jQuery at all.
Can you send me the resulted HTML of that script? is the value attribute omitted?
Can you send me the resulted HTML of that script? is the value attribute omitted?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 4 months ago #121757
by webloesung
Replied by webloesung on topic Re: Order tags in Add Article Form
:lol: i would love to use jQuery - the question is how?
was trying with github.com/vafour/select2-sortable -> haven't got it running at all.
as i understood: i have to:
1. add jquery.multisortable to be used (not sure where to add it to be correct - to itemform.php or to be loaded on index.php?
2. create a button for sorting (done)
3. declare within the button event the event calling respective jquery function ($('ul').multisortable();?)
so far to the theory .. :)
now i am woundering how to imlement it...
was trying with github.com/vafour/select2-sortable -> haven't got it running at all.
as i understood: i have to:
1. add jquery.multisortable to be used (not sure where to add it to be correct - to itemform.php or to be loaded on index.php?
2. create a button for sorting (done)
3. declare within the button event the event calling respective jquery function ($('ul').multisortable();?)
so far to the theory .. :)
now i am woundering how to imlement it...
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #121758
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Order tags in Add Article Form
Actually,
You have to use the select 2 script and then use that script. It won't work otherwise.
ivaynberg.github.io/select2/
I am not sure if extra coding is needed.
You can load it only on itemform if it is not needed elsewhere.
You have to use the select 2 script and then use that script. It won't work otherwise.
ivaynberg.github.io/select2/
I am not sure if extra coding is needed.
You can load it only on itemform if it is not needed elsewhere.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 4 months ago #121759
by webloesung
Replied by webloesung on topic Re: Order tags in Add Article Form
after 1 week of try - i gave up with js...
i think it will be also suitable for me to have the tags sorted within sql select query - in what core file of K2 can i find respective one that is used for showing the TAGs?
is it possible to use a "k2 modified files in /template/html/..." approach also for this core file?
Thanks
i think it will be also suitable for me to have the tags sorted within sql select query - in what core file of K2 can i find respective one that is used for showing the TAGs?
is it possible to use a "k2 modified files in /template/html/..." approach also for this core file?
Thanks
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
11 years 4 months ago #121760
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Order tags in Add Article Form
Unfortunately you have to backup each time before updating since these files cannot be overriden so this is not suitable solution either,
Have you tried php.net/sort ?
Have you tried php.net/sort ?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- webloesung
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 23
11 years 4 months ago #121761
by webloesung
Replied by webloesung on topic Re: Order tags in Add Article Form
after also trying the php sort function - without result..
i did a hack to K2 core file:
YOUR SITE/administrator/components/com_k2/models/item.php
in the function getAvailableTags
add $query .= " ORDER BY tags.name";
this is not a good solution, anyhow it is working..
However, it would be GREAT in some of future K2 versions to have the tags sorting function built into itemform.php....
i did a hack to K2 core file:
YOUR SITE/administrator/components/com_k2/models/item.php
in the function getAvailableTags
add $query .= " ORDER BY tags.name";
this is not a good solution, anyhow it is working..
However, it would be GREAT in some of future K2 versions to have the tags sorting function built into itemform.php....
Please Log in or Create an account to join the conversation.