Adding Ex Tax to Modules e.g. Featured
Posted: 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
to
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');"
and
Between "special" and "config_review_status"
and
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.
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>
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>
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;
}
and
Code: Select all
'tax' => $tax,
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.