Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Commit

Permalink
ENGCOM-861: Fix #13652. Mini cart - fix issue in product title with s…
Browse files Browse the repository at this point in the history
…pecial chars. #13802
  • Loading branch information
Oleksii Korshenko authored Mar 13, 2018
2 parents c7ddedf + 5b7aca1 commit 2261550
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
18 changes: 16 additions & 2 deletions app/code/Magento/Checkout/CustomerData/DefaultItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

namespace Magento\Checkout\CustomerData;

use Magento\Framework\App\ObjectManager;

/**
* Default item
*/
Expand Down Expand Up @@ -36,26 +38,36 @@ class DefaultItem extends AbstractItem
*/
protected $checkoutHelper;

/**
* Escaper
*
* @var \Magento\Framework\Escaper
*/
private $escaper;

/**
* @param \Magento\Catalog\Helper\Image $imageHelper
* @param \Magento\Msrp\Helper\Data $msrpHelper
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
* @param \Magento\Checkout\Helper\Data $checkoutHelper
* @param \Magento\Framework\Escaper|null $escaper
* @codeCoverageIgnore
*/
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\Checkout\Helper\Data $checkoutHelper,
\Magento\Framework\Escaper $escaper = null
) {
$this->configurationPool = $configurationPool;
$this->imageHelper = $imageHelper;
$this->msrpHelper = $msrpHelper;
$this->urlBuilder = $urlBuilder;
$this->checkoutHelper = $checkoutHelper;
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class);
}

/**
Expand All @@ -64,14 +76,16 @@ public function __construct(
protected function doGetItemData()
{
$imageHelper = $this->imageHelper->init($this->getProductForThumbnail(), 'mini_cart_product_thumbnail');
$productName = $this->escaper->escapeHtml($this->item->getProduct()->getName());

return [
'options' => $this->getOptionList(),
'qty' => $this->item->getQty() * 1,
'item_id' => $this->item->getId(),
'configure_url' => $this->getConfigureUrl(),
'is_visible_in_site_visibility' => $this->item->getProduct()->isVisibleInSiteVisibility(),
'product_id' => $this->item->getProduct()->getId(),
'product_name' => $this->item->getProduct()->getName(),
'product_name' => $productName,
'product_sku' => $this->item->getProduct()->getSku(),
'product_url' => $this->getProductUrl(),
'product_has_url' => $this->hasProductUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="product-item-details">
<strong class="product-item-name">
<!-- ko if: product_has_url -->
<a data-bind="attr: {href: product_url}, text: product_name"></a>
<a data-bind="attr: {href: product_url}, html: product_name"></a>
<!-- /ko -->
<!-- ko ifnot: product_has_url -->
<!-- ko text: product_name --><!-- /ko -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ class ConfigurableItem extends DefaultItem
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
* @param \Magento\Checkout\Helper\Data $checkoutHelper
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\Escaper|null $escaper
*/
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\App\Config\ScopeConfigInterface $scopeConfig
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Escaper $escaper = null
) {
parent::__construct(
$imageHelper,
$msrpHelper,
$urlBuilder,
$configurationPool,
$checkoutHelper
$checkoutHelper,
$escaper
);
$this->_scopeConfig = $scopeConfig;
}
Expand Down
7 changes: 5 additions & 2 deletions app/code/Magento/GroupedProduct/CustomerData/GroupedItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,24 @@ class GroupedItem extends DefaultItem
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
* @param \Magento\Checkout\Helper\Data $checkoutHelper
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\Escaper|null $escaper
*/
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\App\Config\ScopeConfigInterface $scopeConfig
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Framework\Escaper $escaper = null
) {
parent::__construct(
$imageHelper,
$msrpHelper,
$urlBuilder,
$configurationPool,
$checkoutHelper
$checkoutHelper,
$escaper
);
$this->_scopeConfig = $scopeConfig;
}
Expand Down

0 comments on commit 2261550

Please sign in to comment.