Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
08cf8b8
Don't recalculate tax for every price on category page
May 8, 2018
0293568
ENGCOM-1555: [Port 2.3-develop] Don't recalculate tax for every price…
magento-engcom-team May 21, 2018
6f23c88
MAGETWO-90802: Fix modularity of \Magento\Catalog\Block\Adminhtml\Pro…
StasKozar May 22, 2018
beb32b1
MAGETWO-90729: Imported products are incorrectly in stock if 'allow_b…
DianaRusin May 22, 2018
dffcf1b
MAGETWO-90357: After Deleting Product Update shopping cart is empty
StasKozar May 23, 2018
0eb2b6b
MAGETWO-92005: Make "Other Payment Methods" section in Admin expanded…
StasKozar May 23, 2018
1c21849
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90357
StasKozar May 23, 2018
998f3fc
MAGETWO-90729: Imported products are incorrectly in stock if 'allow_b…
DianaRusin May 23, 2018
1ed3c22
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90729
DianaRusin May 23, 2018
16d903c
MAGETWO-90729: Imported products are incorrectly in stock if 'allow_b…
DianaRusin May 23, 2018
001f7eb
MAGETWO-90729: Imported products are incorrectly in stock if 'allow_b…
DianaRusin May 23, 2018
3b04ce6
MAGETWO-90729: Imported products are incorrectly in stock if 'allow_b…
DianaRusin May 24, 2018
77f72b2
Merge remote-tracking branch 'origin/MAGETWO-90729' into 2.3-develop-…
StasKozar May 24, 2018
cdfeec2
Merge remote-tracking branch 'origin/MAGETWO-90802' into 2.3-develop-…
StasKozar May 24, 2018
3da1ebe
MAGETWO-90798: Customer is redirected to 404 from Catalog page if swi…
StasKozar May 24, 2018
949de44
Missing PHPDoc comment
May 24, 2018
2148394
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90357
ameysar May 25, 2018
c7bf6a4
Merge remote-tracking branch 'origin/MAGETWO-90357' into 2.3-develop-…
ameysar May 25, 2018
8680ad9
MAGETWO-90798: Customer is redirected to 404 from Catalog page if swi…
StasKozar May 25, 2018
cde1442
MAGETWO-90798: Customer is redirected to 404 from Catalog page if swi…
StasKozar May 25, 2018
2925aff
MAGETWO-90784: Catalog Rule is not applied
svitja May 25, 2018
5b7e6c3
MAGETWO-90789: [Magento cloud] Custom options should be cleared if cu…
DianaRusin May 25, 2018
b39774c
MAGETWO-90789: [Magento cloud] Custom options should be cleared if cu…
OlgaVasyltsun May 29, 2018
ea26c0d
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-90789
OlgaVasyltsun May 29, 2018
2f82461
MAGETWO-90784: Catalog Rule is not applied
svitja May 29, 2018
9e7f234
Merge remote-tracking branch 'origin/2.3-develop' into MAGETWO-92005
OlgaVasyltsun May 29, 2018
b7ec090
Merge remote-tracking branch 'origin/MAGETWO-92005' into 2.3-develop-…
OlgaVasyltsun May 29, 2018
92c4822
Merge remote-tracking branch 'origin/MAGETWO-90798' into 2.3-develop-…
svitja May 29, 2018
c78fbc0
Merge branch '2.3-develop' of github.com:magento/magento2 into 2.3-de…
May 29, 2018
2a20abd
Missing PHPDoc comment
May 29, 2018
2a3b27c
Merge remote-tracking branch 'origin/MAGETWO-90784' into 2.3-develop-…
svitja May 29, 2018
da0579a
Merge remote-tracking branch 'origin/MAGETWO-90789' into 2.3-develop-…
zakdma May 29, 2018
751c3e6
set alignment purchase order form and place order button
neeta-wagento May 19, 2018
fb0f192
Update _payments.less
dankhrapiyush May 21, 2018
d6aabc3
Update MagentoStyle.php
May 30, 2018
99cdd8c
ENGCOM-1667: Missing PHPDoc comment #15498
magento-engcom-team May 30, 2018
432fa08
ENGCOM-1716: [Forwardport] set alignment purchase order form and plac…
magento-engcom-team May 30, 2018
1e2019c
Issue 15469: Javascript error dropdowns.js
brian-labelle May 24, 2018
cab9b51
ENGCOM-1723: [Forwardport] Issue 15469: Javascript error dropdowns.js…
magento-engcom-team May 30, 2018
9b3fce9
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr20
zakdma May 31, 2018
548f4c6
ENGCOM-1723: [Forwardport] Issue 15469: Javascript error dropdowns.js…
May 31, 2018
b9f4253
ENGCOM-1716: [Forwardport] set alignment purchase order form and plac…
May 31, 2018
2543ff4
ENGCOM-1667: Missing PHPDoc comment #15498
May 31, 2018
140ae21
ENGCOM-1555: [Port 2.3-develop] Don't recalculate tax for every price…
May 31, 2018
b5a3f36
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr20
zakdma May 31, 2018
2f85d6e
[EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team Jun 1, 2018
c2b4657
:arrows_clockwise: [EngCom] Public Pull Requests - 2.3-develop
magento-engcom-team Jun 1, 2018
9f00b6a
merge magento/2.3-develop into magento-tsg/2.3-develop-pr20
Jun 1, 2018
853e180
Merge pull request #2629 from magento-tsg/2.3-develop-pr20
Jun 1, 2018
d5c3952
#14063 - Wrong invoice prefix in multistore setup due to default stor…
sanjay-wagento May 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,10 @@ protected function _reindexRows($changedIds = [])
if (!empty($notCompositeIds)) {
$parentProductsTypes = $this->getParentProductsTypes($notCompositeIds);
$productsTypes = array_merge_recursive($productsTypes, $parentProductsTypes);
$parentProductsIds = array_keys($parentProductsTypes);
$compositeIds = $compositeIds + array_combine($parentProductsIds, $parentProductsIds);
$changedIds = array_merge($changedIds, $parentProductsIds);
foreach ($parentProductsTypes as $parentProductsIds) {
$compositeIds = $compositeIds + $parentProductsIds;
$changedIds = array_merge($changedIds, $parentProductsIds);
}
}

if (!empty($compositeIds)) {
Expand Down Expand Up @@ -370,7 +371,8 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
['child_id']
)->join(
['e' => $this->_defaultIndexerResource->getTable('catalog_product_entity')],
'e.' . $linkField . ' = parent_id'
'e.' . $linkField . ' = parent_id',
[]
)->where(
'e.entity_id IN(?)',
$parentIds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function execute($ids = null)
// Prepare replica table for indexation.
$this->_defaultIndexerResource->getConnection()->truncateTable($replicaTable);

/** @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\AbstractIndexer $indexer */
/** @var \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice $indexer */
foreach ($this->getTypeIndexers() as $indexer) {
$indexer->getTableStrategy()->setUseIdxTable(false);
$connection = $indexer->getConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ class DefaultPrice extends AbstractIndexer implements PriceInterface
*/
private $hasEntity = null;

/**
* @var IndexTableStructureFactory
*/
private $indexTableStructureFactory;

/**
* @var PriceModifierInterface[]
*/
private $priceModifiers = [];

/**
* DefaultPrice constructor.
*
Expand All @@ -61,19 +71,34 @@ class DefaultPrice extends AbstractIndexer implements PriceInterface
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param \Magento\Framework\Module\Manager $moduleManager
* @param string|null $connectionName
* @param null|\Magento\Indexer\Model\Indexer\StateFactory $stateFactory
* @param null|IndexTableStructureFactory $indexTableStructureFactory
* @param PriceModifierInterface[] $priceModifiers
*/
public function __construct(
\Magento\Framework\Model\ResourceModel\Db\Context $context,
\Magento\Framework\Indexer\Table\StrategyInterface $tableStrategy,
\Magento\Eav\Model\Config $eavConfig,
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Framework\Module\Manager $moduleManager,
$connectionName = null
$connectionName = null,
IndexTableStructureFactory $indexTableStructureFactory = null,
array $priceModifiers = []
) {
$this->_eventManager = $eventManager;
$this->moduleManager = $moduleManager;
parent::__construct($context, $tableStrategy, $eavConfig, $connectionName);

$this->indexTableStructureFactory = $indexTableStructureFactory ?:
\Magento\Framework\App\ObjectManager::getInstance()->get(IndexTableStructureFactory::class);
foreach ($priceModifiers as $priceModifier) {
if (!($priceModifier instanceof PriceModifierInterface)) {
throw new \InvalidArgumentException(
'Argument \'priceModifiers\' must be of the type ' . PriceModifierInterface::class . '[]'
);
}

$this->priceModifiers[] = $priceModifier;
}
}

/**
Expand Down Expand Up @@ -209,13 +234,41 @@ protected function _getDefaultFinalPriceTable()
* Prepare final price temporary index table
*
* @return $this
* @deprecated
* @see prepareFinalPriceTable()
*/
protected function _prepareDefaultFinalPriceTable()
{
$this->getConnection()->delete($this->_getDefaultFinalPriceTable());
return $this;
}

/**
* Create (if needed), clean and return structure of final price table
*
* @return IndexTableStructure
*/
private function prepareFinalPriceTable()
{
$tableName = $this->_getDefaultFinalPriceTable();
$this->getConnection()->delete($tableName);

$finalPriceTable = $this->indexTableStructureFactory->create([
'tableName' => $tableName,
'entityField' => 'entity_id',
'customerGroupField' => 'customer_group_id',
'websiteField' => 'website_id',
'taxClassField' => 'tax_class_id',
'originalPriceField' => 'orig_price',
'finalPriceField' => 'price',
'minPriceField' => 'min_price',
'maxPriceField' => 'max_price',
'tierPriceField' => 'tier_price',
]);

return $finalPriceTable;
}

/**
* Retrieve website current dates table name
*
Expand Down Expand Up @@ -248,11 +301,14 @@ protected function _prepareFinalPriceData($entityIds = null)
*/
protected function prepareFinalPriceDataForType($entityIds, $type)
{
$this->_prepareDefaultFinalPriceTable();
$finalPriceTable = $this->prepareFinalPriceTable();

$select = $this->getSelect($entityIds, $type);
$query = $select->insertFromSelect($this->_getDefaultFinalPriceTable(), [], false);
$query = $select->insertFromSelect($finalPriceTable->getTableName(), [], false);
$this->getConnection()->query($query);

$this->applyDiscountPrices($finalPriceTable);

return $this;
}

Expand Down Expand Up @@ -359,7 +415,7 @@ protected function getSelect($entityIds = null, $type = null)
'e.' . $metadata->getLinkField(),
'cs.store_id'
);
$currentDate = $connection->getDatePartSql('cwd.website_date');
$currentDate = 'cwd.website_date';

$maxUnsignedBigint = '~0';
$specialFromDate = $connection->getDatePartSql($specialFrom);
Expand Down Expand Up @@ -409,6 +465,7 @@ protected function getSelect($entityIds = null, $type = null)
'store_field' => new \Zend_Db_Expr('cs.store_id'),
]
);

return $select;
}

Expand Down Expand Up @@ -454,6 +511,19 @@ protected function _prepareCustomOptionPriceTable()
return $this;
}

/**
* Apply discount prices to final price index table.
*
* @param IndexTableStructure $finalPriceTable
* @return void
*/
private function applyDiscountPrices(IndexTableStructure $finalPriceTable) : void
{
foreach ($this->priceModifiers as $priceModifier) {
$priceModifier->modifyPrice($finalPriceTable);
}
}

/**
* Apply custom option minimal and maximal price to temporary final price index table
*
Expand All @@ -463,14 +533,15 @@ protected function _prepareCustomOptionPriceTable()
protected function _applyCustomOption()
{
$connection = $this->getConnection();
$finalPriceTable = $this->_getDefaultFinalPriceTable();
$coaTable = $this->_getCustomOptionAggregateTable();
$copTable = $this->_getCustomOptionPriceTable();

$this->_prepareCustomOptionAggregateTable();
$this->_prepareCustomOptionPriceTable();

$select = $connection->select()->from(
['i' => $this->_getDefaultFinalPriceTable()],
['i' => $finalPriceTable],
['entity_id', 'customer_group_id', 'website_id']
)->join(
['cw' => $this->getTable('store_website')],
Expand Down Expand Up @@ -537,7 +608,7 @@ protected function _applyCustomOption()
$connection->query($query);

$select = $connection->select()->from(
['i' => $this->_getDefaultFinalPriceTable()],
['i' => $finalPriceTable],
['entity_id', 'customer_group_id', 'website_id']
)->join(
['cw' => $this->getTable('store_website')],
Expand Down Expand Up @@ -606,7 +677,7 @@ protected function _applyCustomOption()
$query = $select->insertFromSelect($copTable);
$connection->query($query);

$table = ['i' => $this->_getDefaultFinalPriceTable()];
$table = ['i' => $finalPriceTable];
$select = $connection->select()->join(
['io' => $copTable],
'i.entity_id = io.entity_id AND i.customer_group_id = io.customer_group_id' .
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Model\ResourceModel\Product\Indexer\Price;

/**
* Wrapper for structure of price index table.
*/
class IndexTableStructure
{
/**
* @var string
*/
private $tableName;

/**
* @var string
*/
private $entityField;

/**
* @var string
*/
private $customerGroupField;

/**
* @var string
*/
private $websiteField;

/**
* @var string
*/
private $taxClassField;

/**
* @var string
*/
private $originalPriceField;

/**
* @var string
*/
private $finalPriceField;

/**
* @var string
*/
private $minPriceField;

/**
* @var string
*/
private $maxPriceField;

/**
* @var string
*/
private $tierPriceField;

/**
* @param string $tableName
* @param string $entityField
* @param string $customerGroupField
* @param string $websiteField
* @param string $taxClassField
* @param string $originalPriceField
* @param string $finalPriceField
* @param string $minPriceField
* @param string $maxPriceField
* @param string $tierPriceField
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
string $tableName,
string $entityField,
string $customerGroupField,
string $websiteField,
string $taxClassField,
string $originalPriceField,
string $finalPriceField,
string $minPriceField,
string $maxPriceField,
string $tierPriceField
) {
$this->tableName = $tableName;
$this->entityField = $entityField;
$this->customerGroupField = $customerGroupField;
$this->websiteField = $websiteField;
$this->taxClassField = $taxClassField;
$this->originalPriceField = $originalPriceField;
$this->finalPriceField = $finalPriceField;
$this->minPriceField = $minPriceField;
$this->maxPriceField = $maxPriceField;
$this->tierPriceField = $tierPriceField;
}

/**
* @return string
*/
public function getTableName(): string
{
return $this->tableName;
}

/**
* @return string
*/
public function getEntityField(): string
{
return $this->entityField;
}

/**
* @return string
*/
public function getCustomerGroupField(): string
{
return $this->customerGroupField;
}

/**
* @return string
*/
public function getWebsiteField(): string
{
return $this->websiteField;
}

/**
* @return string
*/
public function getTaxClassField(): string
{
return $this->taxClassField;
}

/**
* @return string
*/
public function getOriginalPriceField(): string
{
return $this->originalPriceField;
}

/**
* @return string
*/
public function getFinalPriceField(): string
{
return $this->finalPriceField;
}

/**
* @return string
*/
public function getMinPriceField(): string
{
return $this->minPriceField;
}

/**
* @return string
*/
public function getMaxPriceField(): string
{
return $this->maxPriceField;
}

/**
* @return string
*/
public function getTierPriceField(): string
{
return $this->tierPriceField;
}
}
Loading