News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

[SOLVED] Bug with clear cat cache. Didn't clean com_virtuemart_cat_childs

Started by ServeTT, November 22, 2016, 07:30:26 AM

Previous topic - Next topic

ServeTT

Hello!
PHP 5.6
Installed Joomla 3.6.4 + virtuemart 3.0.18.4 Blue Corvus 9383. Nothing else.
Standart template without changes. All Joomla and VM settings are default after clean install.

Noticed a bug in administrator/components/com_virtuemart/models/category.php
Method clearCategoryRelatedCaches, line 651.
After creating new category, com_virtuemart_cat_childs didn't delete.
Chaged the code to

$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');


Now everything works fine!)
My category.php is in attachment in zip archive.

Thanks to author - Studio 42 (https://forum.virtuemart.net/index.php?topic=129548.msg445864#msg445864)

Milbo

Any idea, why it does not work with $cache = JFactory::getCache(); ?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ServeTT

Quote from: Milbo on November 22, 2016, 09:10:32 AM
Any idea, why it does not work with $cache = JFactory::getCache(); ?
I don't know for sure, but maybe specify $storage in  JFactory::getCache(), because it is null by default.
I found this code on this forum and tried it and it worked)
Forgot to write about the author, sorry, fixed first post

Milbo

I think now it is the
'cachebase'      => $conf->get('cache_path', JPATH_SITE . '/cache')

because we are in the BE and want to delete a cache in the FE.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ServeTT

Quote from: Milbo on November 22, 2016, 14:04:29 PM
I think now it is the
'cachebase'      => $conf->get('cache_path', JPATH_SITE . '/cache')

because we are in the BE and want to delete a cache in the FE.

Will You release VM 3.0.18.5 with that fix??

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/


Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/


Milbo

Nice that we got that sorted, finally. I think you took the code idea from Patrick, btw. I think the reason is a difference in joomla 2 and joomla3. When I check my j2.5, then there is a cache folder in the administrator folder, but no files (except the index.html). But in joomla 3 I see there files. So it seems that they fixed or added the feature of different cache folders per application (FE oder BE). And this lead to trouble, when we try to delete a cache of the FE, while in the BE. I wonder also if it makes sense to controll the options always, even when just use the cache.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

ServeTT

Quote from: Milbo on November 23, 2016, 08:17:02 AM
Nice that we got that sorted, finally. I think you took the code idea from Patrick, btw. I think the reason is a difference in joomla 2 and joomla3. When I check my j2.5, then there is a cache folder in the administrator folder, but no files (except the index.html). But in joomla 3 I see there files. So it seems that they fixed or added the feature of different cache folders per application (FE oder BE). And this lead to trouble, when we try to delete a cache of the FE, while in the BE. I wonder also if it makes sense to controll the options always, even when just use the cache.
Yes, I wrote about it in my first post, at first forgot about it, then gave a link to his original post.
I have site on J2.5 and VM2 - and there is OK, in VM3 and J3 it is my first)