Bienvenido, Invitado
Nombre de Usuario: Contraseña: Recordarme

TEMA: Article order not working

Article order not working 4 años 1 mes ago #20962

  • chrisjclay
  • Avatar de chrisjclay
  • Offline
  • Visitante
  • Mensajes: 5
  • Karma: 0
Hi,

I would like the articles to display with the most recent ones at the top, but the most recent ones are always at the bottom. I've tried changing the module's article order settings, but the articles always appear in the same order - oldest to newest. Any ideas? See the screen captures below.

Chris



El administrador ha desactivado la escritura pública.

Article order not working 4 años 1 mes ago #20965

  • JoniJnm
  • Avatar de JoniJnm
  • Offline
  • Administrador
  • Mensajes: 4579
  • Gracias recibidas 544
  • Karma: 160
Hi,

In Joomla Admin > Modules > mod_lca > disable cache.

And try. If still not working, with cache disabled open the file modules/mod_lca/helper.php
Search
$rows = $db->loadObjectList();
//add after
die($query."\n".print_r($rows, true));

Go to your website, where the module is published, you will see a debug log. Copy the source-code of that page and paste it here (in this post). The text is something like:
SELECT a.created AS co,  a.id, a.title, a.alias, a.catid, c.alias as calias FROM #__k2_items AS a LEFT JOIN #__k2_categories AS c ON c.id=a.catid WHERE (a.published = 1 ) AND (a.access=1 OR a.access=2) AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2014-04-13 08:54:11' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2014-04-13 08:54:11' ) AND c.published = 1 ORDER BY co desc LIMIT 150
Array
(
    [0] => stdClass Object
        (
            [co] => 2014-03-23 09:14:02
            [id] => 1
            [title] => Prueba
            [alias] => prueba
            [catid] => 1
            [calias] => cat1
        )
 
    [1] => stdClass Object
        (
            [co] => 2011-01-05 00:00:01
            [id] => 4
            [title] => Welcome to your blog
            [alias] => welcome-to-your-blog
            [catid] => 3
            [calias] => blog
        )
 
    [2] => stdClass Object
        (
            [co] => 2011-01-03 00:00:01
            [id] => 5
            [title] => About your home page
            [alias] => about-your-home-page
            [catid] => 3
            [calias] => blog
        )
 
    [3] => stdClass Object
        (
            [co] => 2011-01-02 00:00:01
            [id] => 7
            [title] => Your Template
            [alias] => your-template
            [catid] => 3
            [calias] => blog
        )
 
    [4] => stdClass Object
        (
            [co] => 2011-01-01 00:00:01
            [id] => 2
            [title] => About
            [alias] => about
            [catid] => 2
            [calias] => uncategorised
        )
 
    [5] => stdClass Object
        (
            [co] => 2010-12-31 00:00:01
            [id] => 6
            [title] => Your Modules
            [alias] => your-modules
            [catid] => 3
            [calias] => blog
        )
 
)

Then, change the order to asc, open the website again and copy&paste here

And delete the line added.
Última Edición: 4 años 1 mes ago por JoniJnm.
El administrador ha desactivado la escritura pública.

Article order not working 4 años 1 mes ago #20969

  • chrisjclay
  • Avatar de chrisjclay
  • Offline
  • Visitante
  • Mensajes: 5
  • Karma: 0
Hi,

I did as you said - here is the output from the two tests (first descending, then ascending).

Chris

--

SELECT a.created AS co, a.id, a.title, a.alias, a.catid, c.alias as calias FROM #__content AS a LEFT JOIN #__categories AS c ON c.id=a.catid WHERE (a.state = 1 ) AND (a.access=1 OR a.access=2) AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2014-04-16 06:25:47' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2014-04-16 06:25:47' ) AND c.published = 1 AND a.catid IN (113) ORDER BY co desc LIMIT 150 Array ( [0] => stdClass Object ( [co] => 2014-04-09 20:41:00 [id] => 347 [title] => 35th Annual THRASH Regatta at Royal Victoria Yacht Club [alias] => 35th-annual-thrash-regatta-royal-victoria-yacht-club [catid] => 113 [calias] => media-releases ) [1] => stdClass Object ( [co] => 2014-03-05 21:21:35 [id] => 348 [title] => Four Royal Victoria Yacht Club Sailors Win National Awards [alias] => four-royal-victoria-yacht-club-sailors-win-national-awards [catid] => 113 [calias] => media-releases ) [2] => stdClass Object ( [co] => 2014-02-24 21:39:14 [id] => 349 [title] => Royal Victoria Yacht Club General Manager Achieves Professional Certification [alias] => royal-victoria-yacht-club-general-manager-achieves-professional-certification [catid] => 113 [calias] => media-releases ) )

SELECT a.created AS co, a.id, a.title, a.alias, a.catid, c.alias as calias FROM #__content AS a LEFT JOIN #__categories AS c ON c.id=a.catid WHERE (a.state = 1 ) AND (a.access=1 OR a.access=2) AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '2014-04-16 06:27:06' ) AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '2014-04-16 06:27:06' ) AND c.published = 1 AND a.catid IN (113) ORDER BY co asc LIMIT 150 Array ( [0] => stdClass Object ( [co] => 2014-02-24 21:39:14 [id] => 349 [title] => Royal Victoria Yacht Club General Manager Achieves Professional Certification [alias] => royal-victoria-yacht-club-general-manager-achieves-professional-certification [catid] => 113 [calias] => media-releases ) [1] => stdClass Object ( [co] => 2014-03-05 21:21:35 [id] => 348 [title] => Four Royal Victoria Yacht Club Sailors Win National Awards [alias] => four-royal-victoria-yacht-club-sailors-win-national-awards [catid] => 113 [calias] => media-releases ) [2] => stdClass Object ( [co] => 2014-04-09 20:41:00 [id] => 347 [title] => 35th Annual THRASH Regatta at Royal Victoria Yacht Club [alias] => 35th-annual-thrash-regatta-royal-victoria-yacht-club [catid] => 113 [calias] => media-releases ) )
El administrador ha desactivado la escritura pública.

Article order not working 4 años 1 mes ago #20972

  • chrisjclay
  • Avatar de chrisjclay
  • Offline
  • Visitante
  • Mensajes: 5
  • Karma: 0
Also, I decided to create another version of the module so you can take a look.

This one has the order set to "Ascending":

rvyc.bc.ca/index.php?option=com_content&view=article&id=318&Itemid=922

... while this one has it set to "Descending":

rvyc.bc.ca/index.php/the-club/media-releases.html

As you can see, both are displaying the articles in the same order.

Chris
El administrador ha desactivado la escritura pública.

Article order not working 4 años 1 mes ago #20974

  • JoniJnm
  • Avatar de JoniJnm
  • Offline
  • Administrador
  • Mensajes: 4579
  • Gracias recibidas 544
  • Karma: 160
Hi,

I need more info.

If you want, you can send me in a PM one FTP account and Joomla Admin to see the problem soon.

If not, in helper.php, search
return $out;
//add before
die(print_r($out, true));

I need the output only for Desc module
El administrador ha desactivado la escritura pública.

Article order not working 4 años 1 mes ago #20978

  • chrisjclay
  • Avatar de chrisjclay
  • Offline
  • Visitante
  • Mensajes: 5
  • Karma: 0
Hi,

Here's the output with order set to DESC:

stdClass Object ( [articulos] => Array ( [2014] => Array ( [January] => Array ( ) [February] => Array ( [0] => Royal Victoria Yacht Club General Manager Achieves Professional Certification ) [March] => Array ( [0] => Four Royal Victoria Yacht Club Sailors Win National Awards ) [April] => Array ( [0] => 35th Annual THRASH Regatta at Royal Victoria Yacht Club ) [May] => Array ( ) [June] => Array ( ) [July] => Array ( ) [August] => Array ( ) [September] => Array ( ) [October] => Array ( ) [November] => Array ( ) [December] => Array ( ) ) ) [years] => Array ( [2014] => 3 ) [meses] => Array ( [2014] => Array ( [April] => 1 [March] => 1 [February] => 1 ) ) [lastyear] => 2014 )

Chris
El administrador ha desactivado la escritura pública.

Article order not working 4 años 1 mes ago #20979

  • JoniJnm
  • Avatar de JoniJnm
  • Offline
  • Administrador
  • Mensajes: 4579
  • Gracias recibidas 544
  • Karma: 160
Hi again,

In helper.php change
$monthsArray = $this->getMonths($this->params->get("o_month") == "desc");
//by
$descOrderForMonths = $this->params->get("o_month") == "desc" || ($this->params->get("o_month") == "off" && $this->params->get("o_article", "desc") == 'desc');
$monthsArray = $this->getMonths($descOrderForMonths);
El administrador ha desactivado la escritura pública.
Los siguientes usuarios han agradecido: chrisjclay

Article order not working 4 años 1 mes ago #20980

  • chrisjclay
  • Avatar de chrisjclay
  • Offline
  • Visitante
  • Mensajes: 5
  • Karma: 0
Thank you, it's working now :)
El administrador ha desactivado la escritura pública.
Tiempo de carga de la página: 0.288 segundos