Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMS::getCMSContent doesn’t propagate $idShop when $idLang is not set #29519

Open
2 tasks done
bfontaine opened this issue Sep 2, 2022 · 1 comment
Open
2 tasks done
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

Comments

@bfontaine
Copy link

bfontaine commented Sep 2, 2022

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 shop
  • CMS::getCMSContent(7, 1) returns the content of CMS page of id 7 in the language of id 1 and current shop
  • CMS::getCMSContent(7, 1, 2) returns the content of CMS page of id 7 in the language of id 1 and shop of id 2
  • CMS::getCMSContent(7, null, 2) returns the content of CMS page of id 7 in the current language and shop of id 2

Expected 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:

{extends file='page.tpl'}
{block name='page_content'}
    {assign var=cms_content value=CMS::getCMSContent(7, null, 2)}
    {$cms_content.content nofilter}
{/block}

(you'll have to adapt it with your own ids)

Otherwise the issue is easy to see in the code:

public static function getCMSContent($idCms, $idLang = null, $idShop = null)

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

@bfontaine bfontaine added Bug Type: Bug New New issue not yet processed by QA labels Sep 2, 2022
@hibatallahAouadni
Copy link
Contributor

The function’s signature is getCMSContent($idCms, $idLang = null, $idShop = null)
CMS::getCMSContent(7, null, 2) returns the content of CMS page of id 7 in the current language and shop of id 2
I believe this 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.

is this the expected behavior or it's a bug?
Ping @PrestaShop/product-team can someone please answer @bfontaine question 🙏

Thanks in advance 🙏

@hibatallahAouadni hibatallahAouadni added Waiting for PM Status: action required, waiting for product feedback CO Category: Core Needs Specs Status: issue needs to be specified Pages Label: Which BO under menu is concerned Multistore Label: Which BO under menu is concerned Languages Label: Which BO under menu is concerned 1.7.8.6 Affects versions and removed New New issue not yet processed by QA labels Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants