Skip to content

Commit 01273ae

Browse files
author
Michael Logvin
committed
Merge branch 'develop' into MAGETWO-34646
2 parents 9f5a099 + 635ce44 commit 01273ae

File tree

153 files changed

+4248
-1177
lines changed

Some content is hidden

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

153 files changed

+4248
-1177
lines changed

app/code/Magento/Backend/Block/Menu.php

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ protected function _addSubMenu($menuItem, $level, $limit, $id = null)
436436
* @param array $colBrakes
437437
* @return string HTML
438438
* @SuppressWarnings(PHPMD.NPathComplexity)
439+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
439440
*/
440441
public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
441442
{
@@ -454,21 +455,30 @@ public function renderNavigation($menu, $level = 0, $limit = 0, $colBrakes = [])
454455
}
455456

456457
$id = $this->getJsId($menuItem->getId());
457-
$output .= '<li ' . $this->getUiId(
458-
$menuItem->getId()
459-
) . ' class="item-' . $itemClass . ' ' . $this->_renderItemCssClass(
460-
$menuItem,
461-
$level
462-
) . ($level == 0 ? '" id="' . $id . '" aria-haspopup="true' : '')
463-
. '" role="menu-item">' . $this->_renderAnchor(
464-
$menuItem,
465-
$level
466-
) . $this->_addSubMenu(
467-
$menuItem,
468-
$level,
469-
$limit,
470-
$id
471-
) . '</li>';
458+
if (count($menu) > 1 || $level != 1) {
459+
$output .= '<li ' . $this->getUiId(
460+
$menuItem->getId()
461+
) . ' class="item-' . $itemClass . ' ' . $this->_renderItemCssClass(
462+
$menuItem,
463+
$level
464+
) . ($level == 0 ? '" id="' . $id . '" aria-haspopup="true' : '')
465+
. '" role="menu-item">' . $this->_renderAnchor(
466+
$menuItem,
467+
$level
468+
) . $this->_addSubMenu(
469+
$menuItem,
470+
$level,
471+
$limit,
472+
$id
473+
) . '</li>';
474+
} else {
475+
$output .= $this->_addSubMenu(
476+
$menuItem,
477+
$level,
478+
$limit,
479+
$id);
480+
}
481+
472482
$itemPosition++;
473483
}
474484

app/code/Magento/Bundle/etc/data_object.xml renamed to app/code/Magento/Bundle/etc/service_data_attributes.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* See COPYING.txt for license details.
66
*/
77
-->
8-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/data_object.xsd">
9-
<custom_attributes for="Magento\Catalog\Api\Data\ProductInterface">
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
9+
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
1010
<attribute code="bundle_product_options" type="Magento\Bundle\Api\Data\OptionInterface[]" />
11-
</custom_attributes>
11+
</extension_attributes>
1212
</config>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ protected function getExportData()
802802
}
803803
}
804804
} catch (\Exception $e) {
805-
$this->_logger->logException($e);
805+
$this->_logger->critical($e);
806806
}
807807
return $exportData;
808808
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Api/etc/service_data_attributes.xsd">
9+
<extension_attributes for="Magento\Catalog\Api\Data\ProductInterface">
10+
<!--
11+
Once this is merged with the branch with the CatalogInventory integration, need to make sure the permission
12+
below is actually used.
13+
<attribute code="stock_item" type="Magento\CatalogInventory\Api\Data\StockItemInterface">
14+
<resources>
15+
<resource ref="Magento_CatalogInventory::cataloginventory"/>
16+
</resources>
17+
</attribute>
18+
-->
19+
</extension_attributes>
20+
</config>

app/code/Magento/Checkout/Controller/Onepage/SaveOrder.php

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Checkout\Controller\Onepage;
77

8+
use Magento\Framework\Object;
89
use Magento\Framework\Exception\PaymentException;
910

1011
class SaveOrder extends \Magento\Checkout\Controller\Onepage
@@ -26,16 +27,17 @@ public function execute()
2627
return $this->_ajaxRedirectResponse();
2728
}
2829

29-
$result = [];
30+
$result = new Object();
3031
try {
3132
$agreementsValidator = $this->_objectManager->get('Magento\Checkout\Model\Agreements\AgreementsValidator');
3233
if (!$agreementsValidator->isValid(array_keys($this->getRequest()->getPost('agreement', [])))) {
33-
$result['success'] = false;
34-
$result['error'] = true;
35-
$result['error_messages'] = __(
36-
'Please agree to all the terms and conditions before placing the order.'
34+
$result->setData('success', false);
35+
$result->setData('error', true);
36+
$result->setData(
37+
'error_messages',
38+
__('Please agree to all the terms and conditions before placing the order.')
3739
);
38-
return $this->resultJsonFactory->create()->setData($result);
40+
return $this->resultJsonFactory->create()->setData($result->getData());
3941
}
4042

4143
$data = $this->getRequest()->getPost('payment', []);
@@ -54,55 +56,78 @@ public function execute()
5456
$this->getOnepage()->saveOrder();
5557

5658
$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
57-
$result['success'] = true;
58-
$result['error'] = false;
59+
$result->setData('success', true);
60+
$result->setData('error', false);
5961
} catch (PaymentException $e) {
6062
$message = $e->getMessage();
6163
if (!empty($message)) {
62-
$result['error_messages'] = $message;
64+
$result->setData('error_messages', $message);
6365
}
64-
$result['goto_section'] = 'payment';
65-
$result['update_section'] = ['name' => 'payment-method', 'html' => $this->_getPaymentMethodsHtml()];
66+
$result->setData('goto_section', 'payment');
67+
$result->setData(
68+
'update_section',
69+
[
70+
'name' => 'payment-method',
71+
'html' => $this->_getPaymentMethodsHtml()
72+
]
73+
);
6674
} catch (\Magento\Framework\Exception\LocalizedException $e) {
6775
$this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
6876
$this->_objectManager->get('Magento\Checkout\Helper\Data')
6977
->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
70-
$result['success'] = false;
71-
$result['error'] = true;
72-
$result['error_messages'] = $e->getMessage();
78+
$result->setData(
79+
'success',
80+
false
81+
);
82+
$result->setData('error', true);
83+
$result->setData('error_messages', $e->getMessage());
7384
$gotoSection = $this->getOnepage()->getCheckout()->getGotoSection();
7485
if ($gotoSection) {
75-
$result['goto_section'] = $gotoSection;
86+
$result->setData('goto_section', $gotoSection);
7687
$this->getOnepage()->getCheckout()->setGotoSection(null);
7788
}
7889

7990
$updateSection = $this->getOnepage()->getCheckout()->getUpdateSection();
8091
if ($updateSection) {
8192
if (isset($this->_sectionUpdateFunctions[$updateSection])) {
8293
$updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
83-
$result['update_section'] = [
84-
'name' => $updateSection,
85-
'html' => $this->{$updateSectionFunction}(),
86-
];
94+
$result->setData(
95+
'update_section',
96+
[
97+
'name' => $updateSection,
98+
'html' => $this->{$updateSectionFunction}(),
99+
]
100+
);
87101
}
88102
$this->getOnepage()->getCheckout()->setUpdateSection(null);
89103
}
90104
} catch (\Exception $e) {
91105
$this->_objectManager->get('Psr\Log\LoggerInterface')->critical($e);
92106
$this->_objectManager->get('Magento\Checkout\Helper\Data')
93107
->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
94-
$result['success'] = false;
95-
$result['error'] = true;
96-
$result['error_messages'] = __('Something went wrong processing your order. Please try again later.');
108+
$result->setData('success', false);
109+
$result->setData('error', true);
110+
$result->setData(
111+
'error_messages',
112+
__('Something went wrong processing your order. Please try again later.')
113+
);
97114
}
98115
/**
99116
* when there is redirect to third party, we don't want to save order yet.
100117
* we will save the order in return action.
101118
*/
102119
if (isset($redirectUrl)) {
103-
$result['redirect'] = $redirectUrl;
120+
$result->setData('redirect', $redirectUrl);
104121
}
105122

106-
return $this->resultJsonFactory->create()->setData($result);
123+
$this->_eventManager->dispatch(
124+
'checkout_controller_onepage_saveOrder',
125+
[
126+
'result' => $result,
127+
'action' => $this
128+
]
129+
);
130+
131+
return $this->resultJsonFactory->create()->setData($result->getData());
107132
}
108133
}

0 commit comments

Comments
 (0)