Skip to content

Commit d1a6187

Browse files
merge magento/2.2-develop into magento-tsg/2.2-develop-pr94
2 parents e2c4216 + 744c318 commit d1a6187

File tree

4 files changed

+96
-14
lines changed

4 files changed

+96
-14
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/payment.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,21 @@ define([
6666
navigate: function () {
6767
var self = this;
6868

69-
getPaymentInformation().done(function () {
70-
self.isVisible(true);
71-
});
69+
if (!self.hasShippingMethod()) {
70+
this.isVisible(false);
71+
stepNavigator.setHash('shipping');
72+
} else {
73+
getPaymentInformation().done(function () {
74+
self.isVisible(true);
75+
});
76+
}
77+
},
78+
79+
/**
80+
* @return {Boolean}
81+
*/
82+
hasShippingMethod: function () {
83+
return window.checkoutConfig.selectedShippingMethod !== null;
7284
},
7385

7486
/**

app/code/Magento/Config/Model/Config/Source/Locale/Currency.php

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
/**
8-
* Locale currency source
9-
*/
107
namespace Magento\Config\Model\Config\Source\Locale;
118

9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Locale\ListsInterface;
12+
1213
/**
14+
* Locale currency source.
15+
*
1316
* @api
1417
* @since 100.0.2
1518
*/
@@ -21,27 +24,70 @@ class Currency implements \Magento\Framework\Option\ArrayInterface
2124
protected $_options;
2225

2326
/**
24-
* @var \Magento\Framework\Locale\ListsInterface
27+
* @var ListsInterface
2528
*/
2629
protected $_localeLists;
2730

2831
/**
29-
* @param \Magento\Framework\Locale\ListsInterface $localeLists
32+
* @var ScopeConfigInterface
3033
*/
31-
public function __construct(\Magento\Framework\Locale\ListsInterface $localeLists)
32-
{
34+
private $config;
35+
36+
/**
37+
* @var array
38+
*/
39+
private $installedCurrencies;
40+
41+
/**
42+
* @param ListsInterface $localeLists
43+
* @param ScopeConfigInterface $config
44+
*/
45+
public function __construct(
46+
ListsInterface $localeLists,
47+
ScopeConfigInterface $config = null
48+
) {
3349
$this->_localeLists = $localeLists;
50+
$this->config = $config ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class);
3451
}
3552

3653
/**
37-
* @return array
54+
* @inheritdoc
3855
*/
3956
public function toOptionArray()
4057
{
4158
if (!$this->_options) {
4259
$this->_options = $this->_localeLists->getOptionCurrencies();
4360
}
44-
$options = $this->_options;
61+
62+
$selected = array_flip($this->getInstalledCurrencies());
63+
64+
$options = array_filter(
65+
$this->_options,
66+
function ($option) use ($selected) {
67+
return isset($selected[$option['value']]);
68+
}
69+
);
70+
4571
return $options;
4672
}
73+
74+
/**
75+
* Retrieve Installed Currencies.
76+
*
77+
* @return array
78+
*/
79+
private function getInstalledCurrencies()
80+
{
81+
if (!$this->installedCurrencies) {
82+
$this->installedCurrencies = explode(
83+
',',
84+
$this->config->getValue(
85+
'system/currency/installed',
86+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
87+
)
88+
);
89+
}
90+
91+
return $this->installedCurrencies;
92+
}
4793
}

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ define([
728728
*/
729729
_sortImages: function (images) {
730730
return _.sortBy(images, function (image) {
731-
return image.position;
731+
return parseInt(image.position, 10);
732732
});
733733
},
734734

app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Cart.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,28 @@
1414
*/
1515
class Cart extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column
1616
{
17+
/**
18+
* @var View
19+
*/
20+
private $productView;
21+
22+
/**
23+
* @param \Magento\Catalog\Block\Product\Context $context
24+
* @param \Magento\Framework\App\Http\Context $httpContext
25+
* @param \Magento\Catalog\Block\Product\View $productView
26+
* @param array $data
27+
*/
28+
public function __construct(
29+
\Magento\Catalog\Block\Product\Context $context,
30+
\Magento\Framework\App\Http\Context $httpContext,
31+
array $data = [],
32+
\Magento\Catalog\Block\Product\View $productView = null
33+
) {
34+
$this->productView = $productView ?:
35+
\Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Catalog\Block\Product\View::class);
36+
parent::__construct($context, $httpContext, $data);
37+
}
38+
1739
/**
1840
* Returns qty to show visually to user
1941
*
@@ -23,7 +45,9 @@ class Cart extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column
2345
public function getAddToCartQty(\Magento\Wishlist\Model\Item $item)
2446
{
2547
$qty = $item->getQty();
26-
return $qty ? $qty : 1;
48+
$qty = $qty < $this->productView->getProductDefaultQty($this->getProductItem())
49+
? $this->productView->getProductDefaultQty($this->getProductItem()) : $qty;
50+
return $qty ?: 1;
2751
}
2852

2953
/**

0 commit comments

Comments
 (0)