/*
* $type ... price, shipping, payment
* ROUNDING - TAX EXCLUSIVE - ROUND UP
* ROUNDING - TAX INCLUSIVE - ROUND DOWN
*/
public function roundPrice($price, $type = 'price')
{
$app = Factory::getApplication();
//$paramsC = PhocacartUtils::getComponentParameters();
$paramsC = PhocacartUtils::getComponentParameters();
$rounding_calculation = $paramsC->get('rounding_calculation', 1);
/*$tax_calculation = $paramsC->get( 'tax_calculation', 0 );
$tax_calculation_shipping = $paramsC->get( 'tax_calculation_shipping', 0 );
$tax_calculation_payment = $paramsC->get( 'tax_calculation_payment', 0 );
switch($type) {
case 'shipping':
// if tax_calculation_shipping == inclusive then rown down else round up
$rounding = $tax_calculation_shipping == 2 ? 2 : 1;
break;
case 'payment':
$rounding = $tax_calculation_payment == 2 ? 2 : 1;
break;
case 'price':
default:
$rounding = $tax_calculation == 2 ? 2 : 1;
break;
}*/
$rounding = $rounding_calculation;
// 1 ... up, 2 ... down
$priceR = round($price, $this->price_decimals, $rounding);
return $priceR;
}