tax in loops
This commit is contained in:
@@ -28,6 +28,6 @@ class Product extends BaseProduct
|
||||
public function getTaxedPrice(Country $country)
|
||||
{
|
||||
$taxCalculator = new Calculator();
|
||||
return $taxCalculator->load($this, $country)->getTaxedPrice();
|
||||
return $taxCalculator->load($this, $country)->getTaxedPrice($this->getRealLowestPrice());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,41 @@
|
||||
namespace Thelia\Model;
|
||||
|
||||
use Thelia\Model\Base\ProductSaleElements as BaseProductSaleElements;
|
||||
use Thelia\TaxEngine\Calculator;
|
||||
|
||||
class ProductSaleElements extends BaseProductSaleElements
|
||||
class ProductSaleElements extends BaseProductSaleElements
|
||||
{
|
||||
public function getPrice($virtualColumnName = 'price_PRICE')
|
||||
{
|
||||
try {
|
||||
$amount = $this->getVirtualColumn($virtualColumnName);
|
||||
} catch(PropelException $e) {
|
||||
throw new PropelException("Virtual column `$virtualColumnName` does not exist in ProductSaleElements::getPrice");
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function getPromoPrice($virtualColumnName = 'price_PROMO_PRICE')
|
||||
{
|
||||
try {
|
||||
$amount = $this->getVirtualColumn($virtualColumnName);
|
||||
} catch(PropelException $e) {
|
||||
throw new PropelException("Virtual column `$virtualColumnName` does not exist in ProductSaleElements::getPromoPrice");
|
||||
}
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function getTaxedPrice(Country $country)
|
||||
{
|
||||
$taxCalculator = new Calculator();
|
||||
return $taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPrice());
|
||||
}
|
||||
|
||||
public function getTaxedPromoPrice(Country $country)
|
||||
{
|
||||
$taxCalculator = new Calculator();
|
||||
return $taxCalculator->load($this->getProduct(), $country)->getTaxedPrice($this->getPromoPrice());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,6 @@ class TaxRuleQuery extends BaseTaxRuleQuery
|
||||
->withColumn('ROUND(SUM(' . TaxTableMap::RATE . '), 2)', self::ALIAS_FOR_TAX_RATE_SUM)
|
||||
;
|
||||
|
||||
//var_dump($search->toString());
|
||||
|
||||
return $search->find();
|
||||
}
|
||||
} // TaxRuleQuery
|
||||
|
||||
Reference in New Issue
Block a user