I checked a site which has 15 categories and ~170 subcategories. Lately it is super slow, it takes 8-12 seconds to load a simle page.
I checked the modules and the code and found that if I disable my category module it becomes much faster.
After that i checked a source line by line and found this line in the template:
$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$child->virtuemart_category_id);
If I remove it or change it to $caturl = JRoute::_(''); the site is fast. When I put it back, the site is slow.
It was okay until I updated VM few weeks back. Now it's running the very latest "beta" 3.2.3.9624
I couldn't find the solution, any clue maybe, somebody? Maybe something changed around the router?
You can check yourself the changes, here http://dev.virtuemart.net/projects/virtuemart/repository/changes/branches/com_virtuemart.3.0.12.4/components/com_virtuemart/router.php
Which version was the fast one?
#9579 is fast, #9610 is slow
I moved back to 9579
There is this function
<?php
public static function getLimitByCategory($catId, $view = 'virtuemart'){
static $c = array();
if(empty($c[$catId][$view])){
$catModel = VmModel::getModel('category');
$cat = $catModel->getCategory($catId);
//vmdebug('getLimitByCategory '.$cat->limit_list_initial);
if(!empty($cat->limit_list_initial)){
$initial = $cat->limit_list_initial;
vmdebug('limit by category '.$view.' '.$catId.' '.$cat->limit_list_initial);
} else {
$initial = VmConfig::get('llimit_init_FE', 24);
}
$app = JFactory::getApplication();
$c[$catId][$view] = $app->getUserStateFromRequest('com_virtuemart.'.$view.'.limit', 'limit',$initial, 'int');
}
self::$limit = $c[$catId][$view];
return self::$limit;
}
?>
Please try the last version and replace the function by
<?php
public static function getLimitByCategory($catId, $view = 'virtuemart'){
self::$limit = $c[$catId][$view];
return self::$limit;
}?>
Looks like that is slowing down the shop. When yes, I can add a config or so. It is just for the feature "different pagination size (limit) per category", which is imho a feature, which is quite rarely used. I thought it wouldnt be a big deal, because it should use anyway already cached categories. But yes on a frontpage, showing productsd of very different categories, it creates a problem.
or maybe it is even better and easier to disable line 87.
yep, that was the solution
@Max : Why you don't get limit from category directly on load and compare with session ?
And you set self::$limit as global value, but you never know from what category id is set.
Quote from: sandomatyas on August 22, 2017, 12:31:03 PM
yep, that was the solution
To disable line 87?, because that would be the best. I just wonder anyway if we need it.
Quote from: Milbo on August 22, 2017, 20:28:38 PM
Quote from: sandomatyas on August 22, 2017, 12:31:03 PM
yep, that was the solution
To disable line 87?, because that would be the best. I just wonder anyway if we need it.
Yes.
Do you think "different pagination size (limit) per category"? I think I was who asked for it :) I have two customers who need this function
Quote from: sandomatyas on August 22, 2017, 21:16:15 PM
Quote from: Milbo on August 22, 2017, 20:28:38 PM
Quote from: sandomatyas on August 22, 2017, 12:31:03 PM
yep, that was the solution
To disable line 87?, because that would be the best. I just wonder anyway if we need it.
Yes.
Do you think "different pagination size (limit) per category"? I think I was who asked for it :) I have two customers who need this function
This have no sense to be get or set in the router else VM do not work same with or without (SEF)router