tax engine

This commit is contained in:
Etienne Roudeix
2013-09-09 14:24:50 +02:00
parent a178835f6b
commit 0ddf88e46e
9 changed files with 117 additions and 21 deletions

View File

@@ -87,7 +87,7 @@ class Address extends BaseLoop
$customer = $this->getCustomer();
if ($customer === 'current') {
$currentCustomer = $this->request->getSession()->getCustomerUser();
$currentCustomer = $this->securityContext->getCustomerUser();
if ($currentCustomer === null) {
return new LoopResult();
} else {

View File

@@ -80,7 +80,7 @@ class Customer extends BaseLoop
$current = $this->getCurrent();
if ($current === true) {
$currentCustomer = $this->request->getSession()->getCustomerUser();
$currentCustomer = $this->securityContext->getCustomerUser();
if ($currentCustomer === null) {
return new LoopResult();
} else {

View File

@@ -34,6 +34,7 @@ use Thelia\Core\Template\Loop\Argument\Argument;
use Thelia\Log\Tlog;
use Thelia\Model\CategoryQuery;
use Thelia\Model\CountryQuery;
use Thelia\Model\Map\FeatureProductTableMap;
use Thelia\Model\Map\ProductPriceTableMap;
use Thelia\Model\Map\ProductSaleElementsTableMap;
@@ -333,10 +334,10 @@ class Product extends BaseI18nLoop
foreach($isProductPriceLeftJoinList as $pSE => $isProductPriceLeftJoin) {
$booleanMatchedPriceList[] = 'CASE WHEN `' . $pSE . '`.PROMO=1 THEN `' . $isProductPriceLeftJoin . '`.PROMO_PRICE ELSE `' . $isProductPriceLeftJoin . '`.PRICE END';
}
$search->withColumn('MAX(' . implode(' OR ', $booleanMatchedPromoList) . ')', 'main_product_is_promo');
$search->withColumn('MAX(' . implode(' OR ', $booleanMatchedNewnessList) . ')', 'main_product_is_new');
$search->withColumn('MAX(' . implode(' OR ', $booleanMatchedPriceList) . ')', 'real_highest_price');
$search->withColumn('MIN(' . implode(' OR ', $booleanMatchedPriceList) . ')', 'real_lowest_price');
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPromoList) . '), 2)', 'main_product_is_promo');
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedNewnessList) . '), 2)', 'main_product_is_new');
$search->withColumn('ROUND(MAX(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_highest_price');
$search->withColumn('ROUND(MIN(' . implode(' OR ', $booleanMatchedPriceList) . '), 2)', 'real_lowest_price');
$current = $this->getCurrent();
@@ -518,7 +519,10 @@ class Product extends BaseI18nLoop
->set("DESCRIPTION", $product->getVirtualColumn('i18n_DESCRIPTION'))
->set("POSTSCRIPTUM", $product->getVirtualColumn('i18n_POSTSCRIPTUM'))
->set("URL", $product->getUrl($locale))
->set("BEST_PRICE", $product->getVirtualColumn('real_lowest_price'))
->set("BEST_PRICE", $product->getRealLowestPrice())
->set("BEST_TAXED_PRICE", $product->getTaxedPrice(
CountryQuery::create()->findOneById(64) // @TODO : make it magic
))
->set("IS_PROMO", $product->getVirtualColumn('main_product_is_promo'))
->set("IS_NEW", $product->getVirtualColumn('main_product_is_new'))
->set("POSITION", $product->getPosition())