Skip to content

Commit 076ec45

Browse files
authored
Merge pull request #3486 from magento-epam/EPAM-PR-23
MAGETWO-91756 In Related product section add to wishlist and compare is not displaying for mobile devices portrait view MAGETWO-59789 Image Swatch size change not working [GitHub #6382] MAGETWO-91530 [2.3] Expose Authorize.net Response Codes in Checkout MAGETWO-56094 Header issue when resizing in Internet Explorer MAGETWO-95825 [Magento cloud] - Images revert to default placeholder on import MAGETWO-95805 User agent exception not setting the correct templates for product pages MAGETWO-95833 Shared gift registry does not show the special price for a configurable product MAGETWO-95821 Order fails on review step if gift card applied MAGETWO-95826 Zoomed part of images becomes distorted in case when image width/height ratio has ~2x difference MAGETWO-95818 [Magento Cloud] Default value for category URL path does not save MAGETWO-95816 Invoice PDF contain different address when use arabic symbols MAGETWO-95829 Product positions are incorrect after import MAGETWO-91513 Password reset email cannot be sent if the customer does not have customer attribute set that is changed to required after original account creation MAGETWO-96125 [2.3.x] Reward Points: "Invite a Friend" points not added with New Account Email Confirmation enabled
2 parents 7d6b0d7 + 3125c72 commit 076ec45

File tree

24 files changed

+274
-83
lines changed

24 files changed

+274
-83
lines changed

app/code/Magento/Catalog/Model/Category/Product/PositionResolver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public function getPositions(int $categoryId): array
4343
$categoryId
4444
)->order(
4545
'ccp.position ' . \Magento\Framework\DB\Select::SQL_ASC
46+
)->order(
47+
'ccp.product_id ' . \Magento\Framework\DB\Select::SQL_DESC
4648
);
4749

4850
return array_flip($connection->fetchCol($select));

app/code/Magento/Catalog/Test/Unit/Model/Category/Product/PositionResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testGetPositions()
107107
$this->select->expects($this->once())
108108
->method('where')
109109
->willReturnSelf();
110-
$this->select->expects($this->once())
110+
$this->select->expects($this->exactly(2))
111111
->method('order')
112112
->willReturnSelf();
113113
$this->select->expects($this->once())

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Listing/Collector/ImageTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Catalog\Helper\ImageFactory;
1616
use Magento\Catalog\Api\Data\ProductRender\ImageInterface;
1717
use Magento\Catalog\Helper\Image as ImageHelper;
18+
use Magento\Framework\View\DesignLoader;
1819

1920
/**
2021
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -33,6 +34,9 @@ class ImageTest extends \PHPUnit\Framework\TestCase
3334
/** @var DesignInterface | \PHPUnit_Framework_MockObject_MockObject */
3435
private $design;
3536

37+
/** @var DesignLoader | \PHPUnit_Framework_MockObject_MockObject*/
38+
private $designLoader;
39+
3640
/** @var Image */
3741
private $model;
3842

@@ -60,13 +64,15 @@ public function setUp()
6064
->getMock();
6165
$this->storeManager = $this->createMock(StoreManagerInterface::class);
6266
$this->design = $this->createMock(DesignInterface::class);
67+
$this->designLoader = $this->createMock(DesignLoader::class);
6368
$this->model = new Image(
6469
$this->imageFactory,
6570
$this->state,
6671
$this->storeManager,
6772
$this->design,
6873
$this->imageInterfaceFactory,
69-
$this->imageCodes
74+
$this->imageCodes,
75+
$this->designLoader
7076
);
7177
}
7278

app/code/Magento/Catalog/Ui/DataProvider/Product/Listing/Collector/Image.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
use Magento\Framework\View\DesignInterface;
1818
use Magento\Store\Model\StoreManager;
1919
use Magento\Store\Model\StoreManagerInterface;
20+
use Magento\Framework\View\DesignLoader;
2021

2122
/**
2223
* Collect enough information about image rendering on front
2324
* If you want to add new image, that should render on front you need
2425
* to configure this class in di.xml
2526
*
27+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2628
*/
2729
class Image implements ProductRenderCollectorInterface
2830
{
@@ -51,6 +53,7 @@ class Image implements ProductRenderCollectorInterface
5153

5254
/**
5355
* @var DesignInterface
56+
* @deprecated 2.3.0 DesignLoader is used for design theme loading
5457
*/
5558
private $design;
5659

@@ -59,6 +62,11 @@ class Image implements ProductRenderCollectorInterface
5962
*/
6063
private $imageRenderInfoFactory;
6164

65+
/**
66+
* @var DesignLoader
67+
*/
68+
private $designLoader;
69+
6270
/**
6371
* Image constructor.
6472
* @param ImageFactory $imageFactory
@@ -67,21 +75,25 @@ class Image implements ProductRenderCollectorInterface
6775
* @param DesignInterface $design
6876
* @param ImageInterfaceFactory $imageRenderInfoFactory
6977
* @param array $imageCodes
78+
* @param DesignLoader $designLoader
7079
*/
7180
public function __construct(
7281
ImageFactory $imageFactory,
7382
State $state,
7483
StoreManagerInterface $storeManager,
7584
DesignInterface $design,
7685
ImageInterfaceFactory $imageRenderInfoFactory,
77-
array $imageCodes = []
86+
array $imageCodes = [],
87+
DesignLoader $designLoader = null
7888
) {
7989
$this->imageFactory = $imageFactory;
8090
$this->imageCodes = $imageCodes;
8191
$this->state = $state;
8292
$this->storeManager = $storeManager;
8393
$this->design = $design;
8494
$this->imageRenderInfoFactory = $imageRenderInfoFactory;
95+
$this->designLoader = $designLoader ?: \Magento\Framework\App\ObjectManager::getInstance()
96+
->get(DesignLoader::class);
8597
}
8698

8799
/**
@@ -124,6 +136,8 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ
124136
}
125137

126138
/**
139+
* Callback for emulating image creation
140+
*
127141
* Callback in which we emulate initialize default design theme, depends on current store, be settings store id
128142
* from render info
129143
*
@@ -136,7 +150,7 @@ public function collect(ProductInterface $product, ProductRenderInterface $produ
136150
public function emulateImageCreating(ProductInterface $product, $imageCode, $storeId, ImageInterface $image)
137151
{
138152
$this->storeManager->setCurrentStore($storeId);
139-
$this->design->setDefaultDesignTheme();
153+
$this->designLoader->load();
140154

141155
$imageHelper = $this->imageFactory->create();
142156
$imageHelper->init($product, $imageCode);

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ protected function _saveProductCategories(array $categoriesData)
14341434
$delProductId[] = $productId;
14351435

14361436
foreach (array_keys($categories) as $categoryId) {
1437-
$categoriesIn[] = ['product_id' => $productId, 'category_id' => $categoryId, 'position' => 1];
1437+
$categoriesIn[] = ['product_id' => $productId, 'category_id' => $categoryId, 'position' => 0];
14381438
}
14391439
}
14401440
if (Import::BEHAVIOR_APPEND != $this->getBehavior()) {
@@ -1805,6 +1805,7 @@ protected function _saveProducts()
18051805
if ($uploadedFile) {
18061806
$uploadedImages[$columnImage] = $uploadedFile;
18071807
} else {
1808+
unset($rowData[$column]);
18081809
$this->addRowError(
18091810
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE,
18101811
$rowNum,

app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlPathGenerator.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Catalog\Api\CategoryRepositoryInterface;
99
use Magento\Catalog\Model\Category;
1010

11+
/**
12+
* Class for generation category url_path
13+
*/
1114
class CategoryUrlPathGenerator
1215
{
1316
/**
@@ -61,9 +64,11 @@ public function __construct(
6164
* Build category URL path
6265
*
6366
* @param \Magento\Catalog\Api\Data\CategoryInterface|\Magento\Framework\Model\AbstractModel $category
67+
* @param null|\Magento\Catalog\Api\Data\CategoryInterface|\Magento\Framework\Model\AbstractModel $parentCategory
6468
* @return string
69+
* @throws \Magento\Framework\Exception\NoSuchEntityException
6570
*/
66-
public function getUrlPath($category)
71+
public function getUrlPath($category, $parentCategory = null)
6772
{
6873
if (in_array($category->getParentId(), [Category::ROOT_CATEGORY_ID, Category::TREE_ROOT_ID])) {
6974
return '';
@@ -77,15 +82,17 @@ public function getUrlPath($category)
7782
return $category->getUrlPath();
7883
}
7984
if ($this->isNeedToGenerateUrlPathForParent($category)) {
80-
$parentPath = $this->getUrlPath(
81-
$this->categoryRepository->get($category->getParentId(), $category->getStoreId())
82-
);
85+
$parentCategory = $parentCategory === null ?
86+
$this->categoryRepository->get($category->getParentId(), $category->getStoreId()) : $parentCategory;
87+
$parentPath = $this->getUrlPath($parentCategory);
8388
$path = $parentPath === '' ? $path : $parentPath . '/' . $path;
8489
}
8590
return $path;
8691
}
8792

8893
/**
94+
* Define whether we should generate URL path for parent
95+
*
8996
* @param \Magento\Catalog\Model\Category $category
9097
* @return bool
9198
*/

app/code/Magento/CatalogUrlRewrite/Observer/CategoryUrlPathAutogeneratorObserver.php

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,33 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7171
$useDefaultAttribute = !$category->isObjectNew() && !empty($category->getData('use_default')['url_key']);
7272
if ($category->getUrlKey() !== false && !$useDefaultAttribute) {
7373
$resultUrlKey = $this->categoryUrlPathGenerator->getUrlKey($category);
74-
if (empty($resultUrlKey)) {
75-
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid URL key'));
76-
}
77-
$category->setUrlKey($resultUrlKey)
78-
->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
79-
if (!$category->isObjectNew()) {
80-
$category->getResource()->saveAttribute($category, 'url_path');
81-
if ($category->dataHasChangedFor('url_path')) {
82-
$this->updateUrlPathForChildren($category);
83-
}
74+
$this->updateUrlKey($category, $resultUrlKey);
75+
} else if ($useDefaultAttribute) {
76+
$resultUrlKey = $category->formatUrlKey($category->getOrigData('name'));
77+
$this->updateUrlKey($category, $resultUrlKey);
78+
$category->setUrlKey(null)->setUrlPath(null);
79+
}
80+
}
81+
82+
/**
83+
* Update Url Key
84+
*
85+
* @param Category $category
86+
* @param string $urlKey
87+
* @throws \Magento\Framework\Exception\LocalizedException
88+
* @throws \Magento\Framework\Exception\NoSuchEntityException
89+
*/
90+
private function updateUrlKey($category, $urlKey)
91+
{
92+
if (empty($urlKey)) {
93+
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid URL key'));
94+
}
95+
$category->setUrlKey($urlKey)
96+
->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
97+
if (!$category->isObjectNew()) {
98+
$category->getResource()->saveAttribute($category, 'url_path');
99+
if ($category->dataHasChangedFor('url_path')) {
100+
$this->updateUrlPathForChildren($category);
84101
}
85102
}
86103
}
@@ -110,8 +127,13 @@ protected function updateUrlPathForChildren(Category $category)
110127
} else {
111128
$children = $this->childrenCategoriesProvider->getChildren($category, true);
112129
foreach ($children as $child) {
130+
/** @var Category $child */
113131
$child->setStoreId($category->getStoreId());
114-
$this->updateUrlPathForCategory($child);
132+
if ($child->getParentId() === $category->getId()) {
133+
$this->updateUrlPathForCategory($child, $category);
134+
} else {
135+
$this->updateUrlPathForCategory($child);
136+
}
115137
}
116138
}
117139
}
@@ -131,12 +153,14 @@ protected function isGlobalScope($storeId)
131153
* Update url path for category.
132154
*
133155
* @param Category $category
156+
* @param Category|null $parentCategory
134157
* @return void
158+
* @throws \Magento\Framework\Exception\NoSuchEntityException
135159
*/
136-
protected function updateUrlPathForCategory(Category $category)
160+
protected function updateUrlPathForCategory(Category $category, Category $parentCategory = null)
137161
{
138162
$category->unsUrlPath();
139-
$category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
163+
$category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category, $parentCategory));
140164
$category->getResource()->saveAttribute($category, 'url_path');
141165
}
142166
}

app/code/Magento/ConfigurableProduct/Block/Cart/Item/Renderer/Configurable.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,14 @@ public function getIdentities()
7070
}
7171
return $identities;
7272
}
73+
74+
/**
75+
* Get price for exact simple product added to cart
76+
*
77+
* @inheritdoc
78+
*/
79+
public function getProductPriceHtml(\Magento\Catalog\Model\Product $product)
80+
{
81+
return parent::getProductPriceHtml($this->getChildProduct());
82+
}
7383
}

app/code/Magento/Customer/Api/AccountManagementInterface.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ interface AccountManagementInterface
3131
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
3232
* @param string $password
3333
* @param string $redirectUrl
34+
* @param string[] $extensions
3435
* @return \Magento\Customer\Api\Data\CustomerInterface
3536
* @throws \Magento\Framework\Exception\LocalizedException
3637
*/
3738
public function createAccount(
3839
\Magento\Customer\Api\Data\CustomerInterface $customer,
3940
$password = null,
40-
$redirectUrl = ''
41+
$redirectUrl = '',
42+
$extensions = []
4143
);
4244

4345
/**
@@ -48,6 +50,7 @@ public function createAccount(
4850
* @param string $hash Password hash that we can save directly
4951
* @param string $redirectUrl URL fed to welcome email templates. Can be used by templates to, for example, direct
5052
* the customer to a product they were looking at after pressing confirmation link.
53+
* @param string[] $extensions
5154
* @return \Magento\Customer\Api\Data\CustomerInterface
5255
* @throws \Magento\Framework\Exception\InputException If bad input is provided
5356
* @throws \Magento\Framework\Exception\State\InputMismatchException If the provided email is already used
@@ -56,7 +59,8 @@ public function createAccount(
5659
public function createAccountWithPasswordHash(
5760
\Magento\Customer\Api\Data\CustomerInterface $customer,
5861
$hash,
59-
$redirectUrl = ''
62+
$redirectUrl = '',
63+
$extensions = []
6064
);
6165

6266
/**

0 commit comments

Comments
 (0)