Show subtotal in header

ThemeBurn SupportForumsOpenCart ThemesShoppica 2 OpenCart ThemeShow subtotal in header

This topic has been marked as not a support question.

Hi all,

I have enabled “Display Prices With Tax” in the admin. And so my header displays the total+tax of the shopping cart in the header. Thats great but I would like to show the total(without taxes) also in the header. That’s actually the Sub-total.

I tried but can’t get it to work. In header.tpl:

<?php echo strip_tags($cart_contents['total_sum']); ?>

So I would need something like: ['subtotal_sum'] :)

Also I would like to place the text; “Incl. TAX” and “Excl. TAX” behind the 2 prices in the header then.

Hope you guys can help.

 wzzly
October 19, 2012 at 12:54 pm #14498

Hi,

Unfortunately there is no subtotal variable that you can use directly and you will need to hack some core files.

This is not a trivial modification and could not be covered by the free support offered by this forum. You may post your question in the official opencart forums, or seek a freelancer to do the job for you.

Best Regards,
ThemeBurn team

October 30, 2012 at 1:24 pm #14801

But is it possible to make a calculation like: Total – (all)taxes

I think this might be easier because the Subtotal should include shipping

 wzzly
November 2, 2012 at 9:45 pm #14908

still no reply? :)

 wzzly
January 24, 2013 at 2:07 pm #17529
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!
January 29, 2013 at 3:15 pm #17786

As a first step I placed:
$json['tax'] = $this->currency->format($taxes);
in the TbController.php

And:
<?php echo strip_tags($cart_contents['tax']);?>
in the header.tpl

I thought by doing this (as a first step) it would display the carts taxes in the header, but that doesn’t work. Any idea why?

After that I thought I could do something like:
$json['total_sum_ex_tax'] = $this->currency->format($total-$taxes);

Am I on the right track? :P

Thanks

 wzzly
January 31, 2013 at 12:14 pm #17898
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!
February 4, 2013 at 6:12 pm #18138

Just add this:
$json['total_exc_tax'] = $this->currency->format($this->cart->getTotal());

It works for me,

Also, you have to edit the common.js.php file and add the same variable for the add and remove to cart functions.

  • This reply was modified 3897 days ago by  JMField.
August 27, 2013 at 11:30 pm #27036

@JMField

Thanks for sharing the modification!

Best,
ThemeBurn team

September 2, 2013 at 1:19 pm #27188
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.