Skip to content

Commit a86ea1c

Browse files
author
vnayda
committed
MAGETWO-52717: [GitHub] Configurable product disabling lowest price associated product still shows its price #4419
-- fix integration tests
1 parent 0027ad7 commit a86ea1c

File tree

7 files changed

+40
-17
lines changed

7 files changed

+40
-17
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ public function build($productId)
7676
[]
7777
)->joinInner(
7878
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
79-
sprintf('%s.%s = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
80-
[$linkField]
79+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
80+
['entity_id']
8181
)->joinInner(
8282
['t' => $this->resource->getTableName('catalog_product_index_price')],
83-
sprintf('t.entity_id = %s.%s', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
83+
sprintf('t.entity_id = %s.entity_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
8484
[]
85-
)->where("parent.{$linkField} = ?", $productId)
85+
)->where('parent.entity_id = ?', $productId)
8686
->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId())
8787
->where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId())
8888
->order('t.min_price ' . Select::SQL_ASC)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ public function build($productId)
8585
[]
8686
)->joinInner(
8787
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
88-
sprintf('%s.%s = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
89-
[$linkField]
88+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
89+
['entity_id']
9090
)->joinInner(
9191
['t' => $priceAttribute->getBackendTable()],
9292
sprintf('t.%s = %s.%1$s', $linkField, BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
9393
[]
94-
)->where("parent.{$linkField} = ?", $productId)
94+
)->where('parent.entity_id = ?', $productId)
9595
->where('t.attribute_id = ?', $priceAttribute->getAttributeId())
9696
->where('t.value IS NOT NULL')
9797
->order('t.value ' . Select::SQL_ASC)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ public function build($productId)
106106
[]
107107
)->joinInner(
108108
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
109-
sprintf('%s.%s = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
110-
[$linkField]
109+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
110+
['entity_id']
111111
)->joinInner(
112112
['t' => $specialPriceAttribute->getBackendTable()],
113113
sprintf('t.%s = %s.%1$s', $linkField, BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
@@ -126,7 +126,7 @@ public function build($productId)
126126
$specialPriceToDate->getAttributeId()
127127
),
128128
''
129-
)->where("parent.{$linkField} = ?", $productId)
129+
)->where('parent.entity_id = ?', $productId)
130130
->where('t.attribute_id = ?', $specialPriceAttribute->getAttributeId())
131131
->where('t.value IS NOT NULL')
132132
->where(

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public function build($productId)
8787
[]
8888
)->joinInner(
8989
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
90-
sprintf('%s.%s = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
91-
[$linkField]
90+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
91+
['entity_id']
9292
)->joinInner(
9393
['t' => $this->resource->getTableName('catalog_product_entity_tier_price')],
9494
sprintf('t.%s = %s.%1$s', $linkField, BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
9595
[]
96-
)->where("parent.{$linkField} = ?", $productId)
96+
)->where('parent.entity_id = ?', $productId)
9797
->where('t.all_groups = 1 OR customer_group_id = ?', $this->customerSession->getCustomerGroupId())
9898
->where('t.qty = ?', 1)
9999
->order('t.value ' . Select::SQL_ASC)

app/code/Magento/CatalogInventory/Model/ResourceModel/Product/StockStatusBaseSelectProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function process(Select $select)
5252
/** @var Select $select */
5353
$select->join(
5454
['stock' => $stockStatusTable],
55-
sprintf('stock.product_id = %s.%s', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
55+
sprintf('stock.product_id = %s.entity_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
5656
[]
5757
)
5858
->where('stock.stock_status = ?', Stock::STOCK_IN_STOCK);

app/code/Magento/CatalogRule/Model/ResourceModel/Product/LinkedProductSelectBuilderByCatalogRulePrice.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ public function build($productId)
9494
[]
9595
)->joinInner(
9696
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
97-
sprintf('%s.%s = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
98-
[$linkField]
97+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
98+
['entity_id']
9999
)->joinInner(
100100
['t' => $this->resource->getTableName('catalogrule_product_price')],
101101
sprintf('t.product_id = %s.%s', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
102102
[]
103-
)->where("parent.{$linkField} = ?", $productId)
103+
)->where('parent.entity_id = ?', $productId)
104104
->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId())
105105
->where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId())
106106
->where('t.rule_date = ?', $currentDate)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
use Magento\Catalog\Api\ProductRepositoryInterface;
7+
use Magento\Framework\Exception\NoSuchEntityException;
8+
use Magento\TestFramework\Helper\Bootstrap;
9+
10+
$objectManager = Bootstrap::getObjectManager();
11+
/** @var ProductRepositoryInterface $productRepository */
12+
$productRepository = Bootstrap::getObjectManager()->get(ProductRepositoryInterface::class);
13+
14+
foreach (['sku_10', 'sku_20', 'configurable_product_with_two_simple'] as $sku) {
15+
try {
16+
$product = $productRepository->get($sku, false, null, true);
17+
$productRepository->delete($product);
18+
} catch (NoSuchEntityException $e) {
19+
//Product already removed
20+
}
21+
}
22+
23+
require __DIR__ . '/configurable_attribute_rollback.php';

0 commit comments

Comments
 (0)