Skip to content

Commit a1873db

Browse files
author
Korshenko, Olexii(okorshenko)
committed
Merge pull request #76 from magento-folks/merchant_beta
[Folks] Bugfix
2 parents 38de4f1 + 14686fb commit a1873db

File tree

6 files changed

+116
-32
lines changed

6 files changed

+116
-32
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
9+
<body>
10+
<referenceBlock name="minicart">
11+
<arguments>
12+
<argument name="jsLayout" xsi:type="array">
13+
<item name="components" xsi:type="array">
14+
<item name="minicart_content" xsi:type="array">
15+
<item name="children" xsi:type="array">
16+
<item name="subtotal.container" xsi:type="array">
17+
<item name="children" xsi:type="array">
18+
<item name="subtotal" xsi:type="array">
19+
<item name="children" xsi:type="array">
20+
<item name="subtotal.totals" xsi:type="array">
21+
<item name="children" xsi:type="array">
22+
<item name="subtotal.totals.msrp" xsi:type="array">
23+
<item name="component" xsi:type="string">Magento_Msrp/js/view/checkout/minicart/subtotal/totals</item>
24+
<item name="config" xsi:type="array">
25+
<item name="displayArea" xsi:type="string">minicart-subtotal-hidden</item>
26+
<item name="template" xsi:type="string">Magento_Msrp/checkout/minicart/subtotal/totals</item>
27+
</item>
28+
</item>
29+
</item>
30+
</item>
31+
</item>
32+
</item>
33+
</item>
34+
</item>
35+
</item>
36+
</item>
37+
</item>
38+
</argument>
39+
</arguments>
40+
</referenceBlock>
41+
</body>
42+
</page>

app/code/Magento/Msrp/view/frontend/layout/default.xml

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright © 2015 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
define([
6+
'Magento_Tax/js/view/checkout/minicart/subtotal/totals',
7+
'underscore'
8+
], function (Component, _) {
9+
'use strict';
10+
11+
return Component.extend({
12+
13+
/**
14+
* @override
15+
*/
16+
initialize: function () {
17+
this._super();
18+
this.displaySubtotal(this.isMsrpApplied(this.cart().items));
19+
this.cart.subscribe(function (updatedCart) {
20+
21+
this.displaySubtotal(this.isMsrpApplied(updatedCart.items));
22+
}, this);
23+
},
24+
25+
/**
26+
* Determine if subtotal should be hidden.
27+
* @param {Array} cartItems
28+
* @return {Boolean}
29+
*/
30+
isMsrpApplied: function (cartItems) {
31+
return !_.find(cartItems, function (item) {
32+
if (_.has(item, 'canApplyMsrp')) {
33+
return item.canApplyMsrp;
34+
}
35+
36+
return false;
37+
});
38+
}
39+
});
40+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!--
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<span class="mark msrp" data-bind="text: $t('Order total will be displayed before you submit the order')"></span>

app/code/Magento/Tax/view/frontend/web/js/view/checkout/minicart/subtotal/totals.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
* See COPYING.txt for license details.
44
*/
55
define([
6+
'ko',
67
'uiComponent',
78
'Magento_Customer/js/customer-data'
8-
], function (Component, customerData) {
9+
], function (ko, Component, customerData) {
910
'use strict';
1011

1112
return Component.extend({
13+
displaySubtotal: ko.observable(true),
14+
15+
/**
16+
* @override
17+
*/
1218
initialize: function () {
1319
this._super();
1420
this.cart = customerData.get('cart');

app/code/Magento/Tax/view/frontend/web/template/checkout/minicart/subtotal/totals.html

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,28 @@
66
-->
77

88
<div class="amount price-container">
9-
<!-- ko if: display_cart_subtotal_excl_tax -->
10-
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"></span>
11-
<!-- /ko -->
9+
<!-- ko if: displaySubtotal() -->
10+
<!-- ko if: display_cart_subtotal_excl_tax -->
11+
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"></span>
12+
<!-- /ko -->
1213

13-
<!-- ko if: !display_cart_subtotal_excl_tax && display_subtotal_incl_tax -->
14-
<span class="price-wrapper" data-bind="html: cart().subtotal_incl_tax"></span>
15-
<!-- /ko -->
14+
<!-- ko if: !display_cart_subtotal_excl_tax && display_subtotal_incl_tax -->
15+
<span class="price-wrapper" data-bind="html: cart().subtotal_incl_tax"></span>
16+
<!-- /ko -->
1617

17-
<!-- ko if: !display_cart_subtotal_excl_tax && !display_subtotal_incl_tax -->
18-
<span class="price-wrapper price-including-tax"
19-
data-bind="attr: { 'data-label': $t('Incl. Tax') }, html: cart().subtotal_incl_tax">
20-
</span>
18+
<!-- ko if: !display_cart_subtotal_excl_tax && !display_subtotal_incl_tax -->
19+
<span class="price-wrapper price-including-tax"
20+
data-bind="attr: { 'data-label': $t('Incl. Tax') }, html: cart().subtotal_incl_tax">
21+
</span>
2122

22-
<span class="price-wrapper price-excluding-tax"
23-
data-bind="attr: { 'data-label': $t('Excl. Tax') }, html: cart().subtotal_excl_tax">
24-
</span>
23+
<span class="price-wrapper price-excluding-tax"
24+
data-bind="attr: { 'data-label': $t('Excl. Tax') }, html: cart().subtotal_excl_tax">
25+
</span>
26+
<!-- /ko -->
27+
<!-- /ko -->
28+
<!-- ko ifnot: displaySubtotal() -->
29+
<!-- ko foreach: getRegion('minicart-subtotal-hidden') -->
30+
<!-- ko template: getTemplate() --><!-- /ko -->
31+
<!-- /ko -->
2532
<!-- /ko -->
2633
</div>

0 commit comments

Comments
 (0)