News:

Looking for documentation? Take a look on our wiki

Main Menu

Category Cache Problem VM 3.0.8

Started by micpic, April 21, 2015, 09:48:58 AM

Previous topic - Next topic

micpic

Hello,

we are new in VM and learn the last 14 days much of the functionality. But now we have a major Problem
for us.

If we generate a new category over the Administrator Backend we see the category in the Joomla VM BAckend
but it is dont visible in the frontend for any times.
We disable all of joomla abd Template cache and disable the cache in the VM category modul too.
After five minutes we can see our Category changes in the frontend

We work with the "GAVICK shop an Buy" VM Template

We check this Issue in the Joomla Beeze Templates too wit the same result. And yes we look into the forum and find many entrys for caching problems with VM, but never fix it
or we dont find it.

We are very glad you can see us a way to fix this problem.

System: Joomla 3.4.1
VM: 3.8.0
PHP: 5.4.29

Best Regards
Michael



GJC Web Design

It isn't a problem as such - it is the way it works

caching of the cats gives a huge speed improvement to a client browsing

if you want to clear the cache after a cat change simply go -> Joomla admin->system->clear cache
you will see the vm cats cache - com_virtuemart_cats - delete
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

micpic

Oh no,

iam so sorry. we disabled all of cache functions into to system and this is the reason that we ar dont take a look into the system cache.

OK now we see VM is writing into the system cache anytime.

Many thanks for your fast help.

Michel

Studio 42

#3
it would be so simple to clear the know cache in the model when recording a category :

$conf = JFactory::getConfig();
$options = array(
'defaultgroup' => 'com_virtuemart_cats',
'cachebase' => $conf->get('cache_path', JPATH_SITE . '/cache');

$cache = JCache::getInstance('callback', $options);
$cache->clean();
// mod product
$options['defaultgroup'] = 'mod_virtuemart_product';
$cache = JCache::getInstance('callback', $options);
$cache->clean();
// mod category
$options['defaultgroup'] = 'mod_virtuemart_category';
$cache = JCache::getInstance('callback', $options);
$cache->clean();

But this must be approved by the main developer.

Milbo

Patrick, you are really .... unbelievable.
Please stop the permanent accusations and bitching. It is really genioius to go in our config model and copy line 458-472. Constructive would be to provide a patch adding exactly the missing line to the category model. If you would be willing to help and not just show how great you are and how dumb we are, you would get the fact that the cache is cleaned at 4 different places in the config model. So the question is not how todo that, the question is why it does not work for them as expected.
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

Quote from: micpic on April 21, 2015, 09:48:58 AM
And yes we look into the forum and find many entrys for caching problems with VM, but never fix it

That does not mean it is not fixed. Yesterday I tried to find any post with "cant store product" which happened due an update to j3.4.1. It is fixed. There are more than 20 threads about it. 95% of them were created AFTER the fix was already released! So it is very likely the same here. There are none known problems with caching left.


Quote from: micpic on April 21, 2015, 09:48:58 AM
VM: 3.8.0
vm3.0.8 please :-)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

First, i never said you are dumb,
second this is a proposal, not a final patch.

And i tried this, but the problem in Joomla is that when the cache is not active, my patch does not work, but this solve the problem for mod_category and mod_product(for alias).
In all case the current problem is Joomla cache system not virtuemart.
I don't understand. You don't want to find a solution ?

Studio 42

This is a real working solution :
JOOMLAROTH/administrator/components/com_virtuemart/models/category.php
in public function store(&$data) { insert

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


this work when joomla cache is active or not. tested in Joomla 3.4

Milbo

Looks good Patrick. I have to dig through it again, but

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

is an idea. I must also first check if it is j3 problem only.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

I checked in com_cache model to find how joomla dev have do this.
In Joomla 2.5, the code is same as in joomla 3.4, this mean the code is certainly safe.

Studio 42

#10
same code for config model clean cache

$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('com_virtuemart_rss');
$cache->clean('com_virtuemart_cat_manus');
$cache->clean('convertECB');
$cache->clean('_virtuemart');
$cache->clean('com_plugins');
$cache->clean('_system');
$cache->clean('page');
$cache->clean('mod_virtuemart_product');
$cache->clean('mod_virtuemart_category');


But the config, is not so important.

for manufacturer model in public function store(&$data) {
$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_cat_manus');


franzpeter

@Studio 42
I did try to implement your patch in case of categories. With J 2.5 it does not work. I receive error message. In case of J 3 it is completely ignored. So by default seems to be useless. Is it a solution for an non existing problem? I do not know what was wrong with the caching before. I can delete the cache via Joomla in J 2.5 and J 3.4.1. It is recreated if going to the FE. If  - in case of the category module - the caching is set to none in BE, there will be no cache. So I do not understand exactly that solution. There is no problem and you write something for a non existing problem.

Studio 42

Hi,
Virtuemart always force the cache for the category aliases.

But the fix is when you save the category not after. But why you have to change the aliases after saving, because this have to be correct if you don't do any change in Back end.

I tested the patch, perhaps you have do a mistake on copy/paste ?

Greets,

Patrick

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/

Studio 42

#14
This is exactly what i have in file administrator\components\com_virtuemart\models\category.php in the store function :

    public function store(&$data) {

vRequest::vmCheckToken();

$table = $this->getTable('categories');

if ( !array_key_exists ('category_template' , $data ) ){
$data['category_template'] = $data['category_layout'] = $data['category_product_layout'] = 0 ;
}
if(VmConfig::get('categorytemplate') == $data['category_template'] ){
$data['category_template'] = 0;
}

if(VmConfig::get('categorylayout') == $data['category_layout']){
$data['category_layout'] = 0;
}

if(VmConfig::get('productlayout') == $data['category_product_layout']){
$data['category_product_layout'] = 0;
}

$table->bindChecknStore($data);

if(!empty($data['virtuemart_category_id'])){
$xdata['category_child_id'] = (int)$data['virtuemart_category_id'];
$xdata['category_parent_id'] = empty($data['category_parent_id'])? 0:(int)$data['category_parent_id'];
$xdata['ordering'] = empty($data['ordering'])? 0: (int)$data['ordering'];

    $table = $this->getTable('category_categories');

$table->bindChecknStore($xdata);

}

// Process the images
$mediaModel = VmModel::getModel('Media');
$file_id = $mediaModel->storeMedia($data,'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');

return $data['virtuemart_category_id'] ;
}


When i disable the cache in Joomla, all this 3 folders com_virtuemart_cats, mod_virtuemart_product, mod_virtuemart_category are removed and if i enable the cache this work same.
Of course, at the moment you refresh a page in the front, the  com_virtuemart_cats folder are regenerate, because this cache is forced in virtuemart.
I don't try to solve the foced cache problem, but my problem was that on saving a category, this was not refreshed in the 3 core caches using categories.
P.S: this fix is running on my test server without any error in my error log seens 4 days now.