Please read and follow the COMMON ISSUES first!
Always add your version information in every new post! Thank you!

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. KYC
  2. Form2Content Related article plugins
  3. Monday, 10 March 2014
  4.  Subscribe via email
Hi there,

I'm using F2C Content Pro, and found that the related article plugin (and the reverse one) a really really good tool that made Joomla a much better CMS! Just that I couldn't find a way to order the results generated ...

So, for example, I added 3 Students to a Class, and on the website it is shown as:
Student 1
Student 2
Student 3

While for some reasons I would like to order them as:
Student 3
Student 1
Student 2

Something like that. Looks like currently the generated results are ordered by ID - something that we could not update after creating the articles. I have looked at the plugin files, tried to make the results ordered by created date / published date / article order but no luck.

The same for the reverse plugin - I used multiselect database lookup, and there are arrows next to the selected records to change the order, however that doesn't affect the actual order shown on website.

So, may I ask are there any ways to change the order of the results generated by the related article (and reverse) plugin?

Thanks a lot!

F2C Pro version: 4.8.1
Joomla version: 2.5.18
Accepted Answer
Julien Accepted Answer Pending Moderation
Hi,

The plugin builds its data in a couple of steps. The step where you can do the ordering is the query with the comment "Load the forms we need to render" (the 2nd one).
When you add an order by clause to this query, your record output will be sorted according to that.

best,
Julien
Responses (7)
KYC Accepted Answer Pending Moderation
Hi Julien,

Great it works!! Thanks a lot!

Just one more question - is that possible to use the order on the lookup field itself? Since, after I've selected multiple list items from the drop-down menu of a Database lookup (multi-select) field, there are green up / down arrows that allow me to change the order of the list items. Think that will be a more natural way to change the actual order of the list items shown on website. If that's possible, may I ask what is the field name I should use for the query?

Thanks again!
Julien Accepted Answer Pending Moderation
Hi,

The item order is defined by the id field of the #__f2c_fieldcontent table.
When you order on this field, you will receive the values in the same order as the user defined them.

best,
Julien
Futuron Accepted Answer Pending Moderation
Julien wrote:

Hi,

The plugin builds its data in a couple of steps. The step where you can do the ordering is the query with the comment "Load the forms we need to render" (the 2nd one).
When you add an order by clause to this query, your record output will be sorted according to that.

best,
Julien


Can you please elaborate on this? I do not get how to order the relate article input. Do you have a example for this?

Regards,
Rob
Julien Accepted Answer Pending Moderation
Hi Rob,

What I mean is that the plugin retrieves the data in a couple of steps (queries).

When you want to change the ordering you can add that at the end of the query that starts with the comment line "Load the forms we need to render".

After the line

$query->where('frm.reference_id IN (' . $idString . ')');

you can add something like

$query->order('frm.title');

to order by the title for example.

best,
Julien
Mikhail Zoupas Accepted Answer Pending Moderation
Please can you provide an example where the results will be ordered by article-manager-order?

Thank you
Mikhail Zoupas Accepted Answer Pending Moderation
Pretty easy, found it in file

/plugins/content/f2c_related_articles/f2c_related_articles.php

added

$query->order('frm.ordering');

works like a charm
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.