I am hoping someone might be able to give me some direction on how to make my checkout process apply a 3% fee only if the consumer is paying by credit card. There is a radio button for 'Invoice' or 'Credit Card' and if 'Credit Card' is selected I would like the cart to update with Javascript to show the new total.
I already have some other custom functions for different fees (eg insurance) but they are all applied irrespective of what payment method.
I am not sure how to get the SubTotal and Total functions available in the javascript function. I have used the
function updateForAjax(array &$js) {
...
$insurance = $subTotal * 0.08;
$insurance = DBField::create('Currency', $this->Insurance())->Nice();
$js[] = array('id' => $this->InsuranceID(), 'parameter' => 'innerHTML', 'value' => $insurance);
}
for the other custom functions, but not sure how to test what option is selected to determine if a fee should be applied or not. Or even if this is the way to do it.
I am still pretty new to Silverstripe, so still trying to get my head around it.
Thanks.
Vic