Skip to content

Quotes in product name causes JSON error on product page MAP What's This Popup #8059

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

Closed
justenpeters opened this issue Jan 5, 2017 · 14 comments
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@justenpeters
Copy link

Preconditions

  1. Magento 2.1.2

Steps to reproduce

  1. Include single quote ( ' ) or double quote ( " ) in product name
  2. Add an MSRP price
  3. View product page

Expected result

  1. Popup opens as expected

Actual result

  1. Unexpected end of JSON input error
    screen shot 2017-01-05 at 4 30 32 pm
    screen shot 2017-01-05 at 4 37 36 pm
@veloraven
Copy link
Contributor

@justenpeters thank you for your report.
I have created internal ticket for it: MAGETWO-63116

@veloraven veloraven added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Jan 12, 2017
magento-team pushed a commit that referenced this issue Apr 18, 2017
…roduct page MAP What's This Popup #8059

 - Escape strings inside JavaScript context.
 - Added functional test variation to cover the bug.
magento-team pushed a commit that referenced this issue Apr 18, 2017
…roduct page MAP What's This Popup #8059

 - Modified the ticket ID for the newly created variation.
magento-team pushed a commit that referenced this issue Apr 18, 2017
…roduct page MAP What's This Popup #8059

- remove annotation
magento-team pushed a commit that referenced this issue Apr 18, 2017
…ON_ERROR

MAGETWO-63116: [GitHub] Quotes in product name causes JSON error on product page MAP What's This Popup #8059
@okorshenko
Copy link
Contributor

Backport ticket for 2.1-develop: MAGETWO-69708

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team
Copy link
Contributor

@justenpeters thank you for your report.
The fix for this issue is already available in release 2.2.0

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Sep 20, 2017
@harrigo
Copy link

harrigo commented May 3, 2018

This issue seems to have resurfaced for me in Magento 2.2.4. Was not an issue in 2.2.3. Have fixed by formatting html characters in product name for breadcrumbs.phtml within Catalog module.

@genyuk
Copy link

genyuk commented May 12, 2018

Same issue appeared in 2.2.4. @harrigo - Could you please provide the fix you applied to breadcrumbs.phtml file?

@davidverholen
Copy link
Member

davidverholen commented May 14, 2018

as a workaround you can change the template in your custom theme

magento/vendor/magento/module-catalog/view/frontend/templates/product/breadcrumbs.phtml

<?php
/** @var \Magento\Theme\Block\Html\Breadcrumbs $block */
/** @var \Magento\Catalog\ViewModel\Product\Breadcrumbs $viewModel */
$viewModel = $block->getData('viewModel');
$breadCrumbConfig = [
    'breadcrumbs' => [
        'categoryUrlSuffix' => $block->escapeHtml($viewModel->getCategoryUrlSuffix()),
        'useCategoryPathInUrl' => (int)$viewModel->isCategoryUsedInProductUrl(),
        'product' => $viewModel->getProductName()
    ]
]
?>
<div class="breadcrumbs" data-mage-init='<?= $block->escapeHtml(json_encode($breadCrumbConfig)) ?>'></div>

however the correct way to to do it would be creating the json config in the \Magento\Catalog\ViewModel\Product\Breadcrumbs View Model and use the internal json serializer I think

@EmilyPepperman
Copy link
Contributor

Issue is there in Magento 2.2.5 !!!!

@zakgrindle
Copy link

This issue also breaks Widget conditions in the admin panel if categories have an & in the name

@inkobject
Copy link

Seeing this issue in 2.2.5
In my use case, I sell plants. Double and single quotes have a definite meaning in naming conventions: species, hybrids, cultivars etc. Not being able to use double quotes makes things problematic for me.

@aeu
Copy link

aeu commented Sep 12, 2018

I am also seeing this in 2.2.5

@aeu
Copy link

aeu commented Sep 12, 2018

@inkobject I have the same problem as you, we sell products that are measured in feet and inches. I was able to work around this by using the Prime and Double Prime Symbols in my product names.

https://en.wikipedia.org/wiki/Prime_(symbol)

Kind of ridiculous that I had to do this, but on the other hand using the Prime symbols is typographically more correct.

@hostep
Copy link
Contributor

hostep commented Sep 12, 2018

For the people reporting the issue in Magento 2.2.4 and 2.2.5, it's not the exact same issue as the original issue. Maybe better to watch these issues: #15037 &
#15268 & #15491 & #15631 & #17967

The real fix is in here: #15521, but that one can't be applied cleanly to Magento 2.2.5. You can find a patch which you can apply cleanly to 2.2.5 in #15631 (comment)

Or you can wait for Magento 2.2.6, it should normally also contain the fix. Release date is supposed to be somewhere next week, or maybe the week after (but don't take my word for it).

@nike1994
Copy link

nike1994 commented Apr 1, 2023

I have the same problem In Magento 2.4.6 :/

@hostep
Copy link
Contributor

hostep commented Apr 5, 2023

@nike1994: if you can reproduce it on a clean installation, please open a new issue with steps of how to reproduce it.
It won't help with commenting on a 5 year old issue, it's most likely a different problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests