Keyword

K2 pagination doesn't show (hint: it's related to Falang)

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 2 weeks ago #174543 by Fotis
Fotis replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
@Bouey Thanks for joining us. Really appreciate it.

This is actually the recommend MySQL/MariaDB way for paginated data. Instead of doing 2 queries for the same thing, we only run a one for everything and second one which basically grabs the count from the first one. Since this is highly tied to performance (as K2 is used in some very large projects), I cannot revert any changes.

Additionally, since I'm leaning towards decoupling third-party integrations from K2 (to make development more flexible to be honest), I'd like to explore the possibility of having some else support Falang in K2, as a plugin. If it's technically possible on your side, would you be interested in that?

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Pablo Torres LLamas
  • Pablo Torres LLamas's Avatar
  • Offline
  • New Member
More
2 months 2 weeks ago #174552 by Pablo Torres LLamas
Pablo Torres LLamas replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Using falang and having the same problem. I hope @Bouey can find a solution. Thank you.

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #174553 by Bouey
Bouey replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Yes i'm still on a solution.
@Fotis the SQL_CALC_FOUND_ROWS is a nice system but for performance a select count(*) is better

Se here some test:
www.percona.com/blog/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/

Stéphane

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 2 weeks ago #174555 by Fotis
Fotis replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Stéphane, the link from Percona is very old. If you skim through the more recent comments, you'll see that users report different results.

And this is from the MySQL manual:
"If you are using SELECT SQL_CALC_FOUND_ROWS, MySQL must calculate how many rows are in the full result set. However, this is faster than running the query again without LIMIT, because the result set need not be sent to the client."

Since I happen to manage some of the highest traffic Joomla sites worldwide (dozens of millions of page views per month each), this change did wonders to performance. So it's been measured in production.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #174584 by Vitaliy
Vitaliy replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Good day. The problem was solved by installing the old version of K2 2.9.0 on top of K2 2.10.2. And Yes, the problem is a conflict between the new version 2.10.2 and the faLang component.

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago - 2 months 1 week ago #174586 by Bouey
Bouey replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Hi,

i have a solution but need a small change in k2 file components/com_k2/models/itemlist.php line 338
<?php

if (count($rows)) {
    //sbou
    $falang_driver = Joomla\CMS\Plugin\PluginHelper::getPlugin('system', 'falangdriver');
    if (!empty($falang_driver)) {
        $db->setQuery($query, $limitstart, $limit);
        $db->loadResult(false);
        $db->setQuery('SELECT FOUND_ROWS();');
        $this->getTotal = $db->loadResult(false);

        return $rows;
    }
    //sbou

    $db->setQuery('SELECT FOUND_ROWS();');
    $this->getTotal = $db->loadResult();
}

if the falang driver is enabled the query is resend without asking for translation (probably use mysql cache) and the getTotal is set correctly
Last edit: 2 months 1 week ago by Fotis.

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 1 week ago - 2 months 1 week ago #174593 by Fotis
Fotis replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Stéphane, according to your site, Falang supports both Joomla 2.5 and 3.x. So I changed "Joomla\CMS\Plugin\PluginHelper" to "JPluginHelper" just in case.

Your changes have been merged: github.com/getk2/k2/commit/2127cf6f2ef8ad9a668ad2f7382f8c393d9fcdc8

By the way, since I had not committed the original code for either Joomfish or Falang myself, searching the K2's codebase for Falang I only found references in the itemlist.php model (the file you also edited). Have you had a look overall?

===

For anyone who wishes to try the updated version, please install K2 v2.10.3 (dev) from: getk2.org/downloads/?f=K2_Development_Release.zip

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member
Last edit: 2 months 1 week ago by Fotis.

Please Log in or Create an account to join the conversation.

More
2 months 1 week ago #174596 by Bouey
Bouey replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Hi Fotis, it's seem only this change is enought .

i will look deeper monday.

Stéphane

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
2 months 1 week ago #174597 by Fotis
Fotis replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Thank you Stéphane.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

More
1 month 4 days ago #174991 by ALBERTO SCOZZARO
ALBERTO SCOZZARO replied the topic: K2 pagination doesn't show (hint: it's related to Falang)
Hi Stéphane,
Any news about this? I'm still not seeing the pagination once the plugin is enabled.
Thanks...

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum