Post by tabletpcsuperstore » Sun Jun 20, 2010 5:56 am

hi,

i know there has been brief discussion on this topic but I am trying to set my opencart shop (great program by the way) ;D to display both the excluding VAT and including vat (tax) price so when a customer visits they see both the prices. its important that online shops in my field show this as business's claim their tax back in the UK so they focus always on just the excluding VAT price, consumers pay the vat however, if i show just the ex vat prices id be upsetting the consumers at the checkout stage, if i just display the including tax prices id be scaring away by business and international customers.

any patch/extentions/codes for this? its very common practice so im sure someone, somewhere has figured this one out.

thanks in advance.

james. O0


Posts

Joined
Sun Jun 20, 2010 5:43 am

Post by SteveSherry » Sun Jun 20, 2010 6:22 am

I have set this up in the past as an additional currency.
i.e. £ ex vat = 1.00000
£ inc vat = 1.1750000

That way the customers have the drop down box @ the top of the screen showing inc & ex vat

My Website ¦ Summer Madness Special Offer ¦


Active Member

Posts

Joined
Thu Apr 08, 2010 7:47 am
Location - Wirral, UK

Post by Moggin » Mon Jun 21, 2010 3:45 am

The drop down is a very good idea: a quick way to show a different shopfront to, say, the consumer and the B2B customer.

However, like James, I'd like to show the price as £xx (£xy+VAT) on the product page. This will suit our market better, if it's possible. Can anyone show us how to do this? Or do I need a commercial mod. Many thanks for any help.

Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by tabletpcsuperstore » Mon Jun 21, 2010 4:43 am

@ stevesherry

thanks for the advise and in theory this works well but in practice this has problems.... customer changes current to says inc vat (1.7500000) all good no problem.

customer adds to cart.

customer pays 1.7500000 + 17.5 as the cart has to add vat.

pays double vat


i am pretty sure someone somewhere has made a mod/extention for this its pretty basic requirement.


Posts

Joined
Sun Jun 20, 2010 5:43 am

Post by Moggin » Tue Jun 22, 2010 4:18 am

I’ve got this half–working:

Image

....lifted the code from another post and made an educated guess where to put it.

So in catalog/controller/product/product.php look for:

Code: Select all

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

AFTER, add

Code: Select all

//### CUSTOM ### price exc vat
$this->data['price_exvat'] = $this->currency->format($this->tax->calculate($product_info['price'], 0, 0));
 
..from CRAZY-Ivan’s post

Then go to

catalog/view/theme/YOUR_THEME/template/product/product.tpl

Find

Code: Select all

<td><b><?php echo $text_price; ?></b></td>
                <td><?php if (!$special) { ?>
                  <?php echo $price; ?>
AFTER, add

Code: Select all

&nbsp; (<?php echo $price_exvat; ?> + VAT)

However, note:
  • 1. That’s just for a plain vanilla price – no coding has been changed for sale/strikethrough prices.
    2. Only shows on the product page - category level prices are still one VAT inclusive price.
    3. The (xx + VAT) is hardcoded into the product.tpl. If you have zero VAT items you’d probably need to put ‘excl VAT’ or whatever.
    4. I haven’t got it to play nicely with my Options Price Update mod yet (a true gem from theqdomain.com)
    5. I’m not a PHP coder. Use at your own risk: and tell me how to improve/correct it, if you are a coder. Please, backup first. If it doesn't work for you I probably won't know why...
..but it's a start. Thanks and credit to CRAZY-Ivan.

Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by speedingorange » Wed Jul 21, 2010 6:30 pm

Can anyone tell me what i would change on this to make it work in reverse. So it displays the Price inc VAT in the brackets.

I tried the obvious of switching around the price and price_exvat but it did not work just displayed 0.00 for both. lol

Active Member

Posts

Joined
Tue Feb 23, 2010 7:33 pm

Post by Miguelito » Fri Jul 30, 2010 2:58 pm

I've now done this - I mean price + price excluding vat.

Had to change product, category controller files and their view-files (tpl) + latest module. Now it seems to do the job... though to be perfect also need to edit bestseller module if need to show price exluding vat price in there.

Not a pretty thing but tackles the requirements of B2B customers (price excl. VAT) :)

The Finnish OpenCart Forum
"Real programmers don't document. If it was hard to write, it should be hard to understand."


Active Member

Posts

Joined
Sun Jan 10, 2010 10:11 pm

Post by Moggin » Sun Aug 01, 2010 9:45 pm

Miguelito wrote:I've now done this - I mean price + price excluding vat.

Had to change product, category controller files and their view-files (tpl) + latest module. Now it seems to do the job... though to be perfect also need to edit bestseller module if need to show price exluding vat price in there.

Not a pretty thing but tackles the requirements of B2B customers (price excl. VAT) :)
Sounds good, Miguelito. Any chance of sharing an example of the code you used in the category controller files, in case anyone wants to do the same thing?

speedingorange - I went back to showing prices without VAT - via the admin panel (System > Settings > Display items with tax: no). I tried, but had no luck showing the VAT-inclusive price in the brackets: maybe someone else will help.

Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by silanli_53 » Tue Aug 10, 2010 9:54 pm

Moggin wrote:I’ve got this half–working:

Image

....lifted the code from another post and made an educated guess where to put it.

So in catalog/controller/product/product.php look for:

Code: Select all

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

AFTER, add

Code: Select all

//### CUSTOM ### price exc vat
$this->data['price_exvat'] = $this->currency->format($this->tax->calculate($product_info['price'], 0, 0));
 
..from CRAZY-Ivan’s post

Then go to

catalog/view/theme/YOUR_THEME/template/product/product.tpl

Find

Code: Select all

<td><b><?php echo $text_price; ?></b></td>
                <td><?php if (!$special) { ?>
                  <?php echo $price; ?>
AFTER, add

Code: Select all

&nbsp; (<?php echo $price_exvat; ?> + VAT)

However, note:
  • 1. That’s just for a plain vanilla price – no coding has been changed for sale/strikethrough prices.
    2. Only shows on the product page - category level prices are still one VAT inclusive price.
    3. The (xx + VAT) is hardcoded into the product.tpl. If you have zero VAT items you’d probably need to put ‘excl VAT’ or whatever.
    4. I haven’t got it to play nicely with my Options Price Update mod yet (a true gem from theqdomain.com)
    5. I’m not a PHP coder. Use at your own risk: and tell me how to improve/correct it, if you are a coder. Please, backup first. If it doesn't work for you I probably won't know why...
..but it's a start. Thanks and credit to CRAZY-Ivan.

Error..

Code: Select all

(Notice: Undefined variable: price_exvat in /home/******/public_html/catalog/view/theme/default/template/product/product.tpl on line 22 + VAT) 
help
thanks
best regarts

Cafe Koltuk Çeşitleri

Laptop Sırt Çantası


User avatar
New member

Posts

Joined
Fri Feb 19, 2010 8:54 am


Post by Miguelito » Wed Aug 11, 2010 6:20 pm

You need to put that code before the else statement.

The Finnish OpenCart Forum
"Real programmers don't document. If it was hard to write, it should be hard to understand."


Active Member

Posts

Joined
Sun Jan 10, 2010 10:11 pm

Post by silanli_53 » Mon Aug 16, 2010 8:30 am

Thank you. bugs me

How do we integrate these codes to 148b homepage.

Code: Select all

			if ($discount) {
				$price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
			} else {
				$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
			
				$special = $this->model_catalog_product->getProductSpecial($result['product_id']);
			
				if ($special) {
					$special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
				}						
			}

Cafe Koltuk Çeşitleri

Laptop Sırt Çantası


User avatar
New member

Posts

Joined
Fri Feb 19, 2010 8:54 am


Post by deeve » Tue Nov 16, 2010 10:08 pm

This is a very confusing thread!
Would it be possible for someone to re-cap precisely what code needs to be put where?
One person says place before the 'else' statement, the other says after ..but precisely what & where?

Thanks.

Active Member

Posts

Joined
Tue Oct 20, 2009 4:31 pm

Post by Moggin » Thu Nov 18, 2010 4:32 am

Hi deeve - I'll try to clarify. This was a few months ago, and I changed my template again not long afterwards.

Firstly, I was working on version 1.4.8. It may not work on another version of Opencart.

Secondly, I made only 2 changes: one to catalog/controller/product/product.php - which requires the block of code indicated to be added.

The other is a change to the template, in the file catalog/view/theme/YOUR_THEME/template/product/product.tpl.
The code that needs to be changed is indicated in the posting.

Miguelito knows more about coding than I do - so if he says the code should go before the 'else' statement, I would try his way first! :)

Please note also that it was a first try, by a PHP noob! You might prefer to ask one of the experts on here for some paid help, to get the effect you need.

Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by JM6891 » Wed Jan 05, 2011 7:48 pm

Does anyone know how to display this on the Category page. I can't seem to find where to declare the variable in the controller (I'm a PHP newbie).

Thanks in advance

New member

Posts

Joined
Fri Dec 10, 2010 7:22 pm

Post by piper » Wed Mar 02, 2011 10:56 pm

As mentioned above, if someone could please clarify the definitive solution to achieve this,
starting with the product.php file. What is the code and where does it have to be added. The same
goes for the product.tpl and any other files. I wonder if Miguelito could lay it out step by step.
Much appreciated.

Final comment. I do find it very strange the absence of such a basic requirement as this. Do
you think the author is aware of this ?

Newbie

Posts

Joined
Wed Mar 02, 2011 10:46 pm

Post by Moggin » Wed Mar 02, 2011 11:33 pm


Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by SXGuy » Thu Mar 03, 2011 1:39 am

As Moggin stated, i posted a solution already, it applies to the category pages, but you can use the same method for all pages which display prices, as well as modules

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am
Who is online

Users browsing this forum: No registered users and 64 guests