Page 1 of 1

Adding Ex Tax to Modules e.g. Featured

Posted: Tue Nov 22, 2011 12:38 am
by speedingorange
I am trying to add Ex Tax prices to a couple of modules on one of my sites and seem to be struggling.

This really is pushing my knowledge..

Here is where I have got to so far... I am sure I can't be far off getting it right, but would appreciate some guidance to get it working.

I have changed in

featured.tpl

Code: Select all

<div class="price">
				<?php if (!$product['special']) { ?>
					<span class="item-price"><?php echo $product['price']; ?></span>
				<?php } else { ?>
					<span class="item-old-price"><?php echo $product['price']; ?></span> <span class="item-new-price"><?php echo $product['special']; ?></span>
				<?php } ?>
				</div>
to

Code: Select all

<div class="price">
					<?php if (!$product['special']) { ?>
						<span class="item-price"><?php echo $product['price']; ?></span>
					<?php } else { ?>
						<span class="item-old-price"><?php echo $product['price']; ?></span> <span class="item-new-price"><?php echo $product['special']; ?></span>
					<?php } ?>
					<?php if ($product['tax']) { ?>
						<br />
						<span class="item-extax-price"><?php echo $text_tax; ?> <?php echo $product['tax']; ?></span>
					<?php } ?>
					</div>
and have added the following to catalogue/controller/modules/featured.php

Added near the top after "$this->data['button_cart'] = $this->language->get('button_cart');"

Code: Select all

$this->data['text_tax'] = $this->language->get('text_tax');


and

Code: Select all

if ($this->config->get('config_tax')) {
					$tax = $this->currency->format((float)$result['special'] ? $result['special'] : $result['price']);
				} else {
					$tax = false;
				}
Between "special" and "config_review_status"

and

Code: Select all

'tax'         => $tax,
at line 52, between 'speical' & 'rating'

All i get though is an error "41Notice: Undefined variable: result in "\catalog\controller\module\featured.php on line 41"

The ex tax does display, however it is incorrect as "ex_tax £0.00"

So what am i doing right, I have looked at other modules and the category.php for an example but am not getting anywhere.

Re: Adding Ex Tax to Modules e.g. Featured

Posted: Tue Nov 22, 2011 7:23 pm
by dstart
I'd also like to know how to do this :)

Re: Adding Ex Tax to Modules e.g. Featured

Posted: Mon Sep 03, 2012 11:27 pm
by hebousek
How to show ex tax price in modules bestseller and special?

Re: Adding Ex Tax to Modules e.g. Featured

Posted: Sat Oct 20, 2012 9:29 pm
by ian007
I too want to add ex tax prices to my modules.

I've done this in bestsetters adding the code as described by speedingorange (defining $tax from config_tax in the controller and the outputting in the tpl). The problem is with my featured module.

I have tried the same approach, no go. I suspect it is because of the different way that the controller file, featured.php, does the DB query for config_tax that is the problem. I am however, not gifted enough to work out a solution (despite hours trying).

Can anyone please point me in the right direction. Thanks.

Re: Adding Ex Tax to Modules e.g. Featured

Posted: Thu Oct 25, 2012 6:21 am
by ian007
Anyone? I'd be very grateful if anyone could help, cheers.

Re: Adding Ex Tax to Modules e.g. Featured

Posted: Thu Feb 07, 2013 1:07 am
by mickdpi
I had a similar problem with the featured module, but i just wanted to show the price as EX VAT only.

in controller > module > featured.php (around line 35)

I changed:

Code: Select all

	$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
to

Code: Select all

$price = $this->currency->format($product_info['price']);
seemed to work fine for me as the prices are entered into the system as ex vat anyway.

this is on version 1.5.4.1