tax engine

This commit is contained in:
Etienne Roudeix
2013-09-11 16:21:51 +02:00
parent 551c132b76
commit e8a4e56324
17 changed files with 561 additions and 107 deletions

View File

@@ -20,7 +20,6 @@ use Thelia\Model\Map\TaxTableMap;
class TaxRuleQuery extends BaseTaxRuleQuery
{
const ALIAS_FOR_TAX_RULE_COUNTRY_POSITION = 'taxRuleCountryPosition';
const ALIAS_FOR_TAX_RATE_SUM = 'taxRateSum';
public function getTaxCalculatorGroupedCollection(Product $product, Country $country)
{
@@ -29,12 +28,10 @@ class TaxRuleQuery extends BaseTaxRuleQuery
TaxRuleCountryQuery::create()
->filterByCountry($country, Criteria::EQUAL)
->filterByTaxRuleId($product->getTaxRuleId())
->groupByPosition()
->orderByPosition()
->find()
)
->withColumn(TaxRuleCountryTableMap::POSITION, self::ALIAS_FOR_TAX_RULE_COUNTRY_POSITION)
->withColumn('ROUND(SUM(' . TaxTableMap::RATE . '), 2)', self::ALIAS_FOR_TAX_RATE_SUM)
;
return $search->find();