Skip to content

Commit eec3eed

Browse files
author
Sergey Shvets
committed
Merge branch '2.1-develop' of github.com:magento/magento2ce into MAGETWO-71051
2 parents b15720d + 747f3ac commit eec3eed

File tree

38 files changed

+398
-173
lines changed

38 files changed

+398
-173
lines changed

app/code/Magento/Catalog/Model/Attribute/Backend/Startdate.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ protected function _getValueForSave($object)
4444
{
4545
$attributeName = $this->getAttribute()->getName();
4646
$startDate = $object->getData($attributeName);
47-
if ($startDate === false) {
48-
return false;
49-
}
50-
if ($startDate == '' && $object->getSpecialPrice()) {
51-
$startDate = $this->_localeDate->date();
52-
}
5347

5448
return $startDate;
5549
}

app/code/Magento/Catalog/Model/Category.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,11 @@ public function reindex()
10921092
if ($this->flatState->isFlatEnabled()) {
10931093
$flatIndexer = $this->indexerRegistry->get(Indexer\Category\Flat\State::INDEXER_ID);
10941094
if (!$flatIndexer->isScheduled()) {
1095-
$flatIndexer->reindexRow($this->getId());
1095+
$idsList = [$this->getId()];
1096+
if ($this->dataHasChangedFor('url_key')) {
1097+
$idsList = array_merge($idsList, explode(',', $this->getAllChildren()));
1098+
}
1099+
$flatIndexer->reindexList($idsList);
10961100
}
10971101
}
10981102
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Observer;
7+
8+
use Magento\Framework\Event\ObserverInterface;
9+
10+
/**
11+
* Set value for Special Price start date
12+
*/
13+
class SetSpecialPriceStartDate implements ObserverInterface
14+
{
15+
/**
16+
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
17+
*/
18+
private $localeDate;
19+
20+
/**
21+
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
22+
* @codeCoverageIgnore
23+
*/
24+
public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
25+
{
26+
$this->localeDate = $localeDate;
27+
}
28+
29+
/**
30+
* Set the current date to Special Price From attribute if it empty
31+
*
32+
* @param \Magento\Framework\Event\Observer $observer
33+
* @return $this
34+
*/
35+
public function execute(\Magento\Framework\Event\Observer $observer)
36+
{
37+
/** @var $product \Magento\Catalog\Model\Product */
38+
$product = $observer->getEvent()->getProduct();
39+
if ($product->getSpecialPrice() && !$product->getSpecialFromDate()) {
40+
$product->setData('special_from_date', $this->localeDate->date());
41+
}
42+
43+
return $this;
44+
}
45+
}

app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
437437
->will($this->returnValue(true));
438438

439439
$this->flatIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($flatScheduled));
440-
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexRow')->with('123');
440+
$this->flatIndexer->expects($this->exactly($expectedFlatReindexCalls))->method('reindexList')->with(['123']);
441441

442442
$this->productIndexer->expects($this->exactly(1))->method('isScheduled')->will($this->returnValue($productScheduled));
443443
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))->method('reindexList')->with($pathIds);

app/code/Magento/Catalog/etc/events.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@
5454
<event name="admin_system_config_changed_section_catalog">
5555
<observer name="catalog_update_price_attribute" instance="Magento\Catalog\Observer\SwitchPriceAttributeScopeOnConfigChange" />
5656
</event>
57+
<event name="catalog_product_save_before">
58+
<observer name="set_special_price_start_date" instance="Magento\Catalog\Observer\SetSpecialPriceStartDate" />
59+
</event>
5760
</config>

app/code/Magento/Catalog/view/adminhtml/templates/catalog/wysiwyg/js.phtml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,22 @@ var catalogWysiwygEditor = {
6969
$(elementId + '_editor').value = $(elementId).value;
7070
},
7171
okDialogWindow : function(dialogWindow) {
72-
if (dialogWindow.options.firedElementId) {
73-
wysiwygObj = eval('wysiwyg'+dialogWindow.options.firedElementId+'_editor');
72+
var $firedElement = jQuery('#' + dialogWindow.options.firedElementId),
73+
$editorElement = jQuery('#' + dialogWindow.options.firedElementId + '_editor'),
74+
firedElementId = $firedElement.attr('id'),
75+
wysiwygObj = window['wysiwyg' + firedElementId + '_editor'];
76+
77+
if ($firedElement.length) {
7478
wysiwygObj.turnOff();
7579
if (tinyMCE.get(wysiwygObj.id)) {
76-
$(dialogWindow.options.firedElementId).value = tinyMCE.get(wysiwygObj.id).getContent();
80+
$firedElement.val(tinyMCE.get(wysiwygObj.id).getContent()).change();
7781
} else {
78-
if ($(dialogWindow.options.firedElementId+'_editor')) {
79-
$(dialogWindow.options.firedElementId).value = $(dialogWindow.options.firedElementId+'_editor').value;
80-
}
82+
$firedElement.val($editorElement.val()).change();
83+
}
84+
85+
if (tinyMCE.get(firedElementId)) {
86+
tinyMCE.get(firedElementId).load();
8187
}
82-
tinyMCE.editors[dialogWindow.options.firedElementId].load();
8388
if (typeof varienGlobalEvents != undefined) {
8489
varienGlobalEvents.fireEvent('tinymceChange');
8590
}

app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ define([
66
'jquery',
77
'underscore',
88
'uiRegistry',
9-
'jquery/ui'
9+
'jquery/ui',
10+
'mage/translate'
1011
], function ($, _, registry) {
1112
'use strict';
1213

app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ define([
77
'jquery',
88
'Magento_Ui/js/lib/validation/utils',
99
'Magento_Ui/js/form/element/abstract',
10-
'Magento_Ui/js/lib/validation/validator'
10+
'Magento_Ui/js/lib/validation/validator',
11+
'mage/translate'
1112
], function ($, utils, Abstract, validator) {
1213
'use strict';
1314

app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
*/
55
define([
66
'uiComponent',
7-
'Magento_Customer/js/customer-data'
7+
'Magento_Customer/js/customer-data',
8+
'mage/translate'
89
], function (Component, customerData) {
910
'use strict';
1011

1112
var sidebarInitialized = false;
1213

1314
function initSidebar() {
1415
if (sidebarInitialized) {
15-
return ;
16+
return;
1617
}
1718
sidebarInitialized = true;
1819
require([
1920
'jquery',
2021
'mage/mage'
2122
], function ($) {
23+
/*eslint-disable max-len*/
2224
$('[data-role=compare-products-sidebar]').mage('compareItems', {
23-
"removeConfirmMessage": $.mage.__(
24-
"Are you sure you want to remove this item from your Compare Products list?"
25-
),
26-
"removeSelector": "#compare-items a.action.delete",
27-
"clearAllConfirmMessage": $.mage.__(
28-
"Are you sure you want to remove all items from your Compare Products list?"
29-
),
30-
"clearAllSelector": "#compare-clear-all"
25+
'removeConfirmMessage': $.mage.__('Are you sure you want to remove this item from your Compare Products list?'),
26+
'removeSelector': '#compare-items a.action.delete',
27+
'clearAllConfirmMessage': $.mage.__('Are you sure you want to remove all items from your Compare Products list?'),
28+
'clearAllSelector': '#compare-clear-all'
3129
});
30+
31+
/*eslint-enable max-len*/
3232
});
3333
}
3434

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ define([
224224

225225
if (msg) {
226226
alert({
227-
content: $.mage.__(msg)
227+
content: msg
228228
});
229229
}
230230
}

0 commit comments

Comments
 (0)