syntax
This commit is contained in:
@@ -83,7 +83,7 @@ class Thelia extends Kernel
|
|||||||
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
$con = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME);
|
||||||
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
$con->setAttribute(ConnectionWrapper::PROPEL_ATTR_CACHE_PREPARES, true);
|
||||||
if ($this->isDebug()) {
|
if ($this->isDebug()) {
|
||||||
//$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
$serviceContainer->setLogger('defaultLogger', \Thelia\Log\Tlog::getInstance());
|
||||||
$con->useDebug(true);
|
$con->useDebug(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,29 +67,29 @@ class Calculator
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTaxAmount($amount)
|
public function getTaxAmount($untaxedPrice)
|
||||||
{
|
{
|
||||||
if(null === $this->taxRulesGroupedCollection) {
|
if(null === $this->taxRulesGroupedCollection) {
|
||||||
throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxAmount', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION);
|
throw new TaxEngineException('Tax rules collection is empty in Calculator::getTaxAmount', TaxEngineException::UNDEFINED_TAX_RULES_COLLECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) {
|
if(false === filter_var($untaxedPrice, FILTER_VALIDATE_FLOAT)) {
|
||||||
throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT);
|
throw new TaxEngineException('BAD AMOUNT FORMAT', TaxEngineException::BAD_AMOUNT_FORMAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
$totalTaxAmount = 0;
|
$totalTaxAmount = 0;
|
||||||
foreach($this->taxRulesGroupedCollection as $taxRule) {
|
foreach($this->taxRulesGroupedCollection as $taxRule) {
|
||||||
$rateSum = $taxRule->getTaxRuleRateSum();
|
$rateSum = $taxRule->getTaxRuleRateSum();
|
||||||
$taxAmount = $amount * $rateSum * 0.01;
|
$taxAmount = $untaxedPrice * $rateSum * 0.01;
|
||||||
$totalTaxAmount += $taxAmount;
|
$totalTaxAmount += $taxAmount;
|
||||||
$amount += $taxAmount;
|
$untaxedPrice += $taxAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $totalTaxAmount;
|
return $totalTaxAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTaxedPrice($amount)
|
public function getTaxedPrice($untaxedPrice)
|
||||||
{
|
{
|
||||||
return $amount + $this->getTaxAmount($amount);
|
return $untaxedPrice + $this->getTaxAmount($untaxedPrice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
{debugbar_renderHead}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h1>Category page</h1>
|
<h1>Category page</h1>
|
||||||
|
|
||||||
<div style="border: solid 8px; margin: 0px; padding: 0px; width: 45%; float: left">
|
<div style="border: solid 8px; margin: 0px; padding: 0px; width: 45%; float: left">
|
||||||
@@ -148,8 +142,4 @@
|
|||||||
{/loop}
|
{/loop}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{debugbar_render}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user