How to change the amount price in checkout box in cart page when clicked on submit button using extension. When clicked on apply button the amount price in checkout box changes in cart page
1. First create a button in .tpl file where we want add submit button, where we want add function to it, give class and id name
2.In Extension view file define the .tpl file. In below event block add the click event
For example
events: {
'submit form': 'SubmitForm',
}
and define the function SubmitForm, In the this copy the path of that amount price and assign new value to it
If we want to add discount amount to discounttotal, then assign custom discount amount to the corresponding path
then assign discounttotal_formatted with this code “Utils.formatCurrency(discountAmount)”
same with total amount after all the costs
then add code “this.render();”
The complete code is given below
For example
this.model.attributes.summary.discounttotal = discountAmount; this.model.attributes.summary.discounttotal_formatted=Utils.formatCurrency(discountAmount);
var total = this.model.attributes.summary.discountedsubtotal + this.model.attributes.summary.shippingcost - this.model.attributes.summary.discounttotal this.model.attributes.summary.total_formatted = Utils.formatCurrency(total);
this.render();