Jump to content

[SOLVED] ps_categoryproducts caches translation on shop change


maersk

Recommended Posts

The prestashop module ps_categoryproducts doesn't refresh translations/currency when the shop/language is changed. If loaded in english it stays in english. When changing the language afterwards to e.g. german, it still displays in english. When i delete the modules cache it resets as it should. Why am i having this problem?

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

To anyone looking for a solution, here it is:

In the modules main file ps_categoryproducts.php search for the variable cache_id

dump0.JPG.f8edab9455fa7acdaad8ec4178c6b14f.JPG

As you can see, the cache id for some reason doesn't take the current language/store into account.

To fix this, simply add another dimension by adding the current shop id obtained with $this->context->shop->id

dump1.JPG.43f62d96d907d979e9c87cecf0a5d3b9.JPG

Now every category product template is being cached for each shop.

Link to comment
Share on other sites

  • 5 weeks later...

Hi, i've the same problem with PS 1.7.2 and i've resolved in a different way.

 

In file /themes/MYTHEME/modules/ps_categoryproducts/views/templates/hook/ps_categoryproducts.tpl i've changed this ->

d='Modules.Categoryproducts.Shop'

into this -->

d='Shop.Theme.Catalog'

In this way, I can tranlsate this word in my template translations.

Link to comment
Share on other sites

  • 4 months later...
  • 2 months later...
  • 3 weeks later...

After several tests the right fix is to use the native Prestashop cache method. So don't change like above. Juste change in file modules/ps_categoryproducts/ps_categoryproducts.php  at line 349:

                'cache_id' => $cache_id,

by

                'cache_id' => $this->getCacheId($cache_id),

This solve all cache issues with this module. Don't forget to clear cache.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 2 years later...
  • 6 months later...

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...