Skip to content

Commit 3f88a05

Browse files
ENGCOM-3573: Forword Port : Fixed-19379-Tax Rate Checkbox alignment issue #19383 #19413
- Merge Pull Request #19413 from suryakant-krish/magento2:fixed-2.3-dev-19379 - Merged commits: 1. d0d8725 2. 8b7e683 3. 02384d7 4. 734e95e
2 parents e8cd849 + 734e95e commit 3f88a05

File tree

87 files changed

+2654
-369
lines changed

Some content is hidden

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

87 files changed

+2654
-369
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminSlideOutDialogSection">
12+
<element name="closeButton" type="button" selector=".modal-slide._show [data-role='closeBtn']" timeout="30"/>
13+
<element name="cancelButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Cancel']" timeout="30"/>
14+
<element name="doneButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Done']" timeout="30"/>
15+
<element name="saveButton" type="button" selector="//*[contains(@class, 'modal-slide') and contains(@class, '_show')]//*[contains(@class, 'page-actions')]//button[normalize-space(.)='Save']" timeout="30"/>
16+
</section>
17+
</sections>

app/code/Magento/Braintree/Test/Mftf/Test/BraintreeCreditCardOnCheckoutTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="StorefrontFillCartDataActionGroup"/>
6666
<waitForPageLoad stepKey="waitForPageLoad4"/>
6767
<!--Place order-->
68-
<click selector="{{CheckoutPaymentSection.placeOrder}}"
68+
<click selector="{{BraintreeConfigurationPaymentSection.paymentMethodContainer}}{{CheckoutPaymentSection.placeOrder}}"
6969
stepKey="PlaceOrder"/>
7070
<waitForPageLoad stepKey="waitForPageLoad5"/>
7171

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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\Attribute\Backend\TierPrice;
9+
10+
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
11+
use Magento\Store\Model\StoreManagerInterface;
12+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
13+
use Magento\Catalog\Api\Data\ProductInterface;
14+
use Magento\Customer\Api\GroupManagementInterface;
15+
use Magento\Framework\EntityManager\MetadataPool;
16+
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice;
17+
18+
/**
19+
* Tier price data abstract handler.
20+
*/
21+
abstract class AbstractHandler implements ExtensionInterface
22+
{
23+
/**
24+
* @var \Magento\Customer\Api\GroupManagementInterface
25+
*/
26+
protected $groupManagement;
27+
28+
/**
29+
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
30+
*/
31+
public function __construct(
32+
GroupManagementInterface $groupManagement
33+
) {
34+
$this->groupManagement = $groupManagement;
35+
}
36+
37+
/**
38+
* Get additional tier price fields.
39+
*
40+
* @param array $objectArray
41+
* @return array
42+
*/
43+
protected function getAdditionalFields(array $objectArray): array
44+
{
45+
$percentageValue = $this->getPercentage($objectArray);
46+
47+
return [
48+
'value' => $percentageValue ? null : $objectArray['price'],
49+
'percentage_value' => $percentageValue ?: null,
50+
];
51+
}
52+
53+
/**
54+
* Check whether price has percentage value.
55+
*
56+
* @param array $priceRow
57+
* @return float|null
58+
*/
59+
protected function getPercentage(array $priceRow): ?float
60+
{
61+
return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value'])
62+
? (float)$priceRow['percentage_value']
63+
: null;
64+
}
65+
66+
/**
67+
* Prepare tier price data by provided price row data.
68+
*
69+
* @param array $data
70+
* @return array
71+
* @throws \Magento\Framework\Exception\LocalizedException
72+
*/
73+
protected function prepareTierPrice(array $data): array
74+
{
75+
$useForAllGroups = (int)$data['cust_group'] === $this->groupManagement->getAllCustomersGroup()->getId();
76+
$customerGroupId = $useForAllGroups ? 0 : $data['cust_group'];
77+
$tierPrice = array_merge(
78+
$this->getAdditionalFields($data),
79+
[
80+
'website_id' => $data['website_id'],
81+
'all_groups' => (int)$useForAllGroups,
82+
'customer_group_id' => $customerGroupId,
83+
'value' => $data['price'] ?? null,
84+
'qty' => $this->parseQty($data['price_qty']),
85+
]
86+
);
87+
88+
return $tierPrice;
89+
}
90+
91+
/**
92+
* Parse quantity value into float.
93+
*
94+
* @param mixed $value
95+
* @return float|int
96+
*/
97+
protected function parseQty($value)
98+
{
99+
return $value * 1;
100+
}
101+
}

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/**
1919
* Process tier price data for handled new product
2020
*/
21-
class SaveHandler implements ExtensionInterface
21+
class SaveHandler extends AbstractHandler
2222
{
2323
/**
2424
* @var \Magento\Store\Model\StoreManagerInterface
@@ -30,11 +30,6 @@ class SaveHandler implements ExtensionInterface
3030
*/
3131
private $attributeRepository;
3232

33-
/**
34-
* @var \Magento\Customer\Api\GroupManagementInterface
35-
*/
36-
private $groupManagement;
37-
3833
/**
3934
* @var \Magento\Framework\EntityManager\MetadataPool
4035
*/
@@ -59,9 +54,10 @@ public function __construct(
5954
MetadataPool $metadataPool,
6055
Tierprice $tierPriceResource
6156
) {
57+
parent::__construct($groupManagement);
58+
6259
$this->storeManager = $storeManager;
6360
$this->attributeRepository = $attributeRepository;
64-
$this->groupManagement = $groupManagement;
6561
$this->metadataPoll = $metadataPool;
6662
$this->tierPriceResource = $tierPriceResource;
6763
}
@@ -72,8 +68,6 @@ public function __construct(
7268
* @param \Magento\Catalog\Api\Data\ProductInterface|object $entity
7369
* @param array $arguments
7470
* @return \Magento\Catalog\Api\Data\ProductInterface|object
75-
* @throws \Magento\Framework\Exception\NoSuchEntityException
76-
* @throws \Magento\Framework\Exception\LocalizedException
7771
* @throws \Magento\Framework\Exception\InputException
7872
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7973
*/
@@ -115,57 +109,4 @@ public function execute($entity, $arguments = [])
115109

116110
return $entity;
117111
}
118-
119-
/**
120-
* Get additional tier price fields
121-
*
122-
* @param array $objectArray
123-
* @return array
124-
*/
125-
private function getAdditionalFields(array $objectArray): array
126-
{
127-
$percentageValue = $this->getPercentage($objectArray);
128-
return [
129-
'value' => $percentageValue ? null : $objectArray['price'],
130-
'percentage_value' => $percentageValue ?: null,
131-
];
132-
}
133-
134-
/**
135-
* Check whether price has percentage value.
136-
*
137-
* @param array $priceRow
138-
* @return float|null
139-
*/
140-
private function getPercentage(array $priceRow): ?float
141-
{
142-
return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value'])
143-
? (float)$priceRow['percentage_value']
144-
: null;
145-
}
146-
147-
/**
148-
* Prepare tier price data by provided price row data
149-
*
150-
* @param array $data
151-
* @return array
152-
* @throws \Magento\Framework\Exception\LocalizedException
153-
*/
154-
private function prepareTierPrice(array $data): array
155-
{
156-
$useForAllGroups = (int)$data['cust_group'] === $this->groupManagement->getAllCustomersGroup()->getId();
157-
$customerGroupId = $useForAllGroups ? 0 : $data['cust_group'];
158-
$tierPrice = array_merge(
159-
$this->getAdditionalFields($data),
160-
[
161-
'website_id' => $data['website_id'],
162-
'all_groups' => (int)$useForAllGroups,
163-
'customer_group_id' => $customerGroupId,
164-
'value' => $data['price'] ?? null,
165-
'qty' => (int)$data['price_qty']
166-
]
167-
);
168-
169-
return $tierPrice;
170-
}
171112
}

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
use Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice;
1717

1818
/**
19-
* Process tier price data for handled existing product
19+
* Process tier price data for handled existing product.
2020
*/
21-
class UpdateHandler implements ExtensionInterface
21+
class UpdateHandler extends AbstractHandler
2222
{
2323
/**
2424
* @var \Magento\Store\Model\StoreManagerInterface
@@ -30,11 +30,6 @@ class UpdateHandler implements ExtensionInterface
3030
*/
3131
private $attributeRepository;
3232

33-
/**
34-
* @var \Magento\Customer\Api\GroupManagementInterface
35-
*/
36-
private $groupManagement;
37-
3833
/**
3934
* @var \Magento\Framework\EntityManager\MetadataPool
4035
*/
@@ -59,9 +54,10 @@ public function __construct(
5954
MetadataPool $metadataPool,
6055
Tierprice $tierPriceResource
6156
) {
57+
parent::__construct($groupManagement);
58+
6259
$this->storeManager = $storeManager;
6360
$this->attributeRepository = $attributeRepository;
64-
$this->groupManagement = $groupManagement;
6561
$this->metadataPoll = $metadataPool;
6662
$this->tierPriceResource = $tierPriceResource;
6763
}
@@ -72,8 +68,7 @@ public function __construct(
7268
* @param \Magento\Catalog\Api\Data\ProductInterface|object $entity
7369
* @param array $arguments
7470
* @return \Magento\Catalog\Api\Data\ProductInterface|object
75-
* @throws \Magento\Framework\Exception\NoSuchEntityException
76-
* @throws \Magento\Framework\Exception\LocalizedException
71+
* @throws \Magento\Framework\Exception\InputException
7772
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
7873
*/
7974
public function execute($entity, $arguments = [])
@@ -119,34 +114,6 @@ public function execute($entity, $arguments = [])
119114
return $entity;
120115
}
121116

122-
/**
123-
* Get additional tier price fields
124-
*
125-
* @param array $objectArray
126-
* @return array
127-
*/
128-
private function getAdditionalFields(array $objectArray): array
129-
{
130-
$percentageValue = $this->getPercentage($objectArray);
131-
return [
132-
'value' => $percentageValue ? null : $objectArray['price'],
133-
'percentage_value' => $percentageValue ?: null,
134-
];
135-
}
136-
137-
/**
138-
* Check whether price has percentage value.
139-
*
140-
* @param array $priceRow
141-
* @return float|null
142-
*/
143-
private function getPercentage(array $priceRow): ?float
144-
{
145-
return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value'])
146-
? (float)$priceRow['percentage_value']
147-
: null;
148-
}
149-
150117
/**
151118
* Update existing tier prices for processed product
152119
*
@@ -226,39 +193,15 @@ private function deleteValues(int $productId, array $valuesToDelete): bool
226193
*/
227194
private function getPriceKey(array $priceData): string
228195
{
196+
$qty = $this->parseQty($priceData['price_qty']);
229197
$key = implode(
230198
'-',
231-
array_merge([$priceData['website_id'], $priceData['cust_group']], [(int)$priceData['price_qty']])
199+
array_merge([$priceData['website_id'], $priceData['cust_group']], [$qty])
232200
);
233201

234202
return $key;
235203
}
236204

237-
/**
238-
* Prepare tier price data by provided price row data
239-
*
240-
* @param array $data
241-
* @return array
242-
* @throws \Magento\Framework\Exception\LocalizedException
243-
*/
244-
private function prepareTierPrice(array $data): array
245-
{
246-
$useForAllGroups = (int)$data['cust_group'] === $this->groupManagement->getAllCustomersGroup()->getId();
247-
$customerGroupId = $useForAllGroups ? 0 : $data['cust_group'];
248-
$tierPrice = array_merge(
249-
$this->getAdditionalFields($data),
250-
[
251-
'website_id' => $data['website_id'],
252-
'all_groups' => (int)$useForAllGroups,
253-
'customer_group_id' => $customerGroupId,
254-
'value' => $data['price'] ?? null,
255-
'qty' => (int)$data['price_qty']
256-
]
257-
);
258-
259-
return $tierPrice;
260-
}
261-
262205
/**
263206
* Check by id is website global
264207
*

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ public function loadProductCount($items, $countRegular = true, $countAnchor = tr
322322
['e' => $this->getTable('catalog_category_entity')],
323323
'main_table.category_id=e.entity_id',
324324
[]
325-
)->where('e.entity_id = :entity_id OR e.path LIKE :c_path');
325+
)->where(
326+
'(e.entity_id = :entity_id OR e.path LIKE :c_path)'
327+
);
326328
if ($websiteId) {
327329
$select->join(
328330
['w' => $this->getProductWebsiteTable()],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="StorefrontMessagesSection">
1212
<element name="success" type="text" selector="div.message-success.success.message"/>
1313
<element name="error" type="text" selector="div.message-error.error.message"/>
14+
<element name="noticeMessage" type="text" selector="div.message-notice"/>
1415
</section>
1516
</sections>

0 commit comments

Comments
 (0)