CMS::getCMSContent doesn’t propagate $idShop when $idLang is not set #29519
Labels
1.7.8.6
Affects versions
Bug
Type: Bug
CO
Category: Core
Languages
Label: Which BO under menu is concerned
Multistore
Label: Which BO under menu is concerned
Needs Specs
Status: issue needs to be specified
Pages
Label: Which BO under menu is concerned
Waiting for PM
Status: action required, waiting for product feedback
Prerequisites
Describe the bug and add screenshots
It’s hard to know if this is a bug or expected behavior because this function has an empty docstring. Please discard this issue if this is an expected behavior.
The function’s signature is
getCMSContent($idCms, $idLang = null, $idShop = null)
.CMS::getCMSContent(7)
returns the content of CMS page of id 7 in the current language and shopCMS::getCMSContent(7, 1)
returns the content of CMS page of id 7 in the language of id 1 and current shopCMS::getCMSContent(7, 1, 2)
returns the content of CMS page of id 7 in the language of id 1 and shop of id 2CMS::getCMSContent(7, null, 2)
returns the content of CMS page of id 7 in the current language and shop of id 2Expected behavior
I believe the last behavior is a bug because I would expect it to return the content of CMS page of id 7 in the default language of the shop of id 2.
Steps to reproduce
Create a template with the following content:
(you'll have to adapt it with your own ids)
Otherwise the issue is easy to see in the code:
PrestaShop/classes/CMS.php
Line 336 in 52a2498
The function calls
Configuration::get('PS_LANG_DEFAULT')
as-is, without passing the optional argument$idShop
.PrestaShop version(s) where the bug happened
1.7.8.6
PHP version(s) where the bug happened
7.1
If your bug is related to a module, specify its name and its version
No response
The text was updated successfully, but these errors were encountered: