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

Commit 30b88e8

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr29
2 parents 18a02d2 + f01227c commit 30b88e8

File tree

59 files changed

+697
-587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+697
-587
lines changed

app/code/Magento/Braintree/Setup/Patch/Data/ConvertSerializedDataToJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Magento\Framework\Setup\Patch\PatchVersionInterface;
1313

1414
/**
15-
* Convert data fro php native serialized data to JSON.
15+
* Convert data from php native serialized data to JSON.
1616
*/
1717
class ConvertSerializedDataToJson implements DataPatchInterface, PatchVersionInterface
1818
{

app/code/Magento/Braintree/view/frontend/web/template/payment/paypal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()" />
1313
<label class="label" data-bind="attr: {'for': getCode()}">
1414
<!-- PayPal Logo -->
15-
<img data-bind="attr: {src: getPaymentAcceptanceMarkSrc(), alt: $t('Acceptance Mark')}"
15+
<img data-bind="attr: {src: getPaymentAcceptanceMarkSrc(), alt: $t('Acceptance Mark')}, title: $t('Acceptance Mark')}"
1616
class="payment-icon"/>
1717
<!-- PayPal Logo -->
1818
<span text="getTitle()"></span>

app/code/Magento/Bundle/Test/Unit/Pricing/Price/BundleSelectionPriceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected function setupSelectionPrice($useRegularPrice = false)
121121
}
122122

123123
/**
124-
* test fro method getValue with dynamic productType
124+
* Test for method getValue with dynamic productType
125125
*
126126
* @param bool $useRegularPrice
127127
* @dataProvider useRegularPriceDataProvider

app/code/Magento/Captcha/view/frontend/web/template/checkout/captcha.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<div class="control captcha-image">
1616
<img data-bind="attr: {
1717
alt: $t('Please type the letters and numbers below'),
18+
title: $t('Please type the letters and numbers below'),
1819
height: imageHeight(),
1920
src: getImageSource(),
2021
}"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Product\Configuration\Item;
9+
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
use Magento\Framework\App\ObjectManager;
12+
13+
/**
14+
* {@inheritdoc}
15+
*/
16+
class ItemResolverComposite implements ItemResolverInterface
17+
{
18+
/** @var string[] */
19+
private $itemResolvers = [];
20+
21+
/** @var ItemResolverInterface[] */
22+
private $itemResolversInstances = [];
23+
24+
/**
25+
* @param string[] $itemResolvers
26+
*/
27+
public function __construct(array $itemResolvers)
28+
{
29+
$this->itemResolvers = $itemResolvers;
30+
}
31+
32+
/**
33+
* {@inheritdoc}
34+
*/
35+
public function getFinalProduct(ItemInterface $item) : ProductInterface
36+
{
37+
$finalProduct = $item->getProduct();
38+
foreach ($this->itemResolvers as $resolver) {
39+
$resolvedProduct = $this->getItemResolverInstance($resolver)->getFinalProduct($item);
40+
if ($resolvedProduct !== $finalProduct) {
41+
$finalProduct = $resolvedProduct;
42+
break;
43+
}
44+
}
45+
return $finalProduct;
46+
}
47+
48+
/**
49+
* Get the instance of the item resolver by class name.
50+
*
51+
* @param string $className
52+
* @return ItemResolverInterface
53+
*/
54+
private function getItemResolverInstance(string $className) : ItemResolverInterface
55+
{
56+
if (!isset($this->itemResolversInstances[$className])) {
57+
$this->itemResolversInstances[$className] = ObjectManager::getInstance()->get($className);
58+
}
59+
return $this->itemResolversInstances[$className];
60+
}
61+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Catalog\Model\Product\Configuration\Item;
9+
10+
use Magento\Catalog\Api\Data\ProductInterface;
11+
12+
/**
13+
* Resolves the product from a configured item.
14+
*
15+
* @api
16+
*/
17+
interface ItemResolverInterface
18+
{
19+
/**
20+
* Get the final product from a configured item by product type and selection.
21+
*
22+
* @param ItemInterface $item
23+
* @return ProductInterface
24+
*/
25+
public function getFinalProduct(ItemInterface $item) : ProductInterface;
26+
}

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@
197197
<data key="filename">magento-logo</data>
198198
<data key="file_extension">png</data>
199199
</entity>
200+
<entity name="TestImageNew" type="image">
201+
<data key="title" unique="suffix">magento-again</data>
202+
<data key="price">1.00</data>
203+
<data key="file_type">Upload File</data>
204+
<data key="shareable">Yes</data>
205+
<data key="file">magento-again.jpg</data>
206+
<data key="filename">magento-again</data>
207+
<data key="file_extension">jpg</data>
208+
</entity>
200209
<entity name="ProductWithUnicode" type="product">
201210
<data key="sku" unique="suffix">&#38657;&#20135;&#21697;</data>
202211
<data key="type_id">simple</data>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
<element name="firstRow" type="button" selector="tr.data-row:nth-of-type(1)"/>
2929
<element name="productGridCheckboxOnRow" type="checkbox" selector="//*[@id='container']//tr[{{row}}]/td[1]//input" parameterized="true"/>
3030
<element name="productGridNameProduct" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
31+
<element name="selectRowBasedOnName" type="input" selector="//td/div[text()='{{var1}}']" parameterized="true"/>
3132
</section>
3233
</sections>

app/code/Magento/Catalog/etc/adminhtml/system.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
<clone_fields>1</clone_fields>
9999
<clone_model>Magento\Catalog\Model\Config\CatalogClone\Media\Image</clone_model>
100100
<field id="placeholder" type="image" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
101-
<label></label>
102101
<backend_model>Magento\Config\Model\Config\Backend\Image</backend_model>
103102
<upload_dir config="system/filesystem/media" scope_info="1">catalog/product/placeholder</upload_dir>
104103
<base_url type="media" scope_info="1">catalog/product/placeholder</base_url>

app/code/Magento/Catalog/etc/di.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
<preference for="Magento\Catalog\Api\Data\ProductRender\FormattedPriceInfoInterface" type="Magento\Catalog\Model\ProductRender\FormattedPriceInfo" />
7171
<preference for="Magento\Framework\Indexer\BatchProviderInterface" type="Magento\Framework\Indexer\BatchProvider" />
7272
<preference for="Magento\Catalog\Model\Indexer\Product\Price\UpdateIndexInterface" type="Magento\Catalog\Model\Indexer\Product\Price\InvalidateIndex" />
73-
<preference for="\Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface" type="\Magento\Catalog\Model\Product\Gallery\ImagesConfigFactory" />
73+
<preference for="Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface" type="Magento\Catalog\Model\Product\Gallery\ImagesConfigFactory" />
74+
<preference for="Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface" type="Magento\Catalog\Model\Product\Configuration\Item\ItemResolverComposite" />
7475
<type name="Magento\Customer\Model\ResourceModel\Visitor">
7576
<plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" />
7677
</type>

app/code/Magento/Catalog/view/adminhtml/web/template/image-preview.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
event="load: $parent.onPreviewLoad.bind($parent)"
1515
attr="
1616
src: $parent.getFilePreview($file),
17-
alt: $file.name">
17+
alt: $file.name,
18+
title: $file.name">
1819
</a>
1920

2021
<div class="actions">

app/code/Magento/Catalog/view/base/web/template/product/list/columns/image.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class="product-image-photo"
1212
attr="src: getImageUrl($row()),
1313
alt: getLabel($row()),
14+
title: getLabel($row()),
1415
width: getResizedImageWidth($row()),
1516
height: getResizedImageHeight($row())"/>
1617
</a>

app/code/Magento/Catalog/view/base/web/template/product/list/columns/image_with_borders.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
data-bind="style: {'padding-bottom': getHeight($row())/getWidth($row()) * 100 + '%'}">
1515
<img class="product-image-photo"
1616
data-bind="attr: {src: getImageUrl($row()),
17-
alt: getLabel($row())}" />
17+
alt: getLabel($row()), title: getLabel($row())}" />
1818
</span>
1919
</span>
2020
</a>

app/code/Magento/Checkout/Block/Cart/Item/Renderer.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\View\Element\AbstractBlock;
1212
use Magento\Framework\View\Element\Message\InterpretationStrategyInterface;
1313
use Magento\Quote\Model\Quote\Item\AbstractItem;
14+
use Magento\Framework\App\ObjectManager;
15+
use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface;
1416

1517
/**
1618
* Shopping cart item render block
@@ -21,6 +23,7 @@
2123
* @method \Magento\Checkout\Block\Cart\Item\Renderer setProductName(string)
2224
* @method \Magento\Checkout\Block\Cart\Item\Renderer setDeleteUrl(string)
2325
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
26+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2427
*/
2528
class Renderer extends \Magento\Framework\View\Element\Template implements
2629
\Magento\Framework\DataObject\IdentityInterface
@@ -91,6 +94,9 @@ class Renderer extends \Magento\Framework\View\Element\Template implements
9194
*/
9295
private $messageInterpretationStrategy;
9396

97+
/** @var ItemResolverInterface */
98+
private $itemResolver;
99+
94100
/**
95101
* @param \Magento\Framework\View\Element\Template\Context $context
96102
* @param \Magento\Catalog\Helper\Product\Configuration $productConfig
@@ -102,6 +108,7 @@ class Renderer extends \Magento\Framework\View\Element\Template implements
102108
* @param \Magento\Framework\Module\Manager $moduleManager
103109
* @param InterpretationStrategyInterface $messageInterpretationStrategy
104110
* @param array $data
111+
* @param ItemResolverInterface|null $itemResolver
105112
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
106113
* @codeCoverageIgnore
107114
*/
@@ -115,7 +122,8 @@ public function __construct(
115122
PriceCurrencyInterface $priceCurrency,
116123
\Magento\Framework\Module\Manager $moduleManager,
117124
InterpretationStrategyInterface $messageInterpretationStrategy,
118-
array $data = []
125+
array $data = [],
126+
ItemResolverInterface $itemResolver = null
119127
) {
120128
$this->priceCurrency = $priceCurrency;
121129
$this->imageBuilder = $imageBuilder;
@@ -127,6 +135,7 @@ public function __construct(
127135
$this->_isScopePrivate = true;
128136
$this->moduleManager = $moduleManager;
129137
$this->messageInterpretationStrategy = $messageInterpretationStrategy;
138+
$this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(ItemResolverInterface::class);
130139
}
131140

132141
/**
@@ -172,7 +181,7 @@ public function getProduct()
172181
*/
173182
public function getProductForThumbnail()
174183
{
175-
return $this->getProduct();
184+
return $this->itemResolver->getFinalProduct($this->getItem());
176185
}
177186

178187
/**

app/code/Magento/Checkout/CustomerData/DefaultItem.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Checkout\CustomerData;
88

99
use Magento\Framework\App\ObjectManager;
10+
use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface;
1011

1112
/**
1213
* Default item
@@ -39,19 +40,23 @@ class DefaultItem extends AbstractItem
3940
protected $checkoutHelper;
4041

4142
/**
42-
* Escaper
43-
*
4443
* @var \Magento\Framework\Escaper
4544
*/
4645
private $escaper;
4746

47+
/**
48+
* @var ItemResolverInterface
49+
*/
50+
private $itemResolver;
51+
4852
/**
4953
* @param \Magento\Catalog\Helper\Image $imageHelper
5054
* @param \Magento\Msrp\Helper\Data $msrpHelper
5155
* @param \Magento\Framework\UrlInterface $urlBuilder
5256
* @param \Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool
5357
* @param \Magento\Checkout\Helper\Data $checkoutHelper
5458
* @param \Magento\Framework\Escaper|null $escaper
59+
* @param ItemResolverInterface|null $itemResolver
5560
* @codeCoverageIgnore
5661
*/
5762
public function __construct(
@@ -60,14 +65,16 @@ public function __construct(
6065
\Magento\Framework\UrlInterface $urlBuilder,
6166
\Magento\Catalog\Helper\Product\ConfigurationPool $configurationPool,
6267
\Magento\Checkout\Helper\Data $checkoutHelper,
63-
\Magento\Framework\Escaper $escaper = null
68+
\Magento\Framework\Escaper $escaper = null,
69+
ItemResolverInterface $itemResolver = null
6470
) {
6571
$this->configurationPool = $configurationPool;
6672
$this->imageHelper = $imageHelper;
6773
$this->msrpHelper = $msrpHelper;
6874
$this->urlBuilder = $urlBuilder;
6975
$this->checkoutHelper = $checkoutHelper;
7076
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(\Magento\Framework\Escaper::class);
77+
$this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(ItemResolverInterface::class);
7178
}
7279

7380
/**
@@ -119,7 +126,7 @@ protected function getOptionList()
119126
*/
120127
protected function getProductForThumbnail()
121128
{
122-
return $this->getProduct();
129+
return $this->itemResolver->getFinalProduct($this->item);
123130
}
124131

125132
/**

app/code/Magento/Checkout/Model/Cart/ImageProvider.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
*/
66
namespace Magento\Checkout\Model\Cart;
77

8+
use Magento\Checkout\CustomerData\DefaultItem;
9+
use Magento\Framework\App\ObjectManager;
10+
811
/**
9-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1012
* @api
1113
*/
1214
class ImageProvider
@@ -18,20 +20,27 @@ class ImageProvider
1820

1921
/**
2022
* @var \Magento\Checkout\CustomerData\ItemPoolInterface
23+
* @deprecated No need for the pool as images are resolved in the default item implementation
24+
* @see \Magento\Checkout\CustomerData\DefaultItem::getProductForThumbnail
2125
*/
2226
protected $itemPool;
2327

28+
/** @var \Magento\Checkout\CustomerData\DefaultItem */
29+
protected $customerDataItem;
30+
2431
/**
2532
* @param \Magento\Quote\Api\CartItemRepositoryInterface $itemRepository
2633
* @param \Magento\Checkout\CustomerData\ItemPoolInterface $itemPool
27-
* @codeCoverageIgnore
34+
* @param DefaultItem|null $customerDataItem
2835
*/
2936
public function __construct(
3037
\Magento\Quote\Api\CartItemRepositoryInterface $itemRepository,
31-
\Magento\Checkout\CustomerData\ItemPoolInterface $itemPool
38+
\Magento\Checkout\CustomerData\ItemPoolInterface $itemPool,
39+
\Magento\Checkout\CustomerData\DefaultItem $customerDataItem = null
3240
) {
3341
$this->itemRepository = $itemRepository;
3442
$this->itemPool = $itemPool;
43+
$this->customerDataItem = $customerDataItem ?: ObjectManager::getInstance()->get(DefaultItem::class);
3544
}
3645

3746
/**
@@ -45,7 +54,7 @@ public function getImages($cartId)
4554
$items = $this->itemRepository->getList($cartId);
4655
/** @var \Magento\Quote\Model\Quote\Item $cartItem */
4756
foreach ($items as $cartItem) {
48-
$allData = $this->itemPool->getItemData($cartItem);
57+
$allData = $this->customerDataItem->getItemData($cartItem);
4958
$itemData[$cartItem->getItemId()] = $allData['product_image'];
5059
}
5160
return $itemData;

0 commit comments

Comments
 (0)