Page 1 of 1

[solved]CGBlog sort by 'cgblog_extra' and then by descending

Posted: Thu Mar 27, 2014 2:51 pm
by Evoken
Is there a way to first sort articles by the extra field and then by the descending date? I have several snippets like this on the site:

Code: Select all

{CGBlog category='Mercado' number='1' summarytemplate='summary_quarter' sortby='cgblog_extra'}
This is done so that by putting '1' into the extra field the article is diplayed on the homepage as a featured article (can't use a separate category for it for several reasons).

The issue with this is that the module sorts the articles by the extra field and then by the ascending date. So when two articles have 1 in the extra field, the module shows the oldest one as oppsoed to the newest. I've tried using 'sortorder=desc' or 'sortasc=false' and it doesn't works. In the module options I have Default Sorting set to Article Date and Default Sortorder set to Descending.

Any help is appreciated, versions I am using...

CMSMS 1.11.8
CGBlog 1.10.3

Re: CGBlog sort by 'cgblog_extra' and then by descending dat

Posted: Thu Mar 27, 2014 3:44 pm
by velden
Not solution but work around:

Remove the number parameter, remove the sortby parameter.

In your CGBlog summary template for the homepage:

Check for value 1 in extra field. Only if you find it, show the article and then break the foreach loop.

Not as efficient as proper sorting and number parameter but it should work.

Re: CGBlog sort by 'cgblog_extra' and then by descending dat

Posted: Mon Mar 31, 2014 6:47 pm
by Evoken
Thanks velden!
I did it as you suggested and it worked nicely.