Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/2.2-develop' into 2.2-develop-…
Browse files Browse the repository at this point in the history
…PR-port-21079
  • Loading branch information
nmalevanec committed Mar 6, 2019
2 parents 905085d + 945fa8e commit 2d3a876
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds =
}

/**
* Check if custom options exist.
*
* @param IndexTableStructure $priceTable
* @return bool
* @throws \Exception
Expand Down Expand Up @@ -154,6 +156,8 @@ private function checkIfCustomOptionsExist(IndexTableStructure $priceTable): boo
}

/**
* Get connection.
*
* @return \Magento\Framework\DB\Adapter\AdapterInterface
*/
private function getConnection()
Expand Down Expand Up @@ -211,7 +215,7 @@ private function getSelectForOptionsWithMultipleValues(string $sourceTable): Sel
} else {
$select->joinLeft(
['otps' => $this->getTable('catalog_product_option_type_price')],
'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cwd.default_store_id',
'otps.option_type_id = otpd.option_type_id AND otps.store_id = cwd.default_store_id',
[]
);

Expand Down Expand Up @@ -373,6 +377,8 @@ private function getSelectAggregated(string $sourceTable): Select
}

/**
* Get select for update.
*
* @param string $sourceTable
* @return \Magento\Framework\DB\Select
*/
Expand Down Expand Up @@ -402,6 +408,8 @@ private function getSelectForUpdate(string $sourceTable): Select
}

/**
* Get table name.
*
* @param string $tableName
* @return string
*/
Expand All @@ -411,6 +419,8 @@ private function getTable(string $tableName): string
}

/**
* Is price scope global.
*
* @return bool
*/
private function isPriceGlobal(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* Default Product Type Price Indexer Resource model
*
* For correctly work need define product type id
*
* @api
Expand Down Expand Up @@ -208,6 +209,8 @@ public function reindexEntity($entityIds)
}

/**
* Reindex prices.
*
* @param null|int|array $entityIds
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice
*/
Expand Down Expand Up @@ -604,7 +607,7 @@ protected function _applyCustomOption()
[]
)->joinLeft(
['otps' => $this->getTable('catalog_product_option_type_price')],
'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cs.store_id',
'otps.option_type_id = otpd.option_type_id AND otps.store_id = cs.store_id',
[]
)->group(
['i.entity_id', 'i.customer_group_id', 'i.website_id', 'o.option_id']
Expand Down Expand Up @@ -802,6 +805,8 @@ public function getIdxTable($table = null)
}

/**
* Check if product exists.
*
* @return bool
*/
protected function hasEntity()
Expand All @@ -823,6 +828,8 @@ protected function hasEntity()
}

/**
* Get total tier price expression.
*
* @param \Zend_Db_Expr $priceExpression
* @return \Zend_Db_Expr
*/
Expand Down Expand Up @@ -862,6 +869,13 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression)
);
}

/**
* Get tier price expression for table.
*
* @param string $tableAlias
* @param \Zend_Db_Expr $priceExpression
* @return \Zend_Db_Expr
*/
private function getTierPriceExpressionForTable($tableAlias, \Zend_Db_Expr $priceExpression)
{
return $this->getConnection()->getCheckSql(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ public function __construct(CalculatorInterface $calculator)
}

/**
* Get raw value of "as low as" as a minimal among tier prices
* {@inheritdoc}
* Get raw value of "as low as" as a minimal among tier prices{@inheritdoc}
*
* @param SaleableInterface $saleableItem
* @return float|null
*/
public function getValue(SaleableInterface $saleableItem)
{
Expand All @@ -49,15 +51,17 @@ public function getValue(SaleableInterface $saleableItem)
}

/**
* Return calculated amount object that keeps "as low as" value
* {@inheritdoc}
* Return calculated amount object that keeps "as low as" value{@inheritdoc}
*
* @param SaleableInterface $saleableItem
* @return AmountInterface|null
*/
public function getAmount(SaleableInterface $saleableItem)
{
$value = $this->getValue($saleableItem);

return $value === null
? null
: $this->calculator->getAmount($value, $saleableItem);
: $this->calculator->getAmount($value, $saleableItem, 'tax');
}
}

0 comments on commit 2d3a876

Please sign in to comment.