Skip to content

Fix #13652. Mini cart - fix issue in product title with special chars. #13802

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

Merged
merged 1 commit into from
Mar 14, 2018
Merged

Fix #13652. Mini cart - fix issue in product title with special chars. #13802

merged 1 commit into from
Mar 14, 2018

Conversation

afirlejczyk
Copy link
Contributor

Fix showing product name with special chars in mini cart.

Description

This code was used in html template to show product name

<a data-bind="attr: {href: product_url}, text: product_name"></a>

I replaced it with:

<a data-bind="attr: {href: product_url}, html: product_name"></a>

Fixed Issues (if relevant)

  1. Issue in product title with special chars in mini cart #13652: Issue in product title with special chars in mini cart

Manual testing scenarios

  1. Create a product titled Fusion Backpack ™
  2. Go to frontend, the product title comes up correctly as Fusion Backpack ™ then add it to cart
  3. Open the mini cart - product title should be display correctly as Fusion Backpack ™

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Feb 22, 2018

CLA assistant check
All committers have signed the CLA.

@dmanners dmanners self-assigned this Mar 12, 2018
@magento-engcom-team magento-engcom-team added this to the March 2018 milestone Mar 12, 2018
@magento-engcom-team
Copy link
Contributor

@afirlejczyk thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@dmanners
Copy link
Contributor

Hi @afirlejczyk thank you for this pull request. Could you please have a look through the docs on adding new constructor arguments. http://devdocs.magento.com/guides/v2.2/contributor-guide/backward-compatible-development/index.html#adding-a-constructor-parameter

For your example I think that escaper should be an optional parameter and also be the last item in the constructor so as to not break any other code that already extends this class.

public function __construct(
    \Magento\Catalog\Helper\Image $imageHelper,
    \Magento\Msrp\Helper\Data $msrpHelper,
    \Magento\Framework\UrlInterface $urlBuilder,
    \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
    \Magento\Checkout\Helper\Data $checkoutHelper,
    \Magento\Framework\Escaper $escaper = null
) {
$this->escaper = $escaper ?: \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class);

Copy link
Contributor

@dmanners dmanners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afirlejczyk
Copy link
Contributor Author

Hi @dmanners
Thank you for the review.

I've updated the code, but I have one question.
Should I only update constructor in app/code/Magento/Checkout/CustomerData/DefaultItem.php ?

I also update constructor in classes which extends DefaultItem.php class (app/code/Magento/GroupedProduct/CustomerData/GroupedItem.php, app/code/Magento/ConfigurableProduct/CustomerData/ConfigurableItem.php) but in this case it is not necessary.

I don't know which solution would be best.

@dmanners
Copy link
Contributor

Hi @afirlejczyk thank you for this update.

I would update all the constructors like you have done. This means in a future major release we can update them so they are required constructor and the code will already be in place to handle such a change.

@magento-engcom-team
Copy link
Contributor

Hi @dmanners, thank you for the review.
ENGCOM-861 has been created to process this Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants