eworkers / K2ForJ4

GNU General Public License v2.0
11 stars 6 forks source link

Tagging issue #50

Closed cmirnow closed 7 months ago

cmirnow commented 7 months ago

There is a new problem with tags after the latest K2ForJ4 update.

The problem does not always appear. Testing does not allow me to generalize the results. I can only report that on this page, clicking on either of the two tags (oops, oops) ends in an error:

0 - call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "k2_item_229_Category Product Combinations. Prestashop module_category-product-combinations-prestashop-module_tag_itemlist_Itemid_102_" not found or invalid function name

I was forced to revert to the previous version of K2ForJ4 and this hack. Now my blog is working correctly. But, if reproducing the error proves to be a problem, I can revert the error on the test platform.

cmirnow commented 7 months ago

Unfortunately, I was wrong. The error also appears in the old version of K2ForJ4.

P.S. After clearing the Joomla cache, the problem disappeared. But I think this bug needs to be solved by developers.

cmirnow commented 7 months ago

Screenshot_20240120_042544

eworkers commented 7 months ago

can you please enable system debug in joomla and share the error again?

cmirnow commented 7 months ago

Ok, no problem. I think you can see it here. This is a clean Joomla 4 test site.

The problem doesn't seem to affect the English language tags.

debug

eworkers commented 7 months ago

Thank you as always, since you have a local test environment, kindly test the following: in site/component/com_k2/views/itemlist/view.html.php please replace lines from 687 to 732 (between Table::getInstance('K2Category', 'Table'); and $items[$i]->hits = $hits;) with:

                    $args = array(array(
                        $itemModel,
                        'prepareItem'
                    ), $items[$i], $view, $task);
                    $callback = array_shift($args);
                    try{
                        $items[$i] = $cache->get($callback, $args);
                    } catch (\Exception $e) {
                        // for the moment settle to miss caching the query returned object
                        // throw new \Exception(Text::_($e), 500);
                    }

and test if your problem goes away, and also please test if additional problems arise by navigating as much as possible of k2 pages. Please make sure after the edit to clear your cache.

cmirnow commented 7 months ago

Thank you! I installed the latest version of K2ForJ4 and this hack on a live site. It seems to solve all the problems.

eworkers commented 7 months ago

fixed in 9d15df1 , thx to @cmirnow