Prestashop: [BOOM-5444] Smarty cash enabled - translation problem with "other products in the same category"

Created on 22 Aug 2018  路  32Comments  路  Source: PrestaShop/PrestaShop

This issue has been migrated from the Forge. Read the original ticket here.

  • _Reporter:_ fortuna
  • _Created at:_ Sat, 28 Apr 2018 11:36:32 +0200

When smarty cash enabled, switching between different languages, on product page, is not workin correctly - "other products in the same category" translation is not working.

For example. If we are on English version of page (exactly on product page), we see correct title "other products in the same category".

If we are switching language to other, for example Russian, we got Russian version of page BUT the title "other products in the same category" stay in English and, if we click on someone product under the title "other products in the same category", we will be redirected to English version of page.

This bug is only when CASH SMARTY ENABLED.

  • How to reproduce the issue ?

Smarty Cash must be enabled

1.7.3.1 1.7.4.2 Bug Category products FO Fixed International Translations

Most helpful comment

This bug was from 1.7. the big problem with prestashop is this, minor bug still not be resolved after month or year. somewhere you dont take account of id_lang when get cache content , we will wait for a bug fix, maybe when a new release is out with other bug so we are at the begin

All 32 comments

This comment has been migrated from the Forge. Read the original comment here.

  • _Author:_ khouloud.belguith
  • _Created at:_ Mon, 30 Apr 2018 11:11:41 +0200

Hi Mark,

Thanks for your report.
I manage to reproduce the issue with the last version 1.7.3.1 and the ps_categoryproducts module v1.0.2.
We will see how to fix it.

Best regards, Khouloud

This comment has been migrated from the Forge. Read the original comment here.

  • _Author:_ fortuna
  • _Created at:_ Tue, 5 Jun 2018 15:39:29 +0200

Any news? When it can be resolved?

This comment has been migrated from the Forge. Read the original comment here.

  • _Author:_ khouloud.belguith
  • _Created at:_ Tue, 5 Jun 2018 15:42:11 +0200

Hi Mark,

sorry, not yet.
There are some major issues to solve before this one.
So, it will probably not solved right now.
But PrestaShop is an open source project, so it can be solved before if someone submits a pull request to solve it.

Best regards, Khouloud

Same problem here. Can't figure out why this is happening... Looking forward for a solution!

Hi @coisasuteis,

This issue is added to our bug roadmap.
PrestaShop is an open source project, so it can be solved before if someone submits a pull request to solve it.

Best regards, Khouloud

This bug was from 1.7. the big problem with prestashop is this, minor bug still not be resolved after month or year. somewhere you dont take account of id_lang when get cache content , we will wait for a bug fix, maybe when a new release is out with other bug so we are at the begin

i'm not a programmer, 15 minutes on search on google, first try i'm wrong in template because FO use the "featured-products" that make me wrong (and i've never found an option to debug front office template like magento has). Next found the right file to change:

/modules/ps_categoryproducts/ps_categoryproducts.php

FIND

`if (!empty($id_product) && !empty($id_category)) {

        $cache_id = 'ps_categoryproducts|'.$id_product.'|'.$id_category;

        return array(
            'id_product' => $id_product,
            'id_category' => $id_category,
            'cache_id' => $cache_id,
        );
    }`

REPLACE WITH

`if (!empty($id_product) && !empty($id_category)) {

        $cache_id = 'ps_categoryproducts|'.$this->context->language->id.'|'.$id_product.'|'.$id_category;

        return array(
            'id_product' => $id_product,
            'id_category' => $id_category,
            'cache_id' => $cache_id,
        );
    }`

THE GOAL IS HERE

'ps_categoryproducts|'.$this->context->language->id.'|'.$id_product.'|'.$id_category;

.$this->context->language->id.

Its crazy that a software like prestashop that make MILLIONS DOLLAR in selling 3rd part module has no developer ready to fix a bug affecting the last 5 major release of the software.

HOW TO ADD THE FIX ON THE RELEASE?

@khouloudbelguith

Hi @matteolavaggi,

Thanks for your fix.
Would you be willing to make a pull request on GitHub with your code suggestion?
https://github.com/PrestaShop/ps_categoryproducts
you can follow this link: https://github.com/PrestaShop/PrestaShop#contributing
Thank you!

@matteolavaggi The real fix will be to replace
$cache_id = 'ps_categoryproducts|'.$id_product.'|'.$id_category;
By
$cache_id = $this->getCacheId('ps_categoryproducts|'.$id_product.'|'.$id_category);

Because Module::getCacheId() add language id and other important keys to the $cache_id

i've made a pull request, but i dont know if its right, can you check please? i'm not a github user.
https://github.com/PrestaShop/PrestaShop/pull/10989
@Matt75 i'm not a developer, if you find a better solution i'm happy to integrate ^^ thanks

@Matt75

Would you be willing to make a pull request on GitHub with your code suggestion?
Thanks!

@matteolavaggi @khouloudbelguith I will check my fix and make a pull request on ps_categoryproducts repository ;)

This issue still reflects on my website although the code has been changed.
Any tips are appreciated.
Thanks in advance.

screenshot

Hi @rufusmaika,

I did not manage to reproduce the issue with PS1.7.5.0 & the ps_categoryproducts v1.0.4.
I attached a video record.
https://drive.google.com/file/d/1rsTbYiXI_E1suRZkkAZ6xxJ4ZinmEOWo/view
Thanks!

Hi @khouloudbelguith,
Thanks for your input.
I could see that in your video there is no issue, although in my shop there is an issue.
What do you think it might be the issue in my case?
Thanks in advance.

@rufusmaika, you need to check the version of your ps_categoryproducts module, this issue is fixed with this PR: https://github.com/PrestaShop/ps_categoryproducts/pull/6
Thanks!

@khouloudbelguith
My module version is v1.0.4
Thanks

@rufusmaika, could you please try to uninstall it with deleting the module folder, clear cache & try to install it again.
Thanks!

@khouloudbelguith
I have uninstalled the module and clicked to delete the module folder, cleared the cache.
Trying to upload the zip file downloaded from github.
When uploading the zip file it says the following error:
This file does not seem to be a valid module zip

Am i missing something ?

Thanks.

@rufusmaika, you need to clone it then compress it.
Thanks!

@khouloudbelguith , Done.
Cloned it and compressed and installed nicely.
The problem still occurs.
http://www.testing.ppmodelismo.com/en/kyosho-inferno-st-rr-evo-2-gp-4wd-1-8-truggy-K33004/p328

This is really strange.
Thanks

@khouloudbelguith
If i disable the smarty cache it works.
presta

@khouloudbelguith

Hi,

I've same problem.
Why close this issue ?

ps: my shop is in 1.7.5.1 version

LOL, this is tipically :P issue present in the last 4 software relase :P closed....

@khouloudbelguith

Hi,

I've same problem.
Why close this issue ?

ps: my shop is in 1.7.5.1 version

Hi, this issue has been identified and fixed by PR https://github.com/PrestaShop/ps_categoryproducts/pull/6. This is why we closed the issue. The issue is not linked with prestashop version but with module version, so please check your module version, clear the cache accordingly (see comments up there). It should solve the issue in your case.

If you still encounter this issue, there might a 2nd bug with different root cause but same external behavior, in this case please open a new issue and we'll try to reproduce the environment and settings you have in order to be able to observe, identify and fix it.

@khouloudbelguith
Hi,
I've same problem.
Why close this issue ?
ps: my shop is in 1.7.5.1 version

Hi, this issue has been identified and fixed by PR PrestaShop/ps_categoryproducts#6. This is why we closed the issue. The issue is not linked with prestashop version but with module version, so please check your module version, clear the cache accordingly (see comments up there). It should solve the issue in your case.

If you still encounter this issue, there might a 2nd bug with different root cause but same external behavior, in this case please open a new issue and we'll try to reproduce the environment and settings you have in order to be able to observe, identify and fix it.

I have the same problem in Prestashop 1.7.6.
Only first item of ps_categoryproducts show the price when cache is enabled.
1.0.4 version of the module. Re-installed many times with the same result.
Maybe the problem is in PHP version? (I use 7.0.33)
The cache system type: File system
With cache disabled works perfect...
In prestashop Spanish forum there are many people with the same issue.
https://www.prestashop.com/forums/topic/937533-problema-m%C3%B3dulo-productos-de-la-misma-categor%C3%ADa/

This issue should be OPEN.

Sorry,

but it is not solved. I have followed all the instructions here and nothing.
I see you don't reproduce the error but you should understand lot of us have the same problem.

Maybe the problem is related with language beacuse some spanish users have this error. Just guessing.

Thanks anyway

Hello @khouloudbelguith,

I'm working in a new website and I have the same problem again.

Could you please double check if is there a prestashop bug?

Just for info in case you could reproduce this error.
I work with only spanish language, euro currency and warehouse template.

Could be a server problem?

Thank you very much.

Hi @manel-roman,

It is could be similar to this ticket: https://github.com/PrestaShop/PrestaShop/issues/15684

Thanks!

Thanks for your answer.

So it seems it is a theme issue right?

@manel-roman, yes!

Was this page helpful?
0 / 5 - 0 ratings