Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Helper/Entity/Product/PriceManager/ProductWithChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ protected function getMinMaxPrices(Product $product, $withTax, $subProducts, $cu
} else {
$minPrice = $specialPrice[0];
}
$price = $minPrice ?? $this->getTaxPrice($product, $subProduct->getFinalPrice(), $withTax);
$basePrice = $this->getTaxPrice($product, $subProduct->getPrice(), $withTax);
$price = $minPrice ?? $this->getTaxPrice($product, $subProduct->getFinalPrice(), $withTax) + $this->weeeTax->getWeeeAmount($subProduct);
$basePrice = $this->getTaxPrice($product, $subProduct->getPrice(), $withTax) + $this->weeeTax->getWeeeAmount($subProduct);
$min = min($min, $price);
$original = min($original, $basePrice);
$max = max($max, $price);
Expand Down
11 changes: 9 additions & 2 deletions Helper/Entity/Product/PriceManager/ProductWithoutChildren.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Magento\Customer\Api\GroupExcludedWebsiteRepositoryInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Tax\Helper\Data as TaxHelper;
use Magento\Weee\Model\Tax as WeeeTax;
use Magento\Tax\Model\Config as TaxConfig;
use Magento\Catalog\Api\ScopedProductTierPriceManagementInterface;

Expand All @@ -40,6 +41,10 @@ abstract class ProductWithoutChildren
* @var TaxHelper
*/
protected $taxHelper;
/**
* @var WeeeTax
*/
protected $weeeTax;
/**
* @var Rule
*/
Expand Down Expand Up @@ -89,6 +94,7 @@ public function __construct(
PriceCurrencyInterface $priceCurrency,
CatalogHelper $catalogHelper,
TaxHelper $taxHelper,
WeeeTax $weeeTax,
Rule $rule,
ProductFactory $productloader,
ScopedProductTierPriceManagementInterface $productTierPrice,
Expand All @@ -100,6 +106,7 @@ public function __construct(
$this->priceCurrency = $priceCurrency;
$this->catalogHelper = $catalogHelper;
$this->taxHelper = $taxHelper;
$this->weeeTax = $weeeTax;
$this->rule = $rule;
$this->productloader = $productloader;
$this->productTierPrice = $productTierPrice;
Expand Down Expand Up @@ -143,7 +150,7 @@ public function addPriceData($customData, Product $product, $subProducts): array
$product->setPriceCalculation(true);
foreach ($currencies as $currencyCode) {
$this->customData[$field][$currencyCode] = [];
$price = $product->getPrice();
$price = $product->getPrice() + $this->weeeTax->getWeeeAmount($product);
if ($currencyCode !== $this->baseCurrencyCode) {
$price = $this->convertPrice($price, $currencyCode);
}
Expand Down Expand Up @@ -254,7 +261,7 @@ protected function getSpecialPrice(Product $product, $currencyCode, $withTax, $s
$specialPrices[$groupId] = [];
$specialPrices[$groupId][] = $this->getRulePrice($groupId, $product, $subProducts);
// The price with applied catalog rules
$specialPrices[$groupId][] = $product->getFinalPrice(); // The product's special price
$specialPrices[$groupId][] = $product->getFinalPrice() + $this->weeeTax->getWeeeAmount($product); // The product's special price
$specialPrices[$groupId] = array_filter($specialPrices[$groupId], function ($price) {
return $price > 0;
});
Expand Down