Skip to content

Commit 6180e23

Browse files
author
Oleksandr Dubovyk
committed
MC-30255: In Stock Alert Email Shows Incorrect Item Pricing
- static
1 parent 4a70423 commit 6180e23

File tree

9 files changed

+35
-9
lines changed

9 files changed

+35
-9
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
use Magento\Store\Model\Indexer\WebsiteDimensionProvider;
1616
use Magento\Framework\Search\Request\IndexScopeResolverInterface;
1717

18+
/**
19+
* Class LinkedProductSelectBuilderByIndexPrice
20+
*
21+
* Provide Select object for retrieve product id by index price.
22+
*
23+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
24+
*/
1825
class LinkedProductSelectBuilderByIndexPrice implements LinkedProductSelectBuilderInterface
1926
{
2027
/**
@@ -83,7 +90,7 @@ public function __construct(
8390
}
8491

8592
/**
86-
* {@inheritdoc}
93+
* @inheritdoc
8794
*/
8895
public function build(int $productId, int $storeId) : array
8996
{

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
use Magento\Store\Model\Store;
1313

1414
/**
15+
* LinkedProductSelectBuilderBySpecialPrice
16+
*
17+
* Provide Select object for retrieve product id by special price
18+
*
1519
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1620
*/
1721
class LinkedProductSelectBuilderBySpecialPrice implements LinkedProductSelectBuilderInterface
@@ -88,7 +92,7 @@ public function __construct(
8892
}
8993

9094
/**
91-
* {@inheritdoc}
95+
* @inheritdoc
9296
*/
9397
public function build(int $productId, int $storeId) : array
9498
{

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Framework\DB\Select;
1111

12+
/**
13+
* LinkedProductSelectBuilderByTierPrice
14+
*
15+
* Provide Select object for retrieve product id by tier price
16+
*
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
18+
*/
1219
class LinkedProductSelectBuilderByTierPrice implements LinkedProductSelectBuilderInterface
1320
{
1421
/**
1522
* Default website id
23+
*
24+
* Constant represents default website id
1625
*/
1726
const DEFAULT_WEBSITE_ID = 0;
1827

@@ -72,7 +81,7 @@ public function __construct(
7281
}
7382

7483
/**
75-
* {@inheritdoc}
84+
* @inheritdoc
7685
*/
7786
public function build(int $productId, int $storeId) : array
7887
{

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Catalog\Model\ResourceModel\Product;
88

9+
/**
10+
* Collect Select object for list of products
11+
*/
912
class LinkedProductSelectBuilderComposite implements LinkedProductSelectBuilderInterface
1013
{
1114
/**
@@ -22,14 +25,15 @@ public function __construct($linkedProductSelectBuilder)
2225
}
2326

2427
/**
25-
* {@inheritdoc}
28+
* @inheritdoc
2629
*/
2730
public function build(int $productId, int $storeId) : array
2831
{
2932
$selects = [];
3033
foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) {
31-
$selects = array_merge($selects, $productSelectBuilder->build($productId, $storeId));
34+
$selects[] = $productSelectBuilder->build($productId, $storeId);
3235
}
36+
$selects = array_merge(...$selects);
3337

3438
return $selects;
3539
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
interface LinkedProductSelectBuilderInterface
1212
{
1313
/**
14+
* Build Select objects
15+
*
1416
* @param int $productId
1517
* @param int $storeId
1618
* @return \Magento\Framework\DB\Select[]

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPriceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ protected function setUp()
8585
public function testBuild()
8686
{
8787
$productId = 10;
88+
$storeId = 1;
8889
$metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadataInterface::class)
8990
->disableOriginalConstructor()
9091
->getMockForAbstractClass();
@@ -108,6 +109,6 @@ public function testBuild()
108109
$metadata->expects($this->once())->method('getLinkField')->willReturn('row_id');
109110
$this->resourceMock->expects($this->any())->method('getTableName');
110111
$this->baseSelectProcessorMock->expects($this->once())->method('process')->willReturnSelf();
111-
$this->model->build($productId);
112+
$this->model->build($productId, $storeId);
112113
}
113114
}

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Product/LinkedProductSelectBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function __construct(
3939
}
4040

4141
/**
42-
* {@inheritdoc}
42+
* @inheritdoc
4343
*/
4444
public function build(int $productId, int $storeId) : array
4545
{

app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(
6262
}
6363

6464
/**
65-
* {@inheritdoc}
65+
* @inheritdoc
6666
*/
6767
public function getProducts(ProductInterface $product)
6868
{

app/code/Magento/ProductAlert/Model/Observer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ protected function _getWebsites()
193193
protected function _processPrice(\Magento\ProductAlert\Model\Email $email)
194194
{
195195
$email->setType('price');
196-
echo('price ');
197196
foreach ($this->_getWebsites() as $website) {
198197
/* @var $website \Magento\Store\Model\Website */
199198
if (!$website->getDefaultGroup() || !$website->getDefaultGroup()->getDefaultStore()) {

0 commit comments

Comments
 (0)