Skip to content

Commit 5c7f3f1

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #21110: [Backport][CMS] Improving the uploaded images styling view (by @eduard13) - #21078: [Backport] Fixed - Lifetime update syntax error #13309 (by @ssp58bleuciel) - #20876: [backport] Exceptions when search product with sku like "42-" (by @Nazar65) - #18524: [Backport] Added option to exclude discount amount from minimum order amount calculation (by @ccasciotti) Fixed GitHub Issues: - #20786: [CMS] File upload preview style issue (reported by @eduard13) has been fixed in #21110 by @eduard13 in 2.2-develop branch Related commits: 1. 99106e1 - #13309: Lifetime update syntax error (reported by @navalnichnik) has been fixed in #21078 by @ssp58bleuciel in 2.2-develop branch Related commits: 1. 4cb01ef 2. 5ecc6b2 - #9988: Quick search by SKU not working properly (reported by @harimayco) has been fixed in #20876 by @Nazar65 in 2.2-develop branch Related commits: 1. 49d09cf - #20716: Exceptions when search product with sku like "42-" (reported by @Nazar65) has been fixed in #20876 by @Nazar65 in 2.2-develop branch Related commits: 1. 49d09cf
2 parents 285af5b + 1efc8e0 commit 5c7f3f1

File tree

11 files changed

+67
-12
lines changed

11 files changed

+67
-12
lines changed

app/code/Magento/Cms/view/adminhtml/templates/browser/content/files.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $_height = $block->getImagesHeight();
1515
<?php if ($block->getFilesCount() > 0): ?>
1616
<?php foreach ($block->getFiles() as $file): ?>
1717
<div data-row="file" class="filecnt" id="<?= $block->escapeHtmlAttr($block->getFileId($file)) ?>">
18-
<p class="nm" style="height:<?= $block->escapeHtmlAttr($_height) ?>px;width:<?= $block->escapeHtmlAttr($_width) ?>px;">
18+
<p class="nm" style="height:<?= $block->escapeHtmlAttr($_height) ?>px;">
1919
<?php if ($block->getFileThumbUrl($file)):?>
2020
<img src="<?= $block->escapeHtmlAttr($block->getFileThumbUrl($file)) ?>" alt="<?= $block->escapeHtmlAttr($block->getFileName($file)) ?>"/>
2121
<?php endif; ?>

app/code/Magento/Quote/Model/Quote.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,6 +2218,11 @@ public function validateMinimumAmount($multishipping = false)
22182218
if (!$minOrderActive) {
22192219
return true;
22202220
}
2221+
$includeDiscount = $this->_scopeConfig->getValue(
2222+
'sales/minimum_order/include_discount_amount',
2223+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
2224+
$storeId
2225+
);
22212226
$minOrderMulti = $this->_scopeConfig->isSetFlag(
22222227
'sales/minimum_order/multi_address',
22232228
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
@@ -2251,7 +2256,10 @@ public function validateMinimumAmount($multishipping = false)
22512256
$taxes = ($taxInclude) ? $address->getBaseTaxAmount() : 0;
22522257
foreach ($address->getQuote()->getItemsCollection() as $item) {
22532258
/** @var \Magento\Quote\Model\Quote\Item $item */
2254-
$amount = $item->getBaseRowTotal() - $item->getBaseDiscountAmount() + $taxes;
2259+
$amount = $includeDiscount ?
2260+
$item->getBaseRowTotal() - $item->getBaseDiscountAmount() + $taxes :
2261+
$item->getBaseRowTotal() + $taxes;
2262+
22552263
if ($amount < $minAmount) {
22562264
return false;
22572265
}
@@ -2261,7 +2269,9 @@ public function validateMinimumAmount($multishipping = false)
22612269
$baseTotal = 0;
22622270
foreach ($addresses as $address) {
22632271
$taxes = ($taxInclude) ? $address->getBaseTaxAmount() : 0;
2264-
$baseTotal += $address->getBaseSubtotalWithDiscount() + $taxes;
2272+
$baseTotal += $includeDiscount ?
2273+
$address->getBaseSubtotalWithDiscount() + $taxes :
2274+
$address->getBaseSubtotal() + $taxes;
22652275
}
22662276
if ($baseTotal < $minAmount) {
22672277
return false;

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,11 @@ public function validateMinimumAmount()
11501150
return true;
11511151
}
11521152

1153+
$includeDiscount = $this->_scopeConfig->getValue(
1154+
'sales/minimum_order/include_discount_amount',
1155+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
1156+
$storeId
1157+
);
11531158
$amount = $this->_scopeConfig->getValue(
11541159
'sales/minimum_order/amount',
11551160
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
@@ -1160,9 +1165,12 @@ public function validateMinimumAmount()
11601165
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
11611166
$storeId
11621167
);
1168+
11631169
$taxes = $taxInclude ? $this->getBaseTaxAmount() : 0;
11641170

1165-
return ($this->getBaseSubtotalWithDiscount() + $taxes >= $amount);
1171+
return $includeDiscount ?
1172+
($this->getBaseSubtotalWithDiscount() + $taxes >= $amount) :
1173+
($this->getBaseSubtotal() + $taxes >= $amount);
11661174
}
11671175

11681176
/**

app/code/Magento/Quote/Test/Unit/Model/Quote/AddressTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public function testValidateMiniumumAmountVirtual()
216216
$scopeConfigValues = [
217217
['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true],
218218
['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20],
219+
['sales/minimum_order/include_discount_amount', ScopeInterface::SCOPE_STORE, $storeId, true],
219220
['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true],
220221
];
221222

@@ -240,6 +241,31 @@ public function testValidateMiniumumAmount()
240241
$scopeConfigValues = [
241242
['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true],
242243
['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20],
244+
['sales/minimum_order/include_discount_amount', ScopeInterface::SCOPE_STORE, $storeId, true],
245+
['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true],
246+
];
247+
248+
$this->quote->expects($this->once())
249+
->method('getStoreId')
250+
->willReturn($storeId);
251+
$this->quote->expects($this->once())
252+
->method('getIsVirtual')
253+
->willReturn(false);
254+
255+
$this->scopeConfig->expects($this->once())
256+
->method('isSetFlag')
257+
->willReturnMap($scopeConfigValues);
258+
259+
$this->assertTrue($this->address->validateMinimumAmount());
260+
}
261+
262+
public function testValidateMiniumumAmountWithoutDiscount()
263+
{
264+
$storeId = 1;
265+
$scopeConfigValues = [
266+
['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true],
267+
['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20],
268+
['sales/minimum_order/include_discount_amount', ScopeInterface::SCOPE_STORE, $storeId, false],
243269
['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true],
244270
];
245271

@@ -263,6 +289,7 @@ public function testValidateMiniumumAmountNegative()
263289
$scopeConfigValues = [
264290
['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true],
265291
['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20],
292+
['sales/minimum_order/include_discount_amount', ScopeInterface::SCOPE_STORE, $storeId, true],
266293
['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true],
267294
];
268295

app/code/Magento/Quote/Test/Unit/Model/QuoteTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ public function testValidateMiniumumAmount()
951951
['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true],
952952
['sales/minimum_order/multi_address', ScopeInterface::SCOPE_STORE, $storeId, true],
953953
['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20],
954+
['sales/minimum_order/include_discount_amount', ScopeInterface::SCOPE_STORE, $storeId, true],
954955
['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true],
955956
];
956957
$this->scopeConfig->expects($this->any())
@@ -977,6 +978,7 @@ public function testValidateMiniumumAmountNegative()
977978
['sales/minimum_order/active', ScopeInterface::SCOPE_STORE, $storeId, true],
978979
['sales/minimum_order/multi_address', ScopeInterface::SCOPE_STORE, $storeId, true],
979980
['sales/minimum_order/amount', ScopeInterface::SCOPE_STORE, $storeId, 20],
981+
['sales/minimum_order/include_discount_amount', ScopeInterface::SCOPE_STORE, $storeId, true],
980982
['sales/minimum_order/tax_including', ScopeInterface::SCOPE_STORE, $storeId, true],
981983
];
982984
$this->scopeConfig->expects($this->any())

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
<label>Minimum Amount</label>
9090
<comment>Subtotal after discount</comment>
9191
</field>
92+
<field id="include_discount_amount" translate="label" sortOrder="12" type="select" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
93+
<label>Include Discount Amount</label>
94+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
95+
<comment>Choosing yes will be used subtotal after discount, otherwise only subtotal will be used</comment>
96+
</field>
9297
<field id="tax_including" translate="label" sortOrder="15" type="select" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
9398
<label>Include Tax to Amount</label>
9499
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

app/code/Magento/Sales/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<allow_zero_grandtotal>1</allow_zero_grandtotal>
2323
</zerograndtotal_creditmemo>
2424
<minimum_order>
25+
<include_discount_amount>1</include_discount_amount>
2526
<tax_including>1</tax_including>
2627
</minimum_order>
2728
<orders>

app/design/adminhtml/Magento/backend/web/css/source/components/_file-insertion.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
margin: 0 @indent__xs 15px 0;
4343
overflow: hidden;
4444
padding: 3px;
45+
text-overflow: ellipsis;
4546
width: 100px;
4647

4748
&.selected {

app/design/adminhtml/Magento/backend/web/css/source/components/_popups.less

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
}
265265
}
266266

267-
#contents-uploader {
267+
.contents-uploader {
268268
margin: 0 0 @indent__base;
269269
}
270270

@@ -298,6 +298,7 @@
298298
margin: 0 @indent__xs 15px 0;
299299
overflow: hidden;
300300
padding: 3px;
301+
text-overflow: ellipsis;
301302
width: 100px;
302303

303304
&.selected {
@@ -309,7 +310,7 @@
309310
}
310311
}
311312

312-
#contents-uploader {
313+
.contents-uploader {
313314
&:extend(.abs-clearfix all);
314315
}
315316

lib/internal/Magento/Framework/Cache/Backend/Database.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2828
*/
2929

30-
/**
31-
* Database cache backend
32-
*/
3330
namespace Magento\Framework\Cache\Backend;
3431

32+
/**
33+
* Database cache backend.
34+
*/
3535
class Database extends \Zend_Cache_Backend implements \Zend_Cache_Backend_ExtendedInterface
3636
{
3737
/**
@@ -139,7 +139,7 @@ protected function _getTagsTable()
139139
*
140140
* Note : return value is always "string" (unserialization is done by the core not by the backend)
141141
*
142-
* @param string $id Cache id
142+
* @param string $id Cache id
143143
* @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested
144144
* @return string|false cached datas
145145
*/
@@ -432,7 +432,7 @@ public function touch($id, $extraLifetime)
432432
return $this->_getConnection()->update(
433433
$this->_getDataTable(),
434434
['expire_time' => new \Zend_Db_Expr('expire_time+' . $extraLifetime)],
435-
['id=?' => $id, 'expire_time = 0 OR expire_time>' => time()]
435+
['id=?' => $id, 'expire_time = 0 OR expire_time>?' => time()]
436436
);
437437
} else {
438438
return true;

0 commit comments

Comments
 (0)