Post by speedingorange » Tue Nov 22, 2011 12:38 am

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.

Active Member

Posts

Joined
Tue Feb 23, 2010 7:33 pm

Post by dstart » Tue Nov 22, 2011 7:23 pm

I'd also like to know how to do this :)

Newbie

Posts

Joined
Wed Jul 14, 2010 10:44 pm

Post by hebousek » Mon Sep 03, 2012 11:27 pm

How to show ex tax price in modules bestseller and special?

Newbie

Posts

Joined
Mon Sep 03, 2012 3:37 am

Post by ian007 » Sat Oct 20, 2012 9:29 pm

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.

Newbie

Posts

Joined
Thu Oct 18, 2012 1:59 am

Post by ian007 » Thu Oct 25, 2012 6:21 am

Anyone? I'd be very grateful if anyone could help, cheers.

Newbie

Posts

Joined
Thu Oct 18, 2012 1:59 am

Post by mickdpi » Thu Feb 07, 2013 1:07 am

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

Newbie

Posts

Joined
Thu May 24, 2012 5:52 pm
Who is online

Users browsing this forum: No registered users and 19 guests