Skip to content

Commit c296f2e

Browse files
author
Dmytro Voskoboinikov
committed
Merge branch '2.1-develop' into MAGETWO-71515
2 parents deccfe9 + a518a12 commit c296f2e

File tree

85 files changed

+2734
-758
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2734
-758
lines changed

.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# All explanations you could find in .htaccess.sample file
22
DirectoryIndex index.php
33
<IfModule mod_php5.c>
4-
php_value memory_limit 768M
4+
php_value memory_limit 756M
55
php_value max_execution_time 18000
66
php_flag session.auto_start off
77
php_flag suhosin.session.cryptua off
88
</IfModule>
99
<IfModule mod_php7.c>
10-
php_value memory_limit 768M
10+
php_value memory_limit 756M
1111
php_value max_execution_time 18000
1212
php_flag session.auto_start off
1313
php_flag suhosin.session.cryptua off

.htaccess.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ DirectoryIndex index.php
3636
############################################
3737
## adjust memory limit
3838

39-
php_value memory_limit 768M
39+
php_value memory_limit 756M
4040
php_value max_execution_time 18000
4141

4242
############################################
@@ -59,7 +59,7 @@ DirectoryIndex index.php
5959
############################################
6060
## adjust memory limit
6161

62-
php_value memory_limit 768M
62+
php_value memory_limit 756M
6363
php_value max_execution_time 18000
6464

6565
############################################

.user.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
memory_limit = 768M
1+
memory_limit = 756M
22
max_execution_time = 18000
33
session.auto_start = off
44
suhosin.session.cryptua = off

app/code/Magento/Backend/Block/Dashboard/Graph.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ public function getChartUrl($directUrl = true)
421421
$tmpstring = implode('|', $this->_axisLabels[$idx]);
422422

423423
$valueBuffer[] = $indexid . ":|" . $tmpstring;
424+
} elseif ($idx == 'y') {
425+
$valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
424426
}
425427
$indexid++;
426428
}

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ define([
296296
getShippingAddress: function () {
297297
var address = quote.shippingAddress();
298298

299-
if (address.postcode === null) {
299+
if (_.isNull(address.postcode) || _.isUndefined(address.postcode)) {
300300

301301
return {};
302302
}
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier;
8+
9+
use Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts\Price;
10+
use Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts\Stock;
11+
use Magento\Framework\App\Config\ScopeConfigInterface;
12+
use Magento\Framework\View\LayoutFactory;
13+
use Magento\Store\Model\ScopeInterface;
14+
use Magento\Ui\Component\Form\Fieldset;
15+
16+
class Alerts extends AbstractModifier
17+
{
18+
const DATA_SCOPE = 'data';
19+
const DATA_SCOPE_STOCK = 'stock';
20+
const DATA_SCOPE_PRICE = 'price';
21+
22+
/**
23+
* @var string
24+
*/
25+
private static $previousGroup = 'related';
26+
27+
/**
28+
* @var int
29+
*/
30+
private static $sortOrder = 110;
31+
32+
/**
33+
* @var ScopeConfigInterface
34+
*/
35+
private $scopeConfig;
36+
37+
/**
38+
* @var LayoutFactory
39+
*/
40+
private $layoutFactory;
41+
42+
/**
43+
* Alerts constructor.
44+
* @param ScopeConfigInterface $scopeConfig
45+
* @param LayoutFactory $layoutFactory
46+
*/
47+
public function __construct(
48+
ScopeConfigInterface $scopeConfig,
49+
LayoutFactory $layoutFactory
50+
) {
51+
$this->scopeConfig = $scopeConfig;
52+
$this->layoutFactory = $layoutFactory;
53+
}
54+
55+
/**
56+
* {@inheritdoc}
57+
* @since 101.0.0
58+
*/
59+
public function modifyData(array $data)
60+
{
61+
return $data;
62+
}
63+
64+
/**
65+
* {@inheritdoc}
66+
* @since 101.0.0
67+
*/
68+
public function modifyMeta(array $meta)
69+
{
70+
if (!$this->canShowTab()) {
71+
return $meta;
72+
}
73+
74+
$meta = array_replace_recursive(
75+
$meta,
76+
[
77+
'alerts' => [
78+
'arguments' => [
79+
'data' => [
80+
'config' => [
81+
'additionalClasses' => 'admin__fieldset-section',
82+
'label' => __('Product Alerts'),
83+
'collapsible' => true,
84+
'componentType' => Fieldset::NAME,
85+
'dataScope' => static::DATA_SCOPE,
86+
'sortOrder' =>
87+
$this->getNextGroupSortOrder(
88+
$meta,
89+
self::$previousGroup,
90+
self::$sortOrder
91+
),
92+
],
93+
],
94+
],
95+
'children' => [
96+
static::DATA_SCOPE_STOCK => $this->getAlertStockFieldset(),
97+
static::DATA_SCOPE_PRICE => $this->getAlertPriceFieldset()
98+
],
99+
],
100+
]
101+
);
102+
103+
return $meta;
104+
}
105+
106+
/**
107+
* @return bool
108+
*/
109+
private function canShowTab()
110+
{
111+
$alertPriceAllow = $this->scopeConfig->getValue(
112+
'catalog/productalert/allow_price',
113+
ScopeInterface::SCOPE_STORE
114+
);
115+
$alertStockAllow = $this->scopeConfig->getValue(
116+
'catalog/productalert/allow_stock',
117+
ScopeInterface::SCOPE_STORE
118+
);
119+
120+
return ($alertPriceAllow || $alertStockAllow);
121+
}
122+
123+
/**
124+
* Prepares config for the alert stock products fieldset
125+
* @return array
126+
*/
127+
private function getAlertStockFieldset()
128+
{
129+
return [
130+
'arguments' => [
131+
'data' => [
132+
'config' => [
133+
'label' => __('Alert stock'),
134+
'componentType' => 'container',
135+
'component' => 'Magento_Ui/js/form/components/html',
136+
'additionalClasses' => 'admin__fieldset-note',
137+
'content' =>
138+
'<h4>' . __('Alert Stock') . '</h4>' .
139+
$this->layoutFactory->create()->createBlock(
140+
Stock::class
141+
)->toHtml(),
142+
]
143+
]
144+
]
145+
];
146+
}
147+
148+
/**
149+
* Prepares config for the alert price products fieldset
150+
* @return array
151+
*/
152+
private function getAlertPriceFieldset()
153+
{
154+
return [
155+
'arguments' => [
156+
'data' => [
157+
'config' => [
158+
'label' => __('Alert price'),
159+
'componentType' => 'container',
160+
'component' => 'Magento_Ui/js/form/components/html',
161+
'additionalClasses' => 'admin__fieldset-note',
162+
'content' =>
163+
'<h4>' . __('Alert Price') . '</h4>' .
164+
$this->layoutFactory->create()->createBlock(
165+
Price::class
166+
)->toHtml(),
167+
]
168+
]
169+
]
170+
];
171+
}
172+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Ui\DataProvider\Product;
7+
8+
/**
9+
* Collection which is used for rendering product list in the backend.
10+
*
11+
* Used for product grid and customizes behavior of the default Product collection for grid needs.
12+
*/
13+
class ProductCollection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
14+
{
15+
/**
16+
* Disables using of price index for grid rendering
17+
*
18+
* Admin area shouldn't use price index and should rely on actual product data instead.
19+
*
20+
* @codeCoverageIgnore
21+
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
22+
*/
23+
protected function _productLimitationJoinPrice()
24+
{
25+
$this->_productLimitationFilters->setUsePriceIndex(false);
26+
return $this->_productLimitationPrice(true);
27+
}
28+
}

app/code/Magento/Catalog/etc/adminhtml/di.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
<type name="Magento\Catalog\Model\ResourceModel\Attribute">
7878
<plugin name="invalidate_pagecache_after_attribute_save" type="Magento\Catalog\Plugin\Model\ResourceModel\Attribute\Save" />
7979
</type>
80+
<virtualType name="\Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory" type="\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory">
81+
<arguments>
82+
<argument name="instanceName" xsi:type="string">\Magento\Catalog\Ui\DataProvider\Product\ProductCollection</argument>
83+
</arguments>
84+
</virtualType>
8085
<type name="Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider">
8186
<arguments>
8287
<argument name="addFieldStrategies" xsi:type="array">
@@ -85,6 +90,7 @@
8590
<argument name="addFilterStrategies" xsi:type="array">
8691
<item name="store_id" xsi:type="object">Magento\Catalog\Ui\DataProvider\Product\AddStoreFieldToCollection</item>
8792
</argument>
93+
<argument name="collectionFactory" xsi:type="object">\Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory</argument>
8894
</arguments>
8995
</type>
9096
<type name="Magento\Catalog\Model\Product\Action">
@@ -142,6 +148,10 @@
142148
<item name="class" xsi:type="string">Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Attributes</item>
143149
<item name="sortOrder" xsi:type="number">120</item>
144150
</item>
151+
<item name="alerts" xsi:type="array">
152+
<item name="class" xsi:type="string">Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Alerts</item>
153+
<item name="sortOrder" xsi:type="number">130</item>
154+
</item>
145155
</argument>
146156
</arguments>
147157
</virtualType>

app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ switch ($type = $block->getType()) {
203203
<?php echo $block->getReviewsSummaryHtml($_item, $templateType) ?>
204204
<?php endif; ?>
205205

206-
<?php if (!$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?>
206+
<?php if ($canItemsAddToCart && !$_item->isComposite() && $_item->isSaleable() && $type == 'related'): ?>
207207
<?php if (!$_item->getRequiredOptions()): ?>
208208
<div class="field choice related">
209209
<input type="checkbox" class="checkbox related" id="related-checkbox<?php /* @escapeNotVerified */ echo $_item->getId() ?>" name="related_products[]" value="<?php /* @escapeNotVerified */ echo $_item->getId() ?>" />
@@ -252,7 +252,7 @@ switch ($type = $block->getType()) {
252252
<?php endif; ?>
253253
</div>
254254
</div>
255-
<?php echo($iterator == count($items)+1) ? '</li>' : '' ?>
255+
<?php echo($iterator == count($items) + 1) ? '</li>' : '' ?>
256256
<?php endforeach ?>
257257
</ol>
258258
</div>

app/code/Magento/Checkout/Model/PaymentInformationManagement.php

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class PaymentInformationManagement implements \Magento\Checkout\Api\PaymentInfor
1414
{
1515
/**
1616
* @var \Magento\Quote\Api\BillingAddressManagementInterface
17+
* @deprecated This call was substituted to eliminate extra quote::save call.
1718
*/
1819
protected $billingAddressManagement;
1920

@@ -44,26 +45,37 @@ class PaymentInformationManagement implements \Magento\Checkout\Api\PaymentInfor
4445
*/
4546
private $logger;
4647

48+
/**
49+
* Provide active quote.
50+
*
51+
* @var \Magento\Quote\Api\CartRepositoryInterface
52+
*/
53+
private $cartRepository;
54+
4755
/**
4856
* @param \Magento\Quote\Api\BillingAddressManagementInterface $billingAddressManagement
49-
* @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
50-
* @param \Magento\Quote\Api\CartManagementInterface $cartManagement
51-
* @param PaymentDetailsFactory $paymentDetailsFactory
52-
* @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
57+
* @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
58+
* @param \Magento\Quote\Api\CartManagementInterface $cartManagement
59+
* @param PaymentDetailsFactory $paymentDetailsFactory
60+
* @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
61+
* @param \Magento\Quote\Api\CartRepositoryInterface|null $cartRepository
5362
* @codeCoverageIgnore
5463
*/
5564
public function __construct(
5665
\Magento\Quote\Api\BillingAddressManagementInterface $billingAddressManagement,
5766
\Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement,
5867
\Magento\Quote\Api\CartManagementInterface $cartManagement,
5968
\Magento\Checkout\Model\PaymentDetailsFactory $paymentDetailsFactory,
60-
\Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
69+
\Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository,
70+
\Magento\Quote\Api\CartRepositoryInterface $cartRepository = null
6171
) {
6272
$this->billingAddressManagement = $billingAddressManagement;
6373
$this->paymentMethodManagement = $paymentMethodManagement;
6474
$this->cartManagement = $cartManagement;
6575
$this->paymentDetailsFactory = $paymentDetailsFactory;
6676
$this->cartTotalsRepository = $cartTotalsRepository;
77+
$this->cartRepository = $cartRepository ? : \Magento\Framework\App\ObjectManager::getInstance()
78+
->get(\Magento\Quote\Api\CartRepositoryInterface::class);
6779
}
6880

6981
/**
@@ -102,7 +114,17 @@ public function savePaymentInformation(
102114
\Magento\Quote\Api\Data\AddressInterface $billingAddress = null
103115
) {
104116
if ($billingAddress) {
105-
$this->billingAddressManagement->assign($cartId, $billingAddress);
117+
/** @var \Magento\Quote\Model\Quote $quote */
118+
$quote = $this->cartRepository->getActive($cartId);
119+
$quote->removeAddress($quote->getBillingAddress()->getId());
120+
$quote->setBillingAddress($billingAddress);
121+
$quote->setDataChanges(true);
122+
$shippingAddress = $quote->getShippingAddress();
123+
if ($shippingAddress && $shippingAddress->getShippingMethod()) {
124+
$shippingDataArray = explode('_', $shippingAddress->getShippingMethod());
125+
$shippingCarrier = array_shift($shippingDataArray);
126+
$shippingAddress->setLimitCarrier($shippingCarrier);
127+
}
106128
}
107129
$this->paymentMethodManagement->set($cartId, $paymentMethod);
108130

@@ -133,7 +155,6 @@ private function getLogger()
133155
if (!$this->logger) {
134156
$this->logger = \Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class);
135157
}
136-
137158
return $this->logger;
138159
}
139160
}

0 commit comments

Comments
 (0)