|
|
|
|
|
|
|
|
// base price |
|
|
// base price |
|
|
$priceArray[] = [ |
|
|
$priceArray[] = [ |
|
|
'from_quantity' => 0, |
|
|
'from_quantity' => 0, |
|
|
|
|
|
'price' => $this->getPrice(), |
|
|
'price_with_tax' => $this->getPriceWithTax(), |
|
|
'price_with_tax' => $this->getPriceWithTax(), |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
usort($priceArray, function ($a, $b) { |
|
|
usort($priceArray, function ($a, $b) { |
|
|
if ($a['price_with_tax'] < $b['price_with_tax']) { |
|
|
|
|
|
|
|
|
if ($a['price'] < $b['price']) { |
|
|
return 1; |
|
|
return 1; |
|
|
} elseif ($a['price_with_tax'] > $b['price_with_tax']) { |
|
|
|
|
|
|
|
|
} elseif ($a['price'] > $b['price']) { |
|
|
return -1; |
|
|
return -1; |
|
|
} else { |
|
|
} else { |
|
|
return 0; |
|
|
return 0; |