diff --git a/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php b/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php index 02b0c260..5ec1598c 100644 --- a/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php +++ b/app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php @@ -505,13 +505,6 @@ protected function handlePrice(Mage_Catalog_Model_Product &$product, $sub_produc $directoryCurrency = Mage::getModel('directory/currency'); $currencies = $directoryCurrency->getConfigAllowCurrencies(); - if (Mage::helper('core')->isModuleEnabled('Mage_Weee') && - Mage::helper('weee')->getPriceDisplayType($product->getStore()) == 0) { - $weeeTaxAmount = Mage::helper('weee')->getAmountForDisplay($product); - } else { - $weeeTaxAmount = 0; - } - $baseCurrencyCode = $store->getBaseCurrencyCode(); $groups = array(); @@ -533,6 +526,8 @@ protected function handlePrice(Mage_Catalog_Model_Product &$product, $sub_produc $customData[$field][$currency_code] = array(); $price = (double) $taxHelper->getPrice($product, $product->getPrice(), $with_tax, null, null, null, $product->getStore(), null); + + $weeeTaxAmount = $this->getWeeeAmount($product, $with_tax); $price = $directoryHelper->currencyConvert($price, $baseCurrencyCode, $currency_code); $price += $weeeTaxAmount; @@ -1112,7 +1107,7 @@ private function getCompositeTypes() return $this->compositeTypes; } - + public function getAllProductIds($storeId) { $products = Mage::getModel('catalog/product')->getCollection(); @@ -1313,4 +1308,19 @@ private function clearFacetsQueryRules($index) } } } + + private function getWeeeAmount($product, $withTax) + { + // Get the weee tax amount if the weee module is enabled and for all types that include it + if ( + !Mage::helper('core')->isModuleEnabled('Mage_Weee') || + !Mage::helper('weee')->typeOfDisplay($product, [0, 1, 4]) + ) { + return 0; + } + + return $withTax + ? Mage::helper('weee')->getAmountForDisplayInclTaxes($product) + : Mage::helper('weee')->getAmountForDisplay($product); + } }