Skip to content

Commit 167c80f

Browse files
authored
Merge pull request #4523 from magento-mpi/pr_2019_07_24
[mpi] bugfixes 2.3
2 parents 90200f6 + a4a21be commit 167c80f

File tree

16 files changed

+564
-45
lines changed

16 files changed

+564
-45
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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\Bundle\Setup\Patch\Schema;
9+
10+
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
11+
use Magento\Framework\Setup\SchemaSetupInterface;
12+
13+
/**
14+
* Change engine for temporary tables to InnoDB.
15+
*/
16+
class ChangeTmpTablesEngine implements SchemaPatchInterface
17+
{
18+
/**
19+
* @var SchemaSetupInterface
20+
*/
21+
private $schemaSetup;
22+
23+
/**
24+
* @param SchemaSetupInterface $schemaSetup
25+
*/
26+
public function __construct(SchemaSetupInterface $schemaSetup)
27+
{
28+
$this->schemaSetup = $schemaSetup;
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function apply()
35+
{
36+
$this->schemaSetup->startSetup();
37+
38+
$tables = [
39+
'catalog_product_index_price_bundle_tmp',
40+
'catalog_product_index_price_bundle_sel_tmp',
41+
'catalog_product_index_price_bundle_opt_tmp',
42+
];
43+
foreach ($tables as $table) {
44+
$this->schemaSetup->getConnection()->changeTableEngine($table, 'InnoDB');
45+
}
46+
47+
$this->schemaSetup->endSetup();
48+
}
49+
50+
/**
51+
* @inheritdoc
52+
*/
53+
public static function getDependencies()
54+
{
55+
return [];
56+
}
57+
58+
/**
59+
* @inheritdoc
60+
*/
61+
public function getAliases()
62+
{
63+
return [];
64+
}
65+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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\Setup\Patch\Schema;
9+
10+
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
11+
use Magento\Framework\Setup\SchemaSetupInterface;
12+
13+
/**
14+
* Change engine for temporary tables to InnoDB.
15+
*/
16+
class ChangeTmpTablesEngine implements SchemaPatchInterface
17+
{
18+
/**
19+
* @var SchemaSetupInterface
20+
*/
21+
private $schemaSetup;
22+
23+
/**
24+
* @param SchemaSetupInterface $schemaSetup
25+
*/
26+
public function __construct(SchemaSetupInterface $schemaSetup)
27+
{
28+
$this->schemaSetup = $schemaSetup;
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function apply()
35+
{
36+
$this->schemaSetup->startSetup();
37+
38+
$tables = [
39+
'catalog_product_index_price_cfg_opt_agr_tmp',
40+
'catalog_product_index_price_cfg_opt_tmp',
41+
'catalog_product_index_price_final_tmp',
42+
'catalog_product_index_price_opt_tmp',
43+
'catalog_product_index_price_opt_agr_tmp',
44+
'catalog_product_index_eav_tmp',
45+
'catalog_product_index_eav_decimal_tmp',
46+
'catalog_product_index_price_tmp',
47+
'catalog_category_product_index_tmp',
48+
];
49+
foreach ($tables as $table) {
50+
$this->schemaSetup->getConnection()->changeTableEngine($table, 'InnoDB');
51+
}
52+
53+
$this->schemaSetup->endSetup();
54+
}
55+
56+
/**
57+
* @inheritdoc
58+
*/
59+
public static function getDependencies()
60+
{
61+
return [];
62+
}
63+
64+
/**
65+
* @inheritdoc
66+
*/
67+
public function getAliases()
68+
{
69+
return [];
70+
}
71+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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\CatalogInventory\Setup\Patch\Schema;
9+
10+
use Magento\Framework\Setup\Patch\SchemaPatchInterface;
11+
use Magento\Framework\Setup\SchemaSetupInterface;
12+
13+
/**
14+
* Change engine for temporary tables to InnoDB.
15+
*/
16+
class ChangeTmpTablesEngine implements SchemaPatchInterface
17+
{
18+
/**
19+
* @var SchemaSetupInterface
20+
*/
21+
private $schemaSetup;
22+
23+
/**
24+
* @param SchemaSetupInterface $schemaSetup
25+
*/
26+
public function __construct(SchemaSetupInterface $schemaSetup)
27+
{
28+
$this->schemaSetup = $schemaSetup;
29+
}
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function apply()
35+
{
36+
$this->schemaSetup->startSetup();
37+
38+
$this->schemaSetup->getConnection()->changeTableEngine('cataloginventory_stock_status_tmp', 'InnoDB');
39+
40+
$this->schemaSetup->endSetup();
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public static function getDependencies()
47+
{
48+
return [];
49+
}
50+
51+
/**
52+
* @inheritdoc
53+
*/
54+
public function getAliases()
55+
{
56+
return [];
57+
}
58+
}

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,10 @@ public function getConfig()
343343
)
344344
)
345345
];
346+
$output['useQty'] = $this->scopeConfig->isSetFlag(
347+
'checkout/cart_link/use_qty',
348+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
349+
);
346350
$output['activeCarriers'] = $this->getActiveCarriers();
347351
$output['originCountryCode'] = $this->getOriginCountryCode();
348352
$output['paymentMethods'] = $this->getPaymentMethods();

app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,16 @@
8888
<data key="label">No</data>
8989
<data key="value">0</data>
9090
</entity>
91+
92+
<!-- Checkout Config: Display Cart Summary -->
93+
<entity name="DisplayItemsQuantities">
94+
<data key="path">checkout/cart_link/use_qty</data>
95+
<data key="label">Display items quantities</data>
96+
<data key="value">1</data>
97+
</entity>
98+
<entity name="DisplayUniqueItems">
99+
<data key="path">checkout/cart_link/use_qty</data>
100+
<data key="label">Display number of items in cart</data>
101+
<data key="value">0</data>
102+
</entity>
91103
</entities>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddProductWithAllTypesOfCustomOptionToTheShoppingCartTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
<!-- Assert Product Count in Mini Cart -->
101101
<actionGroup ref="StorefrontAssertMiniCartItemCountActionGroup" stepKey="assertProductCountAndTextInMiniCart">
102102
<argument name="productCount" value="2"/>
103-
<argument name="productCountText" value="1 Item in Cart"/>
103+
<argument name="productCountText" value="2 Item in Cart"/>
104104
</actionGroup>
105105

106106
<!--Assert Product Items in Mini cart-->
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCartItemsCountDisplayItemsQuantities">
11+
<annotations>
12+
<stories value="Checkout order summary has wrong item count"/>
13+
<title value="Checkout order summary has wrong item count - display items quantities"/>
14+
<description value="Items count in shopping cart and on checkout page should be consistent with settings 'checkout/cart_link/use_qty'"/>
15+
<testCaseId value="MC-18281"/>
16+
<severity value="CRITICAL"/>
17+
<group value="checkout"/>
18+
</annotations>
19+
20+
<before>
21+
<!--Set Display Cart Summary to display items quantities-->
22+
<magentoCLI command="config:set {{DisplayItemsQuantities.path}} {{DisplayItemsQuantities.value}}" stepKey="setDisplayCartSummary"/>
23+
<!--Create simple product-->
24+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
25+
<!--Create simple product-->
26+
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
27+
</before>
28+
<after>
29+
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
30+
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
31+
<magentoCLI command="config:set {{DisplayItemsQuantities.path}} {{DisplayItemsQuantities.value}}" stepKey="resetDisplayCartSummary"/>
32+
</after>
33+
34+
<!-- Add simpleProduct1 to cart -->
35+
<amOnPage url="{{StorefrontProductPage.url($$simpleProduct1.custom_attributes[url_key]$)}}" stepKey="amOnProduct1Page"/>
36+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addProduct1ToCart">
37+
<argument name="productName" value="$$simpleProduct1.name$$"/>
38+
<argument name="productQty" value="2"/>
39+
</actionGroup>
40+
<!-- Add simpleProduct2 to cart -->
41+
<amOnPage url="{{StorefrontProductPage.url($$simpleProduct2.custom_attributes[url_key]$)}}" stepKey="amOnProduct2Page"/>
42+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPage" stepKey="addProduct2ToCart">
43+
<argument name="productName" value="$$simpleProduct2.name$$"/>
44+
<argument name="productQty" value="1"/>
45+
</actionGroup>
46+
47+
<!-- Open Mini Cart -->
48+
<actionGroup ref="StorefrontOpenMiniCartActionGroup" stepKey="openMiniCart"/>
49+
50+
<!-- Assert Products Count in Mini Cart -->
51+
<actionGroup ref="StorefrontAssertMiniCartItemCountActionGroup" stepKey="assertProductCountAndTextInMiniCart">
52+
<argument name="productCount" value="3"/>
53+
<argument name="productCountText" value="3 Items in Cart"/>
54+
</actionGroup>
55+
<!-- Assert Products Count on checkout page -->
56+
<actionGroup ref="StorefrontCheckoutAndAssertOrderSummaryDisplayActionGroup" stepKey="assertProductCountOnCheckoutPage">
57+
<argument name="itemsText" value="3 Items in Cart"/>
58+
</actionGroup>
59+
</test>
60+
<test name="StorefrontCartItemsCountDisplayUniqueItems" extends="StorefrontCartItemsCountDisplayItemsQuantities">
61+
<annotations>
62+
<stories value="Checkout order summary has wrong item count"/>
63+
<title value="Checkout order summary has wrong item count - display unique items"/>
64+
<description value="Items count in shopping cart and on checkout page should be consistent with settings 'checkout/cart_link/use_qty'"/>
65+
<testCaseId value="MC-18281"/>
66+
<severity value="CRITICAL"/>
67+
<group value="checkout"/>
68+
</annotations>
69+
70+
<!-- Assert Products Count in Mini Cart -->
71+
<actionGroup ref="StorefrontAssertMiniCartItemCountActionGroup" stepKey="assertProductCountAndTextInMiniCart">
72+
<argument name="productCount" value="2"/>
73+
<argument name="productCountText" value="2 Items in Cart"/>
74+
</actionGroup>
75+
<!-- Assert Products Count on checkout page -->
76+
<actionGroup ref="StorefrontCheckoutAndAssertOrderSummaryDisplayActionGroup" stepKey="assertProductCountOnCheckoutPage">
77+
<argument name="itemsText" value="2 Items in Cart"/>
78+
</actionGroup>
79+
80+
<before>
81+
<!--Set Display Cart Summary to display items quantities-->
82+
<magentoCLI command="config:set {{DisplayUniqueItems.path}} {{DisplayUniqueItems.value}}" stepKey="setDisplayCartSummary"/>
83+
</before>
84+
</test>
85+
</tests>

app/code/Magento/Checkout/view/frontend/web/js/view/summary/cart-items.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ define([
1212
], function (ko, totals, Component, stepNavigator, quote) {
1313
'use strict';
1414

15+
var useQty = window.checkoutConfig.useQty;
16+
1517
return Component.extend({
1618
defaults: {
1719
template: 'Magento_Checkout/summary/cart-items'
@@ -44,6 +46,15 @@ define([
4446
return parseInt(totals.getItems()().length, 10);
4547
},
4648

49+
/**
50+
* Returns shopping cart items summary (includes config settings)
51+
*
52+
* @returns {Number}
53+
*/
54+
getCartSummaryItemsCount: function () {
55+
return useQty ? this.getItemsQty() : this.getCartLineItemsCount();
56+
},
57+
4758
/**
4859
* @inheritdoc
4960
*/

app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<div class="items-total">
3030
<span class="count" if="maxItemsToDisplay < getCartLineItemsCount()" text="maxItemsToDisplay"/>
3131
<translate args="'of'" if="maxItemsToDisplay < getCartLineItemsCount()"/>
32-
<span class="count" text="getCartLineItemsCount()"/>
32+
<span class="count" text="getCartParam('summary_count')"/>
3333
<!-- ko if: (getCartLineItemsCount() === 1) -->
3434
<span translate="'Item in Cart'"/>
3535
<!--/ko-->

app/code/Magento/Checkout/view/frontend/web/template/summary/cart-items.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<strong role="heading" aria-level="1">
1010
<translate args="maxCartItemsToDisplay" if="maxCartItemsToDisplay < getCartLineItemsCount()"/>
1111
<translate args="'of'" if="maxCartItemsToDisplay < getCartLineItemsCount()"/>
12-
<span data-bind="text: getCartLineItemsCount()"></span>
12+
<span data-bind="text: getCartSummaryItemsCount()"></span>
1313
<translate args="'Item in Cart'" if="getCartLineItemsCount() === 1"/>
1414
<translate args="'Items in Cart'" if="getCartLineItemsCount() > 1"/>
1515
</strong>

0 commit comments

Comments
 (0)