Skip to content

Commit 0897100

Browse files
author
Sergey Nosov
committed
Merge remote-tracking branch 'origin/merchant_beta' into SUPEE-7227
2 parents 8d044f6 + 5011ce6 commit 0897100

File tree

12 files changed

+281
-38
lines changed

12 files changed

+281
-38
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,12 +1958,14 @@ protected function _saveStockItem()
19581958
} else {
19591959
$row['qty'] = 0;
19601960
}
1961-
$stockData[] = $row;
1961+
if (!isset($stockData[$rowData[self::COL_SKU]])) {
1962+
$stockData[$rowData[self::COL_SKU]] = $row;
1963+
}
19621964
}
19631965

19641966
// Insert rows
19651967
if (!empty($stockData)) {
1966-
$this->_connection->insertOnDuplicate($entityTable, $stockData);
1968+
$this->_connection->insertOnDuplicate($entityTable, array_values($stockData));
19671969
}
19681970

19691971
if ($productIdsToReindex) {

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function move($fileName, $renameFileOff = false)
155155

156156
$filePath = $this->_directory->getRelativePath($this->getTmpDir() . '/' . $fileName);
157157
$this->_setUploadFile($filePath);
158-
$result = $this->save($this->getDestDir());
158+
$result = $this->save($this->_directory->getAbsolutePath($this->getDestDir()));
159159
$result['name'] = self::getCorrectFileName($result['name']);
160160
return $result;
161161
}

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/UploaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function setUp()
7171
->getMock();
7272

7373
$this->directoryMock = $this->getMockBuilder('\Magento\Framework\Filesystem\Directory\Writer')
74-
->setMethods(['writeFile', 'getRelativePath'])
74+
->setMethods(['writeFile', 'getRelativePath', 'getAbsolutePath'])
7575
->disableOriginalConstructor()
7676
->getMock();
7777

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>

app/code/Magento/Theme/view/base/requirejs-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var config = {
4141
"jquery/jquery.hashchange": "jquery/jquery.ba-hashchange.min",
4242
"prototype": "legacy-build.min",
4343
"jquery/jquery-storageapi": "jquery/jquery.storageapi.min",
44-
"text": "requirejs/text",
44+
"text": "mage/requirejs/text",
4545
"domReady": "requirejs/domReady",
4646
"ko": "ko/ko",
4747
"tinymce": "tiny_mce/tiny_mce_src"

lib/web/mage/requirejs/static.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ define('jsbuild', [
281281
define('text', [
282282
'module',
283283
'buildTools',
284-
'requirejs/text'
284+
'mage/requirejs/text'
285285
], function (module, tools, text) {
286286
'use strict';
287287

lib/web/mage/requirejs/text.js

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
/**
2+
* Copyright © 2015 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
/* inspired by http://github.com/requirejs/text */
6+
/*global XMLHttpRequest, XDomainRequest */
7+
8+
define(['module'], function (module) {
9+
'use strict';
10+
11+
var xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
12+
bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
13+
stripReg = /!strip$/i,
14+
defaultConfig = module.config && module.config() || {};
15+
16+
/**
17+
* Strips <?xml ...?> declarations so that external SVG and XML documents can be
18+
* added to a document without worry.
19+
* Also, if the string is an HTML document, only the part inside the body tag is returned.
20+
*
21+
* @param {String} external
22+
* @returns {String}
23+
*/
24+
function stripContent(external) {
25+
var matches;
26+
27+
if (!external) {
28+
return '';
29+
}
30+
31+
matches = external.match(bodyRegExp);
32+
external = matches ?
33+
matches[1] :
34+
external.replace(xmlRegExp, '');
35+
36+
return external;
37+
}
38+
39+
/**
40+
* Checks that url match current location
41+
*
42+
* @param {String} url
43+
* @returns {Boolean}
44+
*/
45+
function sameDomain(url) {
46+
var uProtocol, uHostName, uPort,
47+
xdRegExp = /^([\w:]+)?\/\/([^\/\\]+)/i,
48+
location = window.location,
49+
match = xdRegExp.exec(url);
50+
51+
if (!match) {
52+
return true;
53+
}
54+
uProtocol = match[1];
55+
uHostName = match[2];
56+
57+
uHostName = uHostName.split(':');
58+
uPort = uHostName[1] || '';
59+
uHostName = uHostName[0];
60+
61+
return (!uProtocol || uProtocol === location.protocol) &&
62+
(!uHostName || uHostName.toLowerCase() === location.hostname.toLowerCase()) &&
63+
(!uPort && !uHostName || uPort === location.port);
64+
}
65+
66+
/**
67+
* @returns {XMLHttpRequest|XDomainRequest|null}
68+
*/
69+
function createRequest(url) {
70+
var xhr = new XMLHttpRequest();
71+
72+
if (!sameDomain(url) && typeof XDomainRequest !== 'undefined') {
73+
xhr = new XDomainRequest();
74+
}
75+
76+
return xhr;
77+
}
78+
79+
/**
80+
* XHR requester. Returns value to callback.
81+
*
82+
* @param {String} url
83+
* @param {Function} callback
84+
* @param {Function} fail
85+
* @param {Object} headers
86+
*/
87+
function getContent(url, callback, fail, headers) {
88+
var xhr = createRequest(url),
89+
header,
90+
errorHandler = fail || Function();
91+
92+
/*eslint-disable max-depth */
93+
if ('setRequestHeader' in xhr && headers) {
94+
for (header in headers) {
95+
if (headers.hasOwnProperty(header)) {
96+
xhr.setRequestHeader(header.toLowerCase(), headers[header]);
97+
}
98+
}
99+
}
100+
101+
/*eslint-enable max-depth */
102+
103+
if (defaultConfig.onXhr) {
104+
defaultConfig.onXhr(xhr, url);
105+
}
106+
107+
/**
108+
* onload handler
109+
*/
110+
xhr.onload = function () {
111+
112+
callback(xhr.responseText);
113+
114+
if (defaultConfig.onXhrComplete) {
115+
defaultConfig.onXhrComplete(xhr, url);
116+
}
117+
};
118+
119+
/**
120+
* onerror handler
121+
*/
122+
xhr.onerror = function (event) {
123+
errorHandler(event);
124+
125+
if (defaultConfig.onXhrFailure) {
126+
defaultConfig.onXhrFailure(xhr, url, event);
127+
}
128+
};
129+
130+
xhr.open('GET', url);
131+
xhr.send();
132+
}
133+
134+
/**
135+
* Main method used by RequireJs.
136+
*
137+
* @param {String} name - has format: some.module.filext!strip
138+
* @param {Function} req
139+
* @param {Function|undefined} onLoad
140+
*/
141+
function loadContent(name, req, onLoad) {
142+
143+
var toStrip = stripReg.test(name),
144+
url = req.toUrl(name.replace(stripReg, '')),
145+
headers = defaultConfig.headers;
146+
147+
getContent(url, function (content) {
148+
content = toStrip ? stripContent(content) : content;
149+
onLoad(content);
150+
}, onLoad.error, headers);
151+
}
152+
153+
return {
154+
load: loadContent,
155+
get: getContent
156+
};
157+
});

0 commit comments

Comments
 (0)