Jump to content

Solved - Blocklayered navigation not working with cache active


Casper_O

Recommended Posts

I recently installed a new prestashop 1.6.1.0 and eveything was fine until i activated APC cache i found out that when i visited one category and wanted to use the layered navigation it will always return the same products, even if the category was supposed to be empty.

 

At first i Thought this could be a issue with my template, so i made a clean install and tested, with the same result.

 

 

Test case:

1. Clean prestashop install

2. activate SEO friendly URL and APC cache (or filesystem cache).

3. Visit "women" category. 7 articles are listed

4. Select "Tank tops" in block layered navigation, it says there is only 2 products but it continues to show all 7.

5. Go to "T-shirts" in top navigation, and you will still see the 7 products.

 

I have checked how blocklayered.php work and from what i can see it seems like it is have a cache of the productlist.tpl that i can not explain.

 

The category view works fine, if blocklayered is uninstalled, both with/without cache that i find pretty odd.

Edited by Casper_O (see edit history)
Link to comment
Share on other sites

HI Caspar,

 

Thanks for explaining the issues. I am also facing the same issue.

I am not able to reset and delete the Layered Navigation Module. Seems some entries stuck in the table. Do you have any idea to clean database entries related to Layered Navigation block.

 

Error While Reset in Layered Navigation block Module :- 2 errors 

  1. Cannot install this module.
  2. This module has already been installed.

I am not able to uninstall it also.

 

Regards:

Monil Gupta

Link to comment
Share on other sites

Not sure if the following approach will be the best solution, but it can fix your problem.

Edit your blocklayered module core file blocklayered.php

 

Find public function getProducts

 

Then add following script underneath global $cookie;

$cache = Cache::getInstance();
// Since this problem only happen with APC, flushing the cache only required if we've used APC or the activated caching system is APC
if (get_class($cache) == 'CacheApc')
    $cache->flush();
Link to comment
Share on other sites

HI Caspar,

 

Have you tried the code given by gonebdg. I am still getting the same error.Mean Same products showing in every category

https://dev.kitchenhues.in/77-herbs

https://dev.kitchenhues.in/164-biscuits

 

But when i uninstalled the Layered Navigation Module v2.1.0 , then the issue is solved.

 

First i though that it has catche issue , so i tried it on prestashop cloud with same settings and default theme but in that Layered Navigation Block is working fine and its filtering the correct results too.

http://kitchenhues.pswebstore.com/106-dal

 

Not sure about the issue. Please help.

 

Regards:

Monil gupta

9899551303

Link to comment
Share on other sites

Hello

 

I also found out that blocklayered does not work with file cache active, the kind you can activate at the bottom of the page, but works normally with the other kind of cache activated and also with ccc features

 

Another thing that does not work is the filters order, you can grab and drop the filters in a desired position, save and will work, you find the filter in the proper position in the category pages.

Unfortunately if you open again the blocklayered filter template the order will be lost and the default one will be retrieved, so if you want to change something you necessarily need to order the filters again before saving, which is an oddity.

 

A very funny stuff that happens when you move the filter position and drop it above the first filter in the grey border area is that the browser is redirected to the website www.dummy.com which is parked and "for sale".

 

That is very very funny, ridicule, the filter ordering system is gross, does not remember last saved positions, forces you to reorder everything each time you need to change something AND if you drop a filter on the frame border you are redirected nonetheless to www.dummy.com, really dummy behaviour.

 

Ahhha ha!

 

Hope prestashop team fix this, the dummy.com thing might be funny, but reordering all filters each time isn't at all, pretty bad stuff while you prepare the filter templates, if you are dealing with many filters you loose a lot of time also because it is not possible to do it with a number table or a easy light way as should be not to loose time anyway (even in the case it remembers the positions)

 

By the way, for the truth sake, when you succeed to have the layered navigation module properly working and placed in the centre column (if you have a lot of filters is more practical) it works really well and is a very useful service in all respects, you can spot out the proper product out thousands in a matter of few clicks, works well and fast, pity that you need to not forget even the smaller detail if you do not want to loose a lot of time just reordering the filters' positions.

 

Also another thing is that the page is rolled up to top if you open a dropdown menu and do not choose a value/feature, this makes you annoyed and loosing time, not a very terrible error but surely not nice behaviour, unfriendly toward the user (again this is evident when you use a lot of filters)

 

Bye

  • Like 2
Link to comment
Share on other sites

Yeah APC and filesystem cache works when layered navigation is not activated...

 

I did some testing yesterday that I plans to continue this morning, since I might have solved some parts of it. I successfully had APC active and showed only products from sub categories

Link to comment
Share on other sites

HI Casper,

 

You are right. I have activated APC catche and then face this issue : Same products in all categories.

But i dont have APC catche activated in the cloud shop, then Layered Navigation block is working fine.

 

http://kitchenhues.pswebstore.com/11-summer-dresses

 

I have also raised this issue in forge.prestashop.com one month back , but didnot get any response

http://forge.prestashop.com/browse/PNM-3532

 

Can you share the results if you found a fix for this issue .Thanks in advance.

 

Regards:

Monil Gupta

Link to comment
Share on other sites

I had a demo site running with memcached and no issue found.

When i've read this thread, i'm trying to use APC caching system for my Dev.Site on localhost using virtual machine, and indeed there is a problem with blocklayered.
And this problem also happen if we use File System for the caching system.
Not sure if this also happen if we use Xcache for the caching system.

Linux #40~14.04.1-Ubuntu
Apache
PHP Version 5.5.9-1
APCu Version 4.0.7
PrestaShop v.1.6.1.0
Blocklayered v2.1.0

So ... I'm thingking how to clear the cache when the blocklayered filter is use, then I found out that flushing the apc cache fix the problem, as described on my previous post above.
Basically it execute default php function to clear APC cache with apc_clear_cache()
//php.net/manual/en/function.apc-clear-cache.php

But flushing the cache is not work if we use File System for the caching system, but delete cache directory will fix the problem.
CacheFs::deleteCacheDirectory();

$cache = Cache::getInstance();
if (get_class($cache) == 'CacheApc')
    $cache->flush();
elseif (get_class($cache) == 'CacheFs')
    CacheFs::deleteCacheDirectory();

However as I said before that was just a quick fix, and may not the best solution.
Because flushing or deleting cache, remove the advantage from the use of the caching system itself eventhough it only for the blocklayered module.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Is this issue the same as when SMARTY-cache is turned on?

 

I am having strange issue when i turn on SMARTY-cache that on the main page that [New Arrivals] tab hides the products. If i disable SMARTY-cache then it works.

 

So my question @gonebdg: will your "fix" benefit my issue as well?

 

Frank

Link to comment
Share on other sites

  • 1 month later...

I had a demo site running with memcached and no issue found.

 

When i've read this thread, i'm trying to use APC caching system for my Dev.Site on localhost using virtual machine, and indeed there is a problem with blocklayered.

And this problem also happen if we use File System for the caching system.

Not sure if this also happen if we use Xcache for the caching system.

Linux #40~14.04.1-Ubuntu
Apache
PHP Version 5.5.9-1
APCu Version 4.0.7
PrestaShop v.1.6.1.0
Blocklayered v2.1.0

So ... I'm thingking how to clear the cache when the blocklayered filter is use, then I found out that flushing the apc cache fix the problem, as described on my previous post above.

Basically it execute default php function to clear APC cache with apc_clear_cache()

//php.net/manual/en/function.apc-clear-cache.php

 

But flushing the cache is not work if we use File System for the caching system, but delete cache directory will fix the problem.

CacheFs::deleteCacheDirectory();

$cache = Cache::getInstance();
if (get_class($cache) == 'CacheApc')
    $cache->flush();
elseif (get_class($cache) == 'CacheFs')
    CacheFs::deleteCacheDirectory();

However as I said before that was just a quick fix, and may not the best solution.

Because flushing or deleting cache, remove the advantage from the use of the caching system itself eventhough it only for the blocklayered module.

 

Any idea what the code would be if I'm using xcache? Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...