Skip to content

Commit 7af4e4b

Browse files
authored
Merge pull request #416 from magento-folks/2.0.11_bugs_pr
[Folks] 2.0.11 bugs - MAGETWO-56955 [Backport] - Validation message displayed all the time - for 2.0 - MAGETWO-57681 [GITHUB] Customer cannot reorder if the order has been invoiced or shipped #6278
2 parents 11abd08 + 3d5fdc9 commit 7af4e4b

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

app/code/Magento/Sales/Model/ResourceModel/Order/Item/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ protected function _afterLoad()
5555
* Assign parent items
5656
*/
5757
foreach ($this as $item) {
58+
$this->_resource->unserializeFields($item);
5859
if ($item->getParentItemId()) {
5960
$item->setParentItem($this->getItemById($item->getParentItemId()));
6061
}

app/code/Magento/Theme/view/frontend/web/js/view/messages.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,35 @@
55
define([
66
'jquery',
77
'uiComponent',
8+
'underscore',
89
'Magento_Customer/js/customer-data',
910
'jquery/jquery-storageapi'
10-
], function ($, Component, customerData) {
11+
], function ($, Component, _, customerData) {
1112
'use strict';
1213

1314
return Component.extend({
1415
defaults: {
1516
cookieMessages: [],
1617
messages: []
1718
},
19+
20+
/** @inheritdoc */
1821
initialize: function () {
1922
this._super();
2023

2124
this.cookieMessages = $.cookieStorage.get('mage-messages');
22-
this.messages = customerData.get('messages').extend({disposableCustomerData: 'messages'});
23-
$.cookieStorage.setConf({path: '/', expires: -1}).set('mage-messages', null);
25+
this.messages = customerData.get('messages').extend({
26+
disposableCustomerData: 'messages'
27+
});
28+
29+
if (!_.isEmpty(this.messages().messages)) {
30+
customerData.set('messages', {});
31+
}
32+
33+
$.cookieStorage.setConf({
34+
path: '/',
35+
expires: -1
36+
}).set('mage-messages', null);
2437
}
2538
});
2639
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Model\ResourceModel;
7+
8+
class OrderItemTest extends \PHPUnit_Framework_TestCase
9+
{
10+
/**
11+
* @var \Magento\Framework\ObjectManagerInterface
12+
*/
13+
private $objectManager;
14+
15+
protected function setUp()
16+
{
17+
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
18+
}
19+
20+
/**
21+
* Verify that serialized order item data was unserialized after load
22+
*
23+
* @magentoDataFixture Magento/Catalog/_files/order_item_with_product_and_custom_options.php
24+
*/
25+
public function testGetOrderItem()
26+
{
27+
/** @var \Magento\Sales\Model\Order $order */
28+
$order = $this->objectManager->create(\Magento\Sales\Model\Order::class);
29+
$order->loadByIncrementId('100000001');
30+
$items = $order->getItemsCollection();
31+
$this->assertNotEquals(0, $items->getSize());
32+
foreach ($items as $item) {
33+
$info = $item->getDataByKey('product_options');
34+
$this->assertTrue(is_array($info));
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)