Skip to content

Commit 71f4018

Browse files
authored
Merge pull request #611 from magento-troll/pull-primary
Issues fixed: - MAGETWO-60283 Prices of configurable product are incorrectly recalculated when display currency is changed - MAGETWO-53583 "Use Default" checkbox is checked again after saving empty fields (description, name, etc) - MAGETWO-43911 [GITHUB] Untranslatable string - MAGETWO-60127 [GITHUB] Number input fields have invalid 'maxlength' attribute #7125 - MAGETWO-60128 [GITHUB] Customer Addresses: Can't convert undefined to object #7115
2 parents 13db0b1 + 513bed7 commit 71f4018

File tree

24 files changed

+836
-146
lines changed

24 files changed

+836
-146
lines changed

app/code/Magento/Catalog/Block/Product/View.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
use Magento\Catalog\Api\ProductRepositoryInterface;
99
use Magento\Catalog\Model\Category;
10-
use Magento\Catalog\Model\Product;
1110

1211
/**
1312
* Product View block
@@ -29,6 +28,7 @@ class View extends AbstractProduct implements \Magento\Framework\DataObject\Iden
2928

3029
/**
3130
* @var \Magento\Framework\Pricing\PriceCurrencyInterface
31+
* @deprecated
3232
*/
3333
protected $priceCurrency;
3434

@@ -225,40 +225,34 @@ public function getJsonConfig()
225225
$config = [
226226
'productId' => $product->getId(),
227227
'priceFormat' => $this->_localeFormat->getPriceFormat()
228-
];
228+
];
229229
return $this->_jsonEncoder->encode($config);
230230
}
231231

232232
$tierPrices = [];
233233
$tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList();
234234
foreach ($tierPricesList as $tierPrice) {
235-
$tierPrices[] = $this->priceCurrency->convert($tierPrice['price']->getValue());
235+
$tierPrices[] = $tierPrice['price']->getValue();
236236
}
237237
$config = [
238-
'productId' => $product->getId(),
238+
'productId' => $product->getId(),
239239
'priceFormat' => $this->_localeFormat->getPriceFormat(),
240-
'prices' => [
241-
'oldPrice' => [
242-
'amount' => $this->priceCurrency->convert(
243-
$product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue()
244-
),
240+
'prices' => [
241+
'oldPrice' => [
242+
'amount' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(),
245243
'adjustments' => []
246244
],
247-
'basePrice' => [
248-
'amount' => $this->priceCurrency->convert(
249-
$product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount()
250-
),
245+
'basePrice' => [
246+
'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount(),
251247
'adjustments' => []
252248
],
253249
'finalPrice' => [
254-
'amount' => $this->priceCurrency->convert(
255-
$product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue()
256-
),
250+
'amount' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(),
257251
'adjustments' => []
258252
]
259253
],
260-
'idSuffix' => '_clone',
261-
'tierPrices' => $tierPrices
254+
'idSuffix' => '_clone',
255+
'tierPrices' => $tierPrices
262256
];
263257

264258
$responseObject = new \Magento\Framework\DataObject();

app/code/Magento/Catalog/view/frontend/templates/product/view/addtocart.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
<input type="number"
2121
name="qty"
2222
id="qty"
23-
maxlength="12"
2423
value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>"
25-
title="<?php /* @escapeNotVerified */ echo __('Qty') ?>" class="input-text qty"
24+
title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
25+
class="input-text qty"
2626
data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
2727
/>
2828
</div>
@@ -58,4 +58,4 @@
5858
}
5959
}
6060
</script>
61-
<?php endif; ?>
61+
<?php endif; ?>

app/code/Magento/Checkout/view/frontend/templates/cart/item/configure/updatecart.phtml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@
1717
<div class="field qty">
1818
<label class="label" for="qty"><span><?php /* @escapeNotVerified */ echo __('Qty') ?></span></label>
1919
<div class="control">
20-
<input type="number" name="qty" id="qty" maxlength="12" value="" title="<?php /* @escapeNotVerified */ echo __('Qty') ?>" class="input-text qty" data-validate="{'required-number':true,digits:true}"/>
20+
<input type="number"
21+
name="qty"
22+
id="qty"
23+
value=""
24+
title="<?php /* @escapeNotVerified */ echo __('Qty') ?>"
25+
class="input-text qty"
26+
data-validate="{'required-number':true,digits:true}"/>
2127
</div>
2228
</div>
2329
<?php endif; ?>

app/code/Magento/Checkout/view/frontend/templates/cart/item/default.phtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
9696
size="4"
9797
title="<?php echo $block->escapeHtml(__('Qty')); ?>"
9898
class="input-text qty"
99-
maxlength="12"
10099
data-validate="{required:true,'validate-greater-than-zero':true}"
101100
data-role="cart-item-qty"/>
102101
</div>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@
7979
}, value: qty"
8080
type="number"
8181
size="4"
82-
class="item-qty cart-item-qty"
83-
maxlength="12"/>
82+
class="item-qty cart-item-qty">
8483
<button data-bind="attr: {
8584
id: 'update-cart-item-'+item_id,
8685
'data-cart-item': item_id,

app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ public function __construct(
9292
);
9393
}
9494

95+
/**
96+
* Get cache key informative items.
97+
*
98+
* @return array
99+
*/
100+
public function getCacheKeyInfo()
101+
{
102+
$parentData = parent::getCacheKeyInfo();
103+
$parentData[] = $this->priceCurrency->getCurrencySymbol();
104+
return $parentData;
105+
}
106+
95107
/**
96108
* Get allowed attributes
97109
*

app/code/Magento/Customer/view/frontend/web/js/model/customer-addresses.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@ define(
1111
],
1212
function($, ko, address) {
1313
"use strict";
14+
1415
var isLoggedIn = ko.observable(window.isCustomerLoggedIn);
16+
1517
return {
1618
getAddressItems: function() {
1719
var items = [];
18-
if (isLoggedIn) {
20+
if (isLoggedIn()) {
1921
var customerData = window.customerData;
2022
if (Object.keys(customerData).length) {
2123
$.each(customerData.addresses, function (key, item) {
2224
items.push(new address(item));
2325
});
2426
}
2527
}
28+
2629
return items;
2730
}
2831
}
2932
}
30-
);
33+
);

0 commit comments

Comments
 (0)