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

Hook DisplayAdminProductsExtra weird behavior when product description does not contain p tag #29206

Open
2 tasks done
MarceldeR opened this issue Jul 29, 2022 · 4 comments
Open
2 tasks done
Labels
1.7.8.6 Affects versions BO Category: Back Office Bug Type: Bug Hook Major Severity: major bug > https://build.prestashop.com/news/severity-classification Modules Component: Which BO section is concerned Needs Specs Status: issue needs to be specified Old Products Page Concerns the old product page Regression Type: regression Verified The issue has been reproduced

Comments

@MarceldeR
Copy link

MarceldeR commented Jul 29, 2022

Prerequisites

Describe the bug and add screenshots

Created a module which uses DisplayAdminProductsExtra hook.
The module shows up on the product page in the tab Modules, which is good.
The module shows a configure button, which is also good.
However, after pressing this configure button Prestashop only gives a message that settings are stored (something like that) and does not load .tpl file. This behavior is not on all products. There are products that are loading the .tpl file and some are not. So, there is a difference in the products which makes Prestashop act different.
I have found out that this behavior comes from the descriptionfield in the table product_lang. The differences between the working and not working products is that the working products start and ends with <p> </p>.

The not working products are plain ascii. The plain ascii descriptions are result of importing products. How they are imported is not the issue. Fact is that when plain ascii comes in the description the module using DisplayAdminProductsExtra does not show the .tpl file on these products. When changing manually the description between <p> and </p> makes the module work again on that product.

My module has nothing to do with the description btw. It only shows a tpl-file with some extra product fields to be loaded in an external table.

Tested it also with another module using this hook, same result.

Solution: let the product page ignore html-tags when goint to module and let it also accept plain ascii.

You can use the module in this message for example (module does not much. I use it for test purposes)
belvg_samplemodule (3).zip

Expected behavior

tpl-file should also be loaded when product description is plain ascii.

Steps to reproduce

  1. Find and install a module that uses DisplayAdminProductsExtra
  2. Find or create a product with plain ascii in the description field (change the description field in product_lang manually to something like test)
  3. load the product in the backoffice and go to the module tab.
  4. Press Configure.
  5. Instead of showing the .tpl it gives a message like settings saved.
  6. When changing the text from step 2 manually in

    testing

    and reload the product in the backoffice it now shows the .tpl after pressing configure.

PrestaShop version(s) where the bug happened

1.7.8.6+1.7.8.7 but maybe earlier versions as well.

PHP version(s) where the bug happened

7.2

If your bug is related to a module, specify its name and its version

No response

@MarceldeR MarceldeR added Bug Type: Bug New New issue not yet processed by QA labels Jul 29, 2022
@hibatallahAouadni
Copy link
Contributor

Hello @MarceldeR

I follow your steps to reproduce and I don't seem to understand what's the bug, see the attached screen record below:

issue_29206.mp4

Please check and feedback.
Thanks!

@hibatallahAouadni hibatallahAouadni added Waiting for author Status: action required, waiting for author feedback BO Category: Back Office NMI Status: issue needs more information Modules Component: Which BO section is concerned Old Products Page Concerns the old product page Hook 1.7.8.6 Affects versions and removed New New issue not yet processed by QA labels Aug 2, 2022
@MarceldeR
Copy link
Author

MarceldeR commented Aug 3, 2022

I noticed that in the message the tags are removed, so i try it again.

If the descriptionfield of a product in the table product_lang is between < p > tags, it works (no other html-tags tried). If the text in the descriptionfield of a product in the table product_lang is without tags (plain ascii) the tpl of the module using the hook DisplayAdminProductsExtra does not load. See attachement.

When a product is created in the backoffice, these tags are there, so there is no problem. If you use the backoffice and remove the tags in the source-code of the editor, they will placed back after saving the product. Remove the tags from inside the table prodcut_lang , field description itself.

When one is using an import script and is importing the description of a product 1-on-1 without these tags the module does not work for these products, because the data is put directly into the table without tags if there are no tags in the description to import.
There is no specification that says that the description must be between tags. It should also work without these tags.

If any question, please ask.

Best regards,
Marcel

TPL.mp4

@prestashop-issue-bot prestashop-issue-bot bot removed the Waiting for author Status: action required, waiting for author feedback label Aug 3, 2022
@AureRita
Copy link
Contributor

AureRita commented Aug 3, 2022

Hi @MarceldeR

Thank you for this video, thank to that, I reproduced your issue as we can see it on this video :

Untitled_.Aug.3.2022.5_53.PM.mp4

I reproduced it on 1.7.8.x and not on 1.7.7.8.

It's a regression ! I will add it to the Patch Backlog to be fixed

Thanks

@AureRita AureRita added Needs Specs Status: issue needs to be specified Regression Type: regression Verified The issue has been reproduced and removed NMI Status: issue needs more information labels Aug 3, 2022
@AureRita AureRita added this to Regression issues 1.7.8.x in Backlog Patch via automation Aug 3, 2022
@AureRita AureRita added the Major Severity: major bug > https://build.prestashop.com/news/severity-classification label Aug 3, 2022
@MatShir MatShir removed this from Regression issues 1.7.8.x in Backlog Patch Aug 16, 2022
@MatShir MatShir added this to Not Ready in PrestaShop 1.7.8.x via automation Aug 16, 2022
@matks matks changed the title Hook DisplayAdminProductsExtra. Module shows only configure button on Module page Hook DisplayAdminProductsExtra weird behavior when product description does not contain p tag Aug 29, 2022
@MatShir MatShir removed this from Not Ready in PrestaShop 1.7.8.x Aug 30, 2022
@MarceldeR
Copy link
Author

This behavior is also on Prestashop 8.x

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 BO Category: Back Office Bug Type: Bug Hook Major Severity: major bug > https://build.prestashop.com/news/severity-classification Modules Component: Which BO section is concerned Needs Specs Status: issue needs to be specified Old Products Page Concerns the old product page Regression Type: regression Verified The issue has been reproduced
Projects
None yet
Development

No branches or pull requests

3 participants