Skip to content

Commit 12d6317

Browse files
author
Yushkin, Dmytro
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce into MAGETWO-39729
2 parents 1f70df4 + 2b81885 commit 12d6317

File tree

6 files changed

+61
-9
lines changed

6 files changed

+61
-9
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,11 +1159,10 @@ public function setFinalPrice($price)
11591159
*/
11601160
public function getFinalPrice($qty = null)
11611161
{
1162-
$price = $this->_getData('final_price');
1163-
if ($price !== null) {
1164-
return $price;
1162+
if ($this->_getData('final_price') === null) {
1163+
$this->setFinalPrice($this->getPriceModel()->getFinalPrice($qty, $this));
11651164
}
1166-
return $this->getPriceModel()->getFinalPrice($qty, $this);
1165+
return $this->_getData('final_price');
11671166
}
11681167

11691168
/**

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,4 +1370,41 @@ protected function getPropertyValue(&$object, $property)
13701370

13711371
return $reflectionProperty->getValue($object);
13721372
}
1373+
1374+
public function testGetFinalPrice()
1375+
{
1376+
$finalPrice = 11;
1377+
$qty = 1;
1378+
$this->model->setQty($qty);
1379+
$productTypePriceMock = $this->getMock(
1380+
'Magento\Catalog\Model\Product\Type\Price',
1381+
['getFinalPrice'],
1382+
[],
1383+
'',
1384+
false
1385+
);
1386+
1387+
$productTypePriceMock->expects($this->any())
1388+
->method('getFinalPrice')
1389+
->with($qty, $this->model)
1390+
->will($this->returnValue($finalPrice));
1391+
1392+
$this->productTypeInstanceMock->expects($this->any())
1393+
->method('priceFactory')
1394+
->with($this->model->getTypeId())
1395+
->will($this->returnValue($productTypePriceMock));
1396+
1397+
$this->assertEquals($finalPrice, $this->model->getFinalPrice($qty));
1398+
$this->model->setFinalPrice(9.99);
1399+
}
1400+
1401+
public function testGetFinalPricePreset()
1402+
{
1403+
$finalPrice = 9.99;
1404+
$qty = 1;
1405+
$this->model->setQty($qty);
1406+
$this->model->setFinalPrice($finalPrice);
1407+
$this->productTypeInstanceMock->expects($this->never())->method('priceFactory');
1408+
$this->assertEquals($finalPrice, $this->model->getFinalPrice($qty));
1409+
}
13731410
}

app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Actions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ protected function _prepareForm()
140140
'stop_rules_processing',
141141
'select',
142142
[
143-
'label' => __('Subsequent rules'),
144-
'title' => __('Subsequent rules'),
143+
'label' => __('Discard subsequent rules'),
144+
'title' => __('Discard subsequent rules'),
145145
'name' => 'stop_rules_processing',
146146
'options' => ['1' => __('Yes'), '0' => __('No')]
147147
]

app/code/Magento/CatalogRule/Model/Indexer/AbstractIndexer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
use Magento\Framework\Mview\ActionInterface as MviewActionInterface;
99
use Magento\Indexer\Model\ActionInterface as IndexerActionInterface;
10+
use Magento\Framework\Object\IdentityInterface as IdentityInterface;
1011

11-
abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInterface
12+
abstract class AbstractIndexer implements IndexerActionInterface, MviewActionInterface, IdentityInterface
1213
{
1314
/**
1415
* @var IndexBuilder
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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/Event/etc/events.xsd">
9+
<event name="catalog_product_get_final_price">
10+
<observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="processFrontFinalPrice" />
11+
</event>
12+
<event name="prepare_catalog_product_collection_prices">
13+
<observer name="catalogrule" instance="Magento\CatalogRule\Model\Observer" method="prepareCatalogProductCollectionPrices" />
14+
</event>
15+
</config>

app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Actions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ protected function _prepareForm()
154154
'stop_rules_processing',
155155
'select',
156156
[
157-
'label' => __('Subsequent rules'),
158-
'title' => __('Subsequent rules'),
157+
'label' => __('Discard subsequent rules'),
158+
'title' => __('Discard subsequent rules'),
159159
'name' => 'stop_rules_processing',
160160
'options' => ['1' => __('Yes'), '0' => __('No')]
161161
]

0 commit comments

Comments
 (0)