Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/merchant_beta' into merchant_beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroslav Onischenko committed Oct 30, 2015
2 parents 1fe5da5 + a1873db commit db9565a
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="minicart">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="minicart_content" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal.container" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal.totals" xsi:type="array">
<item name="children" xsi:type="array">
<item name="subtotal.totals.msrp" xsi:type="array">
<item name="component" xsi:type="string">Magento_Msrp/js/view/checkout/minicart/subtotal/totals</item>
<item name="config" xsi:type="array">
<item name="displayArea" xsi:type="string">minicart-subtotal-hidden</item>
<item name="template" xsi:type="string">Magento_Msrp/checkout/minicart/subtotal/totals</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
18 changes: 0 additions & 18 deletions app/code/Magento/Msrp/view/frontend/layout/default.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'Magento_Tax/js/view/checkout/minicart/subtotal/totals',
'underscore'
], function (Component, _) {
'use strict';

return Component.extend({

/**
* @override
*/
initialize: function () {
this._super();
this.displaySubtotal(this.isMsrpApplied(this.cart().items));
this.cart.subscribe(function (updatedCart) {

this.displaySubtotal(this.isMsrpApplied(updatedCart.items));
}, this);
},

/**
* Determine if subtotal should be hidden.
* @param {Array} cartItems
* @return {Boolean}
*/
isMsrpApplied: function (cartItems) {
return !_.find(cartItems, function (item) {
if (_.has(item, 'canApplyMsrp')) {
return item.canApplyMsrp;
}

return false;
});
}
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<span class="mark msrp" data-bind="text: $t('Order total will be displayed before you submit the order')"></span>
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
* See COPYING.txt for license details.
*/
define([
'ko',
'uiComponent',
'Magento_Customer/js/customer-data'
], function (Component, customerData) {
], function (ko, Component, customerData) {
'use strict';

return Component.extend({
displaySubtotal: ko.observable(true),

/**
* @override
*/
initialize: function () {
this._super();
this.cart = customerData.get('cart');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,28 @@
-->

<div class="amount price-container">
<!-- ko if: display_cart_subtotal_excl_tax -->
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"></span>
<!-- /ko -->
<!-- ko if: displaySubtotal() -->
<!-- ko if: display_cart_subtotal_excl_tax -->
<span class="price-wrapper" data-bind="html: cart().subtotal_excl_tax"></span>
<!-- /ko -->

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

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

<span class="price-wrapper price-excluding-tax"
data-bind="attr: { 'data-label': $t('Excl. Tax') }, html: cart().subtotal_excl_tax">
</span>
<span class="price-wrapper price-excluding-tax"
data-bind="attr: { 'data-label': $t('Excl. Tax') }, html: cart().subtotal_excl_tax">
</span>
<!-- /ko -->
<!-- /ko -->
<!-- ko ifnot: displaySubtotal() -->
<!-- ko foreach: getRegion('minicart-subtotal-hidden') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- /ko -->
<!-- /ko -->
</div>

0 comments on commit db9565a

Please sign in to comment.