From 1971240fcace36a1e100cc40299978fb6d0e5b62 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Tue, 10 Sep 2013 12:22:58 +0200 Subject: [PATCH] currency in product loop --- core/lib/Thelia/Core/Template/Loop/Product.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/lib/Thelia/Core/Template/Loop/Product.php b/core/lib/Thelia/Core/Template/Loop/Product.php index b7a7c13fe..22860adbb 100755 --- a/core/lib/Thelia/Core/Template/Loop/Product.php +++ b/core/lib/Thelia/Core/Template/Loop/Product.php @@ -307,7 +307,9 @@ class Product extends BaseI18nLoop $minPriceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', $joiningTable, ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'global_price_data'); $minPriceJoin->setJoinType(Criteria::LEFT_JOIN); - $search->addJoinObject($minPriceJoin); + $currency = $this->request->getSession()->getCurrency(); + $search->addJoinObject($minPriceJoin, 'min_price_join') + ->addJoinCondition('min_price_join', '`global_price_data`.`currency_id` = ?', $currency, null, \PDO::PARAM_INT); } /* @@ -339,6 +341,9 @@ class Product extends BaseI18nLoop $search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_highest_price'); $search->withColumn('ROUND(MIN(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_lowest_price'); + $search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_highest_price_default_currency'); + $search->withColumn('ROUND(MIN(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_lowest_price_default_currency'); + $current = $this->getCurrent(); @@ -502,6 +507,8 @@ class Product extends BaseI18nLoop } } + var_dump($search->toString()); + /* perform search */ $products = $this->search($search, $pagination);