VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Arjun Singh on July 25, 2018, 14:44:34 PM

Title: Order Calc Rules
Post by: Arjun Singh on July 25, 2018, 14:44:34 PM
Hello,

While developing extension for VirtueMart I notice that for some Type of Arithmetic Operation such as 'tax per product' or 'price modifier for profit markup' calc amount is not stored in order_calc_rules table can anyone explain why it is ? so that I can understand the flow properly.
Title: Re: Order Calc Rules
Post by: Milbo on July 25, 2018, 19:57:14 PM
It is just written for the vattax. see order model private function _createOrderCalcRules($order_id, $_cart) and there

if ($calculation_kind == 'VatTax') {
$orderCalcRules->calc_amount =  $_cart->cartPrices[$key]['taxAmount'];
$orderCalcRules->calc_result =  $_cart->cartData['VatTax'][$rule[7]]['result'];
}


I check now with

if ($calculation_kind == 'VatTax') {
$orderCalcRules->calc_amount =  $_cart->cartPrices[$key]['taxAmount'];
$orderCalcRules->calc_result =  $_cart->cartData['VatTax'][$rule[7]]['result'];
} else {
vmdebug('_createOrderCalcRules',$key,$rule,$_cart->cartPrices[$key]['taxAmount'],$_cart->cartData['VatTax'][$rule[7]]['result']);
}


How to implement the other, you may help ;-)