Skip to content

Commit 77af5d6

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #18795: [Forwardport] Fix customer unsubscribed issue (by @janakbhimani) - #18788: Remove useless semicolon statements (by @mage2pratik) - #18792: Remove unnecessary conditional statements (by @gy741) - #18782: [Forwardport] 15259 : Unable to disable without providing Industry value (by @mage2pratik) - #18771: Cover \Magento\CheckoutAgreements\Model\ResourceModel\Agreement\Grid\Collection class with Integration test (by @TomashKhamlai) - #18764: Replace intval() function by using direct type casting to (int) (by @gelanivishal) - #18751: Language cleanup on mass actions from the Customers grid (by @p-maguire) - #18756: Remove Duplicate field (by @gy741) - #18714: Fix for Issue #4468 "Unable to insert multiple catalog product list widgets (with pager) in CMS page" (by @vasilii-b) - #18730: Sections LESS mixins: fix the issue with missing rules and incorrect default variables (by @dmytro-ch) - #18689: ISSUE-5021 - fixed place order for custom shipping methods with under… (by @idziakjakub) - #18720: Prevent exception when option text converts to false (by @pmclain) - #18725: Fix Useless use of Cat (by @gy741) - #18412: Fixes #18357 - SQL error when table prefix used. (by @pocallaghan) - magento-engcom/import-export-improvements#120: MAGETWO-34709 Changing empty label value for first option on dropdown filters. (by @valentinboyanov) - #18704: Allow set billing information via API with existing address (by @pmclain) - #18095: #17744 Adding logic to get default billing address used on Cart and Checkout (by @LucasCalazans) - #18679: Set fallback values for email and _website columns to avoid 'undefined index' error in CustomerComposite.php (by @TomashKhamlai) - #18639: Fix SKU limit in import new products (by @ravi-chandra3197) - #18622: [BUGFIX] [issue-10205] Always set the entity_type_id for updating pro� (by @lewisvoncken) - #18611: Ensure integer values are not quoted as strings (by @udovicic) - #18631: Reference pull request of #18604 for 2.3-develop (by @maheshWebkul721) - #18388: Add class into image builder (by @VincentMarmiesse) - #18790: fixed Product Advanced Pricing design issue #18775 (by @ashutoshwebkul) - #18019: Adding trimming sku value function to sku backend model. (by @bartoszkubicki) Fixed GitHub Issues: - #17954: Customer get unsubscribe to newsletter on password reset email request with Newsletter Need to Confirm Set to Yes on admin settings (reported by @matin73) has been fixed in #18795 by @janakbhimani in 2.3-develop branch Related commits: 1. 6e9d5e5 - #15259: Advanced Reporting > Unable to disable without providing Industry value (reported by @Detzler) has been fixed in #18782 by @mage2pratik in 2.3-develop branch Related commits: 1. 6862c04 - #18357: checkout_agreement_store doesn't exist (reported by @michelecanal) has been fixed in #18771 by @TomashKhamlai in 2.3-develop branch Related commits: 1. 3cba00c 2. 86e035f - #4468: Unable to insert multiple catalog product list widgets in CMS page (reported by @kandrejevs) has been fixed in #18714 by @vasilii-b in 2.3-develop branch Related commits: 1. 0a25364 - #18729: Bug in "_sections.less" mixins: missing rules and incorrect default variables (reported by @dmytro-ch) has been fixed in #18730 by @dmytro-ch in 2.3-develop branch Related commits: 1. 19a2d2f 2. 310afd8 - #5021: "Please specify a shipping method" Exception (reported by @vphat28) has been fixed in #18689 by @idziakjakub in 2.3-develop branch Related commits: 1. 9688034 - #13083: OptionManagement.validateOption throws NoSuchEntityException for "0" option label (reported by @rzinnatullin) has been fixed in #18720 by @pmclain in 2.3-develop branch Related commits: 1. ed6a2fb - #18357: checkout_agreement_store doesn't exist (reported by @michelecanal) has been fixed in #18412 by @pocallaghan in 2.3-develop branch Related commits: 1. 2bee366 - #17485: Adding billing information via mine API expects costumer id (reported by @wittyvishwas) has been fixed in #18704 by @pmclain in 2.3-develop branch Related commits: 1. 7584f71 - #17744: Virtual-only quotes use default shipping address for estimation instead of default billing address (reported by @navarr) has been fixed in #18095 by @LucasCalazans in 2.3-develop branch Related commits: 1. a44eb5d 2. 0890139 3. 5372c7d 4. b871ea9 5. ec5d9b7 6. a862620 7. f3bad34 - #17865: import new products via csv: products are created with empty value when strings are too long (reported by @LouNik1984) has been fixed in #18639 by @ravi-chandra3197 in 2.3-develop branch Related commits: 1. 499cdd7 2. a9bc411 3. b65b49f 4. 5790225 - #10205: REST API /V1/products/attributes does not update all properties (reported by @sazzle2611) has been fixed in #18622 by @lewisvoncken in 2.3-develop branch Related commits: 1. 42ecb9c - #18268: M2.2.6 : Special price of 0.0000 is not shown on frontend, but is calculated in cart (reported by @kanduvisla) has been fixed in #18631 by @maheshWebkul721 in 2.3-develop branch Related commits: 1. e30a12e - #18775: Product Advanced Pricing design issue (reported by @saphaljha) has been fixed in #18790 by @ashutoshwebkul in 2.3-develop branch Related commits: 1. 6bb8258 - #12300: SKU values are not trimmed with the space. (reported by @ShaileshChauhan92) has been fixed in #18019 by @bartoszkubicki in 2.3-develop branch Related commits: 1. 6c168dd - #16572: Trim whitespace on SKU when saving product (reported by @Zyles) has been fixed in #18019 by @bartoszkubicki in 2.3-develop branch Related commits: 1. 6c168dd
2 parents eb27ac2 + 413e489 commit 77af5d6

File tree

70 files changed

+361
-139
lines changed

Some content is hidden

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

70 files changed

+361
-139
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
<source_model>Magento\Analytics\Model\Config\Source\Vertical</source_model>
3737
<backend_model>Magento\Analytics\Model\Config\Backend\Vertical</backend_model>
3838
<frontend_model>Magento\Analytics\Block\Adminhtml\System\Config\Vertical</frontend_model>
39+
<depends>
40+
<field id="analytics/general/enabled">1</field>
41+
</depends>
3942
</field>
4043
<field id="additional_comment" translate="label comment" type="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
4144
<label><![CDATA[<strong>Get more insights from Magento Business Intelligence</strong>]]></label>

app/code/Magento/Catalog/Block/Product/Image.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
namespace Magento\Catalog\Block\Product;
77

88
/**
9+
* Product image block
10+
*
911
* @api
1012
* @method string getImageUrl()
1113
* @method string getWidth()
1214
* @method string getHeight()
1315
* @method string getLabel()
1416
* @method float getRatio()
1517
* @method string getCustomAttributes()
18+
* @method string getClass()
1619
* @since 100.0.2
1720
*/
1821
class Image extends \Magento\Framework\View\Element\Template

app/code/Magento/Catalog/Block/Product/ImageFactory.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,29 @@ private function getStringCustomAttributes(array $attributes): string
7777
{
7878
$result = [];
7979
foreach ($attributes as $name => $value) {
80-
$result[] = $name . '="' . $value . '"';
80+
if ($name != 'class') {
81+
$result[] = $name . '="' . $value . '"';
82+
}
8183
}
8284
return !empty($result) ? implode(' ', $result) : '';
8385
}
8486

87+
/**
88+
* Retrieve image class for HTML element
89+
*
90+
* @param array $attributes
91+
* @return string
92+
*/
93+
private function getClass(array $attributes): string
94+
{
95+
return $attributes['class'] ?? 'product-image-photo';
96+
}
97+
8598
/**
8699
* Calculate image ratio
87100
*
88-
* @param $width
89-
* @param $height
101+
* @param int $width
102+
* @param int $height
90103
* @return float
91104
*/
92105
private function getRatio(int $width, int $height): float
@@ -98,8 +111,9 @@ private function getRatio(int $width, int $height): float
98111
}
99112

100113
/**
101-
* @param Product $product
114+
* Get image label
102115
*
116+
* @param Product $product
103117
* @param string $imageType
104118
* @return string
105119
*/
@@ -114,6 +128,7 @@ private function getLabel(Product $product, string $imageType): string
114128

115129
/**
116130
* Create image block from product
131+
*
117132
* @param Product $product
118133
* @param string $imageId
119134
* @param array|null $attributes
@@ -154,6 +169,7 @@ public function create(Product $product, string $imageId, array $attributes = nu
154169
'label' => $this->getLabel($product, $imageMiscParams['image_type']),
155170
'ratio' => $this->getRatio($imageMiscParams['image_width'], $imageMiscParams['image_height']),
156171
'custom_attributes' => $this->getStringCustomAttributes($attributes),
172+
'class' => $this->getClass($attributes),
157173
'product_id' => $product->getId()
158174
],
159175
];

app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ProductCategoryCondition.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class ProductCategoryCondition implements CustomConditionInterface
3838

3939
/**
4040
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
41+
* @param \Magento\Catalog\Model\CategoryRepository $categoryRepository
4142
*/
4243
public function __construct(
4344
\Magento\Framework\App\ResourceConnection $resourceConnection,
@@ -104,7 +105,7 @@ private function getCategoryIds(Filter $filter): array
104105
}
105106
}
106107

107-
return array_unique(array_merge($categoryIds, ...$childCategoryIds));
108+
return array_map('intval', array_unique(array_merge($categoryIds, ...$childCategoryIds)));
108109
}
109110

110111
/**

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Catalog product SKU backend attribute model
9-
*
10-
* @author Magento Core Team <[email protected]>
11-
*/
127
namespace Magento\Catalog\Model\Product\Attribute\Backend;
138

149
use Magento\Catalog\Model\Product;
1510

11+
/**
12+
* Catalog product SKU backend attribute model.
13+
*/
1614
class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
1715
{
1816
/**
@@ -97,6 +95,7 @@ protected function _generateUniqueSku($object)
9795
public function beforeSave($object)
9896
{
9997
$this->_generateUniqueSku($object);
98+
$this->trimValue($object);
10099
return parent::beforeSave($object);
101100
}
102101

@@ -127,4 +126,19 @@ protected function _getLastSimilarAttributeValueIncrement($attribute, $object)
127126
$data = $connection->fetchOne($select, $bind);
128127
return abs((int)str_replace($value, '', $data));
129128
}
129+
130+
/**
131+
* Remove extra spaces from attribute value before save.
132+
*
133+
* @param Product $object
134+
* @return void
135+
*/
136+
private function trimValue($object)
137+
{
138+
$attrCode = $this->getAttribute()->getAttributeCode();
139+
$value = $object->getData($attrCode);
140+
if ($value) {
141+
$object->setData($attrCode, trim($value));
142+
}
143+
}
130144
}

app/code/Magento/Catalog/Model/Product/Attribute/Repository.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\Exception\NoSuchEntityException;
1212

1313
/**
14+
* Product attribute repository
15+
*
1416
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1517
*/
1618
class Repository implements \Magento\Catalog\Api\ProductAttributeRepositoryInterface
@@ -78,7 +80,7 @@ public function __construct(
7880
}
7981

8082
/**
81-
* {@inheritdoc}
83+
* @inheritdoc
8284
*/
8385
public function get($attributeCode)
8486
{
@@ -89,7 +91,7 @@ public function get($attributeCode)
8991
}
9092

9193
/**
92-
* {@inheritdoc}
94+
* @inheritdoc
9395
*/
9496
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
9597
{
@@ -100,12 +102,17 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
100102
}
101103

102104
/**
103-
* {@inheritdoc}
105+
* @inheritdoc
104106
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
105107
* @SuppressWarnings(PHPMD.NPathComplexity)
106108
*/
107109
public function save(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute)
108110
{
111+
$attribute->setEntityTypeId(
112+
$this->eavConfig
113+
->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE)
114+
->getId()
115+
);
109116
if ($attribute->getAttributeId()) {
110117
$existingModel = $this->get($attribute->getAttributeCode());
111118

@@ -144,11 +151,6 @@ public function save(\Magento\Catalog\Api\Data\ProductAttributeInterface $attrib
144151
$attribute->setBackendModel(
145152
$this->productHelper->getAttributeBackendModelByInputType($attribute->getFrontendInput())
146153
);
147-
$attribute->setEntityTypeId(
148-
$this->eavConfig
149-
->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE)
150-
->getId()
151-
);
152154
$attribute->setIsUserDefined(1);
153155
}
154156
if (!empty($attribute->getData(AttributeInterface::OPTIONS))) {
@@ -180,7 +182,7 @@ public function save(\Magento\Catalog\Api\Data\ProductAttributeInterface $attrib
180182
}
181183

182184
/**
183-
* {@inheritdoc}
185+
* @inheritdoc
184186
*/
185187
public function delete(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute)
186188
{
@@ -189,7 +191,7 @@ public function delete(\Magento\Catalog\Api\Data\ProductAttributeInterface $attr
189191
}
190192

191193
/**
192-
* {@inheritdoc}
194+
* @inheritdoc
193195
*/
194196
public function deleteById($attributeCode)
195197
{
@@ -200,7 +202,7 @@ public function deleteById($attributeCode)
200202
}
201203

202204
/**
203-
* {@inheritdoc}
205+
* @inheritdoc
204206
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
205207
*/
206208
public function getCustomAttributesMetadata($dataObjectClassName = null)

app/code/Magento/Catalog/Model/ProductCategoryList.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ public function getCategoryIds($productId)
8080
Select::SQL_UNION_ALL
8181
);
8282

83-
$this->categoryIdList[$productId] = $this->productResource->getConnection()->fetchCol($unionSelect);
83+
$this->categoryIdList[$productId] = array_map(
84+
'intval',
85+
$this->productResource->getConnection()->fetchCol($unionSelect)
86+
);
8487
}
8588

8689
return $this->categoryIdList[$productId];

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,8 @@ protected function _productLimitationJoinWebsite()
18091809
}
18101810
$conditions[] = $this->getConnection()->quoteInto(
18111811
'product_website.website_id IN(?)',
1812-
$filters['website_ids']
1812+
$filters['website_ids'],
1813+
'int'
18131814
);
18141815
} elseif (isset(
18151816
$filters['store_id']
@@ -1821,7 +1822,7 @@ protected function _productLimitationJoinWebsite()
18211822
) {
18221823
$joinWebsite = true;
18231824
$websiteId = $this->_storeManager->getStore($filters['store_id'])->getWebsiteId();
1824-
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId);
1825+
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId, 'int');
18251826
}
18261827

18271828
$fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM);
@@ -2017,12 +2018,16 @@ protected function _applyProductLimitations()
20172018

20182019
$conditions = [
20192020
'cat_index.product_id=e.entity_id',
2020-
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id']),
2021+
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id'], 'int'),
20212022
];
20222023
if (isset($filters['visibility']) && !isset($filters['store_table'])) {
2023-
$conditions[] = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility']);
2024+
$conditions[] = $this->getConnection()->quoteInto(
2025+
'cat_index.visibility IN(?)',
2026+
$filters['visibility'],
2027+
'int'
2028+
);
20242029
}
2025-
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id']);
2030+
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id'], 'int');
20262031
if (isset($filters['category_is_anchor'])) {
20272032
$conditions[] = $this->getConnection()->quoteInto('cat_index.is_parent=?', $filters['category_is_anchor']);
20282033
}

app/code/Magento/Catalog/Pricing/Price/BasePrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getValue()
3030
$this->value = false;
3131
foreach ($this->priceInfo->getPrices() as $price) {
3232
if ($price instanceof BasePriceProviderInterface && $price->getValue() !== false) {
33-
$this->value = min($price->getValue(), $this->value ?: $price->getValue());
33+
$this->value = min($price->getValue(), $this->value !== false ? $this->value: $price->getValue());
3434
}
3535
}
3636
}

app/code/Magento/Catalog/Test/Unit/Block/Product/ImageFactoryTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ private function getTestDataWithoutAttributes(): array
145145
'label' => 'test_image_label',
146146
'ratio' => 1,
147147
'custom_attributes' => '',
148-
'product_id' => null
148+
'product_id' => null,
149+
'class' => 'product-image-photo'
149150
],
150151
],
151152
];
@@ -190,6 +191,7 @@ private function getTestDataWithAttributes(): array
190191
'custom_attributes' => [
191192
'name_1' => 'value_1',
192193
'name_2' => 'value_2',
194+
'class' => 'my-class'
193195
],
194196
],
195197
'expected' => [
@@ -201,7 +203,8 @@ private function getTestDataWithAttributes(): array
201203
'label' => 'test_product_name',
202204
'ratio' => 0.5, // <==
203205
'custom_attributes' => 'name_1="value_1" name_2="value_2"',
204-
'product_id' => null
206+
'product_id' => null,
207+
'class' => 'my-class'
205208
],
206209
],
207210
];

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ public function __construct(
5858
}
5959

6060
/**
61-
* {@inheritdoc}
61+
* Customize number fields for advanced price and weight fields.
62+
*
6263
* @since 101.0.0
64+
* @param array $data
65+
* @return array
6366
* @throws \Magento\Framework\Exception\NoSuchEntityException
6467
*/
6568
public function modifyData(array $data)
@@ -130,8 +133,11 @@ protected function customizeAdvancedPriceFormat(array $data)
130133
}
131134

132135
/**
133-
* {@inheritdoc}
136+
* Customize product form fields.
137+
*
134138
* @since 101.0.0
139+
* @param array $meta
140+
* @return array
135141
*/
136142
public function modifyMeta(array $meta)
137143
{
@@ -361,7 +367,8 @@ protected function customizeNameListeners(array $meta)
361367
$skuPath . static::META_CONFIG_PATH,
362368
$meta,
363369
[
364-
'autoImportIfEmpty' => true
370+
'autoImportIfEmpty' => true,
371+
'validation' => ['no-marginal-whitespace' => true]
365372
]
366373
);
367374

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main/tree/attribute.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/**
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
5-
*/;
5+
*/

app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
style="width:<?= /* @escapeNotVerified */ $block->getWidth() ?>px;">
1111
<span class="product-image-wrapper"
1212
style="padding-bottom: <?= /* @escapeNotVerified */ ($block->getRatio() * 100) ?>%;">
13-
<img class="product-image-photo"
13+
<img class="<?= /* @escapeNotVerified */ $block->getClass() ?>"
1414
<?= /* @escapeNotVerified */ $block->getCustomAttributes() ?>
1515
src="<?= /* @escapeNotVerified */ $block->getImageUrl() ?>"
1616
max-width="<?= /* @escapeNotVerified */ $block->getWidth() ?>"

0 commit comments

Comments
 (0)