Files
sterivein/core/lib/Thelia/Model/TaxRule.php
Etienne Roudeix 7bd511c420 order admin
2013-09-24 17:04:32 +02:00

35 lines
1.1 KiB
PHP
Executable File

<?php
namespace Thelia\Model;
use Thelia\Model\Base\TaxRule as BaseTaxRule;
use Thelia\TaxEngine\Calculator;
use Thelia\TaxEngine\OrderProductTaxCollection;
class TaxRule extends BaseTaxRule
{
/**
* @param Country $country
* @param $untaxedAmount
* @param $untaxedPromoAmount
* @param null $askedLocale
*
* @return OrderProductTaxCollection
*/
public function getTaxDetail(Country $country, $untaxedAmount, $untaxedPromoAmount, $askedLocale = null)
{
$taxCalculator = new Calculator();
$taxCollection = new OrderProductTaxCollection();
$taxCalculator->loadTaxRule($this, $country)->getTaxedPrice($untaxedAmount, $taxCollection, $askedLocale);
$promoTaxCollection = new OrderProductTaxCollection();
$taxCalculator->loadTaxRule($this, $country)->getTaxedPrice($untaxedPromoAmount, $promoTaxCollection, $askedLocale);
foreach($taxCollection as $index => $tax) {
$tax->setPromoAmount($promoTaxCollection->getKey($index)->getAmount());
}
return $taxCollection;
}
}