php - How can I show total price at checkout page [OpenCart] -


i make calculations @ checkout page. if example total price of products 80€, want show message says: "you can add more products on cart worth of 20€, can discount activates when total cost 100€".

to have total price variable , this:

$tp = totalprice;  if ( $tp < 100 ) {     $tp_less = 100 - $tp; }  echo 'you can add more products on cart worth of ' . $tp_less . '€.'; 

the problem here don't know how total price variable.

<?php echo $cart_total = $this->cart->gettotal(); ?> 

i placed above @ file /checkout.tpl error it's not working. actually, whenever use code has 'this' inside error:

"notice: undefined property: template\basic::$cart"

$this->cart->gettotal() - calculates cart total including taxes

$this->cart->getsubtotal() - calculates products subtotal, think need use this.

$this->cart->getsubtotal() - call function in controller , store value in variable , pass tpl file.

regarding error:

by default cart library included in opencart, make sure cart library included, check registry file

hope helps.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -