11
11
use Magento \CatalogInventory \Model \Indexer \ProductPriceIndexFilter ;
12
12
use Magento \Framework \App \ResourceConnection ;
13
13
14
+ /**
15
+ * Checks if product is part of dynamic price bundle and skips price reindex
16
+ */
14
17
class ProductPriceIndexModifier
15
18
{
16
19
/**
@@ -23,6 +26,10 @@ class ProductPriceIndexModifier
23
26
*/
24
27
private ?string $ connectionName ;
25
28
29
+ /**
30
+ * @param ResourceConnection $resourceConnection
31
+ * @param string $connectionName
32
+ */
26
33
public function __construct (ResourceConnection $ resourceConnection , string $ connectionName = 'indexer ' )
27
34
{
28
35
$ this ->resourceConnection = $ resourceConnection ;
@@ -39,8 +46,12 @@ public function __construct(ResourceConnection $resourceConnection, string $conn
39
46
* @param array $entityIds
40
47
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
41
48
*/
42
- public function aroundModifyPrice (ProductPriceIndexFilter $ subject , callable $ proceed , IndexTableStructure $ priceTable , array $ entityIds = [])
43
- {
49
+ public function aroundModifyPrice (
50
+ ProductPriceIndexFilter $ subject ,
51
+ callable $ proceed ,
52
+ IndexTableStructure $ priceTable ,
53
+ array $ entityIds = []
54
+ ) {
44
55
if (empty ($ entityIds )) {
45
56
$ proceed ($ priceTable , []);
46
57
}
@@ -78,6 +89,6 @@ private function isWithinDynamicPriceBundle(string $priceTableName, int $product
78
89
$ select ->where ('entity.type_id = ? ' , \Magento \Catalog \Model \Product \Type::TYPE_BUNDLE );
79
90
$ select ->where ('price.tax_class_id = ? ' , \Magento \Bundle \Model \Product \Price::PRICE_TYPE_DYNAMIC );
80
91
81
- return (int ) $ connection ->fetchOne ($ select ) != 0 ;
92
+ return (int )$ connection ->fetchOne ($ select ) != 0 ;
82
93
}
83
94
}
0 commit comments