VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: ServeTT on November 21, 2016, 20:18:53 PM

Title: [SOLVED] Categories don't show in frontend immediately after add
Post by: ServeTT on November 21, 2016, 20:18:53 PM
Hello to everybody.

PHP 5.6.
Installed Joomla 3.6.4 + virtuemart 3.0.18.4 Blue Corvus 9383. Nothing else.
Site url - http://of.sabil.studio/index.php/test-categories
I can give access to admin panel, if You will need.

The proplem is that I create categories in admin panel, but in in frontend they appears after some minutes. Standart Joomla template after clean install, no changes.
In backend-everything is ok, but in fronted they appears after 5-7 minutes after, I did't change anything in Joomla settings.
Spent 3 hours (clean installed different older versions of Joomla and older versions of VM - same problem, no chages to templates and settings), but I can't understand - what I am doing wrong??
Sorry for maybe a stupid question, but I can't understand it( It is not my first site, but first such situation((
I hope very much for your help
Thank You!
Title: Re: Categories don't show in frontend immediately after add
Post by: Milbo on November 21, 2016, 20:43:04 PM
When it would be longer, I would think that you activated the joomla cache. Work first without activated cache.

It can also be your server cache, or your browser cache.
Title: Re: Categories don't show in frontend immediately after add
Post by: ServeTT on November 21, 2016, 20:54:23 PM
Quote from: Milbo on November 21, 2016, 20:43:04 PM
When it would be longer, I would think that you activated the joomla cache. Work first without activated cache.

It can also be your server cache, or your browser cache.
Joomla cache is off, I didn't chage any settings, that are by default.
Tried on different browsers - same result(
Title: Re: Categories don't show in frontend immediately after add
Post by: GJC Web Design on November 21, 2016, 21:08:46 PM
VM cats are natively cached .. try creating a cat - then clear Joomla cache then check frontend

most users install the System - Regular Labs - Cache Cleaner plugin
Title: Re: Categories don't show in frontend immediately after add
Post by: ServeTT on November 21, 2016, 21:16:58 PM
Quote from: GJC Web Design on November 21, 2016, 21:08:46 PM
VM cats are natively cached .. try creating a cat - then clear Joomla cache then check frontend

most users install the System - Regular Labs - Cache Cleaner plugin

Clearing Joomla cache helped, thanks, but cleaning cache after every new category is not comfortable((
I have other site on J2.5 and VM2 - and there everything is ok with categories withou cache cleaning.
Title: Re: Categories don't show in frontend immediately after add
Post by: ServeTT on November 21, 2016, 21:39:55 PM
Turned off cache in the VM category module Basic Options
In administrator/components/com_virtuemart/models/category.php found method to clear the cache but it isn't working correctly, as I think, because com_virtuemart_cat_childs is not clearing.

I modified it

public function clearCategoryRelatedCaches(){
$cache = JFactory::getCache();
$cache->clean('com_virtuemart_cats');
$cache->clean('com_virtuemart_cat_childs');
$cache->clean('mod_virtuemart_product');
$cache->clean('mod_virtuemart_category');
     
              $conf = JFactory::getConfig();

$options = array(
'defaultgroup' => '',
'storage' => $conf->get('cache_handler', ''),
'caching' => true,
'cachebase' => $conf->get('cache_path', JPATH_SITE . '/cache')
);
$cache = JCache::getInstance('', $options);
$cache->clean('com_virtuemart_cats');
$cache->clean('mod_virtuemart_product');
$cache->clean('mod_virtuemart_category');
              $cache->clean('com_virtuemart_cat_childs');
}


I didn't look the docs in Joomla API for cache, maybe some things are duplicating, but it works for me!)
Title: Re: Categories don't show in frontend immediately after add
Post by: jenkinhill on November 21, 2016, 23:26:05 PM
Quote from: ServeTT on November 21, 2016, 21:16:58 PM
cleaning cache after every new category is not comfortable((

Then install https://www.regularlabs.com/extensions/cachecleaner  - it automatically clears the cache whenever something is saved.
Title: Re: Categories don't show in frontend immediately after add
Post by: GJC Web Design on November 21, 2016, 23:30:15 PM
Quotecleaning cache after every new category is not comfortable((

and also isn't necessary .. the cache will clear when it expires and they will be visible - whats the rush?
Title: Re: Categories don't show in frontend immediately after add
Post by: ServeTT on November 22, 2016, 07:34:20 AM
Quote from: jenkinhill on November 21, 2016, 23:26:05 PM
Quote from: ServeTT on November 21, 2016, 21:16:58 PM
cleaning cache after every new category is not comfortable((

Then install https://www.regularlabs.com/extensions/cachecleaner  - it automatically clears the cache whenever something is saved.

Thank You!
But I think that there is a bug in clearCategoryRelatedCaches, because there is a code in core to clear the cache, but it didn't work, I provided bug-report with my fix
http://forum.virtuemart.net/index.php?topic=136075.0

Quote from: GJC Web Design on November 21, 2016, 23:30:15 PM
Quotecleaning cache after every new category is not comfortable((

and also isn't necessary .. the cache will clear when it expires and they will be visible - whats the rush?
It is not comfortable to wait some minutes to see new categories and as I wrote above - there is a method to clean a cache in VM core, that didn't clean com_virtuemart_cat_childs (http://forum.virtuemart.net/index.php?topic=136075.0)
Title: Re: Categories don't show in frontend immediately after add
Post by: ServeTT on November 23, 2016, 10:49:10 AM
Bug is fixed in 3.0.18.5
Mark this as SOLVED