Skip to content

Commit 1634d33

Browse files
ENGCOM-4406: #12396: Total Amount cart rule without tax #21288
- Merge Pull Request #21288 from AleksLi/msi:MC-12396-subtotal-excl-tax - Merged commits: 1. 6ae859a 2. c25656b 3. 23ed015 4. e9389ee 5. 571f055
2 parents 7481afe + 571f055 commit 1634d33

File tree

12 files changed

+105
-25
lines changed

12 files changed

+105
-25
lines changed

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,6 @@ protected function modifyPriceData($object, $data)
165165
/** @var \Magento\Catalog\Model\Product $object */
166166
$data = parent::modifyPriceData($object, $data);
167167
$price = $object->getPrice();
168-
169-
$specialPrice = $object->getSpecialPrice();
170-
$specialPriceFromDate = $object->getSpecialFromDate();
171-
$specialPriceToDate = $object->getSpecialToDate();
172-
$today = time();
173-
174-
if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())) {
175-
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
176-
$today >= strtotime($specialPriceFromDate) && $specialPriceToDate === null) {
177-
$price = $specialPrice;
178-
}
179-
}
180-
181168
foreach ($data as $key => $tierPrice) {
182169
$percentageValue = $this->getPercentage($tierPrice);
183170
if ($percentageValue) {

app/code/Magento/CatalogAnalytics/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"require": {
55
"php": "~7.1.3||~7.2.0",
66
"magento/framework": "*",
7-
"magento/module-catalog": "*"
7+
"magento/module-catalog": "*",
8+
"magento/module-analytics": "*"
89
},
910
"type": "magento2-module",
1011
"license": [

app/code/Magento/CustomerAnalytics/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"require": {
55
"php": "~7.1.3||~7.2.0",
66
"magento/framework": "*",
7-
"magento/module-customer": "*"
7+
"magento/module-customer": "*",
8+
"magento/module-analytics": "*"
89
},
910
"type": "magento2-module",
1011
"license": [

app/code/Magento/GiftMessage/Model/CompositeConfigProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\Checkout\Model\ConfigProviderInterface;
99

10+
/**
11+
* Class CompositeConfigProvider
12+
*/
1013
class CompositeConfigProvider implements ConfigProviderInterface
1114
{
1215
/**
@@ -18,13 +21,13 @@ class CompositeConfigProvider implements ConfigProviderInterface
1821
* @param ConfigProviderInterface[] $configProviders
1922
*/
2023
public function __construct(
21-
array $configProviders
24+
array $configProviders = []
2225
) {
2326
$this->configProviders = $configProviders;
2427
}
2528

2629
/**
27-
* {@inheritdoc}
30+
* @inheritdoc
2831
*/
2932
public function getConfig()
3033
{

app/code/Magento/QuoteAnalytics/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"require": {
55
"php": "~7.1.3||~7.2.0",
66
"magento/framework": "*",
7-
"magento/module-quote": "*"
7+
"magento/module-quote": "*",
8+
"magento/module-analytics": "*"
89
},
910
"type": "magento2-module",
1011
"license": [

app/code/Magento/ReviewAnalytics/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"require": {
55
"php": "~7.1.3||~7.2.0",
66
"magento/framework": "*",
7-
"magento/module-review": "*"
7+
"magento/module-review": "*",
8+
"magento/module-analytics": "*"
89
},
910
"type": "magento2-module",
1011
"license": [

app/code/Magento/SalesAnalytics/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"require": {
55
"php": "~7.1.3||~7.2.0",
66
"magento/framework": "*",
7-
"magento/module-sales": "*"
7+
"magento/module-sales": "*",
8+
"magento/module-analytics": "*"
89
},
910
"type": "magento2-module",
1011
"license": [

app/code/Magento/WishlistAnalytics/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"require": {
55
"php": "~7.1.3||~7.2.0",
66
"magento/framework": "*",
7-
"magento/module-wishlist": "*"
7+
"magento/module-wishlist": "*",
8+
"magento/module-analytics": "*"
89
},
910
"type": "magento2-module",
1011
"license": [

dev/tests/functional/lib/Magento/Mtf/Client/Element/ConditionsElement.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,13 @@ class ConditionsElement extends SimpleElement
195195
*/
196196
protected $exception;
197197

198+
/**
199+
* Condition option text selector.
200+
*
201+
* @var string
202+
*/
203+
private $conditionOptionTextSelector = '//option[normalize-space(text())="%s"]';
204+
198205
/**
199206
* @inheritdoc
200207
*/
@@ -282,10 +289,16 @@ protected function addCondition($type, ElementInterface $context)
282289
$count = 0;
283290

284291
do {
285-
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
286-
287292
try {
288-
$newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')->setValue($type);
293+
$specificType = $newCondition->find(
294+
sprintf($this->conditionOptionTextSelector, $type),
295+
Locator::SELECTOR_XPATH
296+
)->isPresent();
297+
$newCondition->find($this->addNew, Locator::SELECTOR_XPATH)->click();
298+
$condition = $specificType
299+
? $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'selectcondition')
300+
: $newCondition->find($this->typeNew, Locator::SELECTOR_XPATH, 'select');
301+
$condition->setValue($type);
289302
$isSetType = true;
290303
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
291304
$isSetType = false;

dev/tests/functional/lib/Magento/Mtf/Client/Element/SelectconditionElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2017 Magento. All rights reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\TestFramework\Dependency;
10+
11+
/**
12+
* Class provides dependency rule for analytics.xml config file.
13+
*/
14+
class AnalyticsConfigRule implements RuleInterface
15+
{
16+
/**
17+
* @inheritdoc
18+
*/
19+
public function getDependencyInfo($currentModule, $fileType, $file, &$contents)
20+
{
21+
if ('config' != $fileType || !preg_match('#.*/analytics\.xml$#', $file)) {
22+
return [];
23+
}
24+
25+
$dependenciesInfo = [];
26+
if (preg_match_all('#<[customProvider|reportProvider][^>]*class=[\'"]([^\'"]+)[\'"]#i', $contents, $matches)) {
27+
$classes = array_pop($matches);
28+
foreach ($classes as $class) {
29+
$classParts = explode('\\', $class);
30+
$module = implode('\\', array_slice($classParts, 0, 2));
31+
if (strtolower($currentModule) !== strtolower($module)) {
32+
$dependenciesInfo[] = [
33+
'module' => $module,
34+
'type' => RuleInterface::TYPE_HARD,
35+
'source' => $file,
36+
];
37+
}
38+
}
39+
}
40+
41+
return $dependenciesInfo;
42+
}
43+
}

dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Magento\TestFramework\Dependency\LayoutRule;
1717
use Magento\TestFramework\Dependency\PhpRule;
1818
use Magento\TestFramework\Dependency\ReportsConfigRule;
19+
use Magento\TestFramework\Dependency\AnalyticsConfigRule;
1920
use Magento\TestFramework\Dependency\VirtualType\VirtualTypeMapper;
2021

2122
/**
@@ -78,6 +79,17 @@ class DependencyTest extends \PHPUnit\Framework\TestCase
7879
*/
7980
protected static $_listRoutesXml = [];
8081

82+
/**
83+
* List of analytics.xml
84+
*
85+
* Format: array(
86+
* '{Module_Name}' => '{Filename}'
87+
* )
88+
*
89+
* @var array
90+
*/
91+
protected static $_listAnalyticsXml = [];
92+
8193
/**
8294
* List of routers
8395
*
@@ -176,6 +188,7 @@ public static function setUpBeforeClass()
176188
self::_prepareListConfigXml();
177189
self::_prepareListDbSchemaXml();
178190
self::_prepareListRoutesXml();
191+
self::_prepareListAnalyticsXml();
179192

180193
self::_prepareMapRouters();
181194
self::_prepareMapLayoutBlocks();
@@ -240,6 +253,7 @@ protected static function _initRules()
240253
),
241254
new DiRule(new VirtualTypeMapper()),
242255
new ReportsConfigRule($dbRuleTables),
256+
new AnalyticsConfigRule(),
243257
];
244258
}
245259

@@ -571,6 +585,20 @@ protected static function _prepareListRoutesXml()
571585
}
572586
}
573587

588+
/**
589+
* Prepare list of analytics.xml files
590+
*/
591+
protected static function _prepareListAnalyticsXml()
592+
{
593+
$files = Files::init()->getDbSchemaFiles('analytics.xml', [], false);
594+
foreach ($files as $file) {
595+
if (preg_match('/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)/', $file, $matches)) {
596+
$module = $matches['namespace'] . '\\' . $matches['module'];
597+
self::$_listAnalyticsXml[$module] = $file;
598+
}
599+
}
600+
}
601+
574602
/**
575603
* Prepare map of routers
576604
*/

0 commit comments

Comments
 (0)