Skip to content

Commit

Permalink
Added tier price logic for special price
Browse files Browse the repository at this point in the history
  • Loading branch information
gelanivishal committed Oct 22, 2018
1 parent 0f57a30 commit e40b9c7
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,22 @@ protected function validatePrice(array $priceRow)
*/
protected function modifyPriceData($object, $data)
{
/** @var \Magento\Catalog\Model\Product $object */
$data = parent::modifyPriceData($object, $data);
$price = $object->getPrice();

$specialPrice = $object->getSpecialPrice();
$specialPriceFromDate = $object->getSpecialFromDate();
$specialPriceToDate = $object->getSpecialToDate();
$today = time();

if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())){
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
$today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)) {
$price = $specialPrice;
}
}

foreach ($data as $key => $tierPrice) {
$percentageValue = $this->getPercentage($tierPrice);
if ($percentageValue) {
Expand Down

0 comments on commit e40b9c7

Please sign in to comment.