Post by philbydevil » Sun Jan 23, 2011 11:11 am

Ok, I'm trying to change some text on the checkout confirm page only. If I wanted to change it everywhere then it would be easy enough to do it in the language file, but it needs to be specific to the checkout confirm page only.

I though it would be as easy as editing the confirm.tpl file and either adding a new 'text' element, and then adding that in the controller file and the language file, etc. Or, just hardcoding it in the confirm.tpl file.

But I can' seem to find what I'm looking for. It's the shipping method that shows near the sub-total and total (see pic). Any suggestions as to where I would find this?

EDIT: if you keep reading you'll see that there is a better option than just changing this text (which I wasn't able to do anyway).

EDIT: there are a couple of small bugs (see here: http://forum.opencart.com/viewtopic.php ... 24#p131094), but the vQmod xml file is functional and useable

Attachments

Checkout-Confirmation-1.jpg

Checkout-Confirmation-1.jpg (51.4 KiB) Viewed 8674 times

Last edited by philbydevil on Tue Jan 17, 2012 2:19 pm, edited 7 times in total.

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by marc_cole » Sun Jan 23, 2011 11:16 am

I believe you'll find that text in catalog/language/english/shipping/<filename>.php

Marc

OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by philbydevil » Sun Jan 23, 2011 12:09 pm

Hi Marc. That's the file to edit if I want the change to show on other pages as well (such as checkout/shipping). It would also change the text under "Shipping Method" on the checkout confirmation page. But I don't want it to change anywhere else but the spot circled in red (and I can't even find this in the confirm.tpl file).

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by marc_cole » Sun Jan 23, 2011 1:18 pm

I don't want it to change anywhere else but the spot circled in red
Sorry. I saw that in your post but... :-[

Unfortunately that's not possible the way it's coded, as that text is generated inside a foreach loop. You'd have to remove that loop and "hard-code" all your fields there, but that's probably not the best idea. If, down the road, you were add another field in the checkout process (minimum fee, handling fee, another shipping module, etc.), you'd have to remember to add that field manually, as well.

If you do want to change it, look for this code on confirm.tpl:

Code: Select all

<?php foreach ($totals as $total) { ?>
  <tr>
    <td align="right"><?php echo $total['title']; ?></td>
    <td align="right"><?php echo $total['text']; ?></td>
  </tr>
<?php } ?>
Far be it for me to question why you want to do this, but wouldn't it be confusing to your customers to see it called one thing on the view cart page, but then called something else on the confirm page?

OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by philbydevil » Sun Jan 23, 2011 1:46 pm

I thought that was the code that related to it, but cause I don't know php I wasn't sure how it worked.

I want the text that's there to stay as is, I just want to add (ex GST), like the Sub-Total. I find the way amounts are displayed can be a bit confusing. My store is set to display prices with tax (as per Australian law), and this works well, but when you start going through the checkout, it can get confusing. Cart shows prices including tax, then shipping selection is including tax, but then checkout confirmation shows everything ex tax, and then it adds on the tax at the end (the invoice/order confirm email sent to customers is the same as checkout confirmation, again a bit confusing).

So, instead of trying to change how OpenCart displays prices in checkout confirmation/invoice email, I've just added the the text (ex GST) to the areas that it's required.

If I do this to "Registered/Insured Postage", it will fix the problem on the checkout confirmation page, but it will add it elsewhere and in some places (ie, checkout shipping), the amount is displayed with tax.

Ideally, I think I would like to change the way prices are displayed in checkout confirm and on the invoice. I might look into the possibility of this). Though it may mess up international orders (which are ex tax).

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by philbydevil » Sun Jan 23, 2011 4:43 pm

So, by following the directions in post#2 of this thread (http://forum.opencart.com/viewtopic.php?f=31&t=6627) I have been able to change the product price and sub-total to show the amount with tax.

Now, trying to get the shipping price to display with tax... ???

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by i2Paq » Sun Jan 23, 2011 5:21 pm

I think you have to add new language variables to get that.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by philbydevil » Sun Jan 23, 2011 6:47 pm

I decided that the better way to approach my problem was to change the way amounts are shown on the checkout confirmation page (ie. with tax instead of without). So, I have changed the applicable language files, but I'm still searching the forum (and comparing files) for a way to change the Shipping amount to include tax.

It shows with tax on the shipping method page, so hopefully I can find the code to replicate.

Attachments

Checkout-Confirmation-2.jpg

Checkout-Confirmation-2.jpg (35.45 KiB) Viewed 8654 times


I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by philbydevil » Sun Jan 23, 2011 9:11 pm

This (topic) looks like it could be on the way but I'm not sure how I would get this code working for the use I have... any suggestions?

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by philbydevil » Tue Jan 25, 2011 12:21 pm

For any Aussies (or others) that need to display prices with taxes in checkout confirm, check out this thread:

http://forum.opencart.com/viewtopic.php?f=31&t=6627

I didn't bother with the admin side of things explained in that thread, but I did change a couple of other catalog controllers/models in order to have the inc GST/tax prices consistent throughout my store.

The only problem I found was that after I had applied the code in that thread, the postage was still showing as ex tax (ex GST) in checkout confirm.

Johnathan (http://www.getclearthinking.com) helped me by directing me to this post that explains how to change the postage price to include GST:

http://forum.opencart.com/viewtopic.php ... =40#p99131

To summarize that post (in Johnathan's words):
The first part of that post is just a USPS bug, but start reading from, "The display for taxes is still a bit buggy." It has a suggestion in there for changing the USPS shipping model file, so if you find the same $quote_data array in your shipping model file, the same solution might work. Basically, you need to wrap the $cost variable in $this->tax->calculate(), like so:

Code: Select all

$this->tax->calculate($cost, $this->config->get('usps_tax_class_id')) 
and then set the tax_class_id to 0 (so it doesn't calculate tax twice).

No guarantee that it'll work, but most of the shipping model files have similar code, so it may fix your problem.
For my Australia Post shipping module, $cost turned out to be $postcharge[0], but the code still worked.

So, this was good, my shipping/postage cost in checkout confirm was now displaying the full, inc GST amount. But, something in the modified code (probably "set the tax_class_id to 0") was causing my "Inc GST" sub-total (Admin->Extensions->Order Totals->Taxes) to only calculate/show tax/GST on the cost of the product, and ignored the tax/GST in the postage amount.

Again, Johnathan (http://www.getclearthinking.com) to the rescue:
I'm not sure of the code that's causing this, but the easiest way around it is to not generate the HTML for that line of the order totals. You should be able to do this (replace "Tax" with whatever the title of that line is):

IN:

Code: Select all

/catalog/view/theme/YOURTHEME/template/checkout/confirm.tpl
REPLACE:

Code: Select all

<?php foreach ($totals as $total) { ?>
<tr>
  <td align="right"><?php echo $total['title']; ?></td>
  <td align="right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
WITH:

Code: Select all

<?php foreach ($totals as $total) { ?>
<?php if ($total['title'] != 'Tax:') { ?>
<tr>
  <td align="right"><?php echo $total['title']; ?></td>
  <td align="right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
<?php } ?>
This is only for the confirm page, but you can do the same edit on the /template/checkout/cart.tpl and /template/module/cart.tpl files to erase the line there.
What this does is make the "Tax" sub-total not visible anymore. If you just disable "Taxes" in admin, then it doesn't seem to calculate the tax (this is what I found), so hiding it was the next best thing. Just remember that for this bit of code to work, you have to change the word Tax in:

Code: Select all

<?php if ($total['title'] != 'Tax:') { ?>
to whatever you've called it in your language file (for me I had changed it to Inc. GST (10%)).

There is one little bug in all of this though:
if the customer is paying via PayPal (and maybe other gateways), the "Tax" amount is shown again after they are redirected and unfortunately, it's the incorrectly calculated amount mentioned above.

I'm going to live with this for now, because I still have to issue official tax invoices through my accounting software, so the customer will always get an invoice with the correct tax/GST amount on it.

It would be great to have the tax calculate correctly, because I would still like to show customers at checkout confirm how much tax/GST is included in their order, but for now I'm happy...

Thanks to dbstr and Johnathan for their code.

EDIT: this is working with multiple currencies and multiple tax rates (ie. for different geo zones) on my site.

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by philbydevil » Mon Jan 31, 2011 9:33 pm

This is now a vQMod (see attached file) so you don't have to go editing your core files.

Will show prices with GST (tax) in checkout_confirm/guest_step_3 and order history.

Haven't been able to get the order_confirm email showing taxes for the individual product prices yet.

Paypal tax bug (see above) still not fixed.

EDIT: see FIRST post for the vQmod xml file!

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by philbydevil » Wed Feb 02, 2011 10:22 am

Ok, so I think that the reason there are problems with order confirm email not showing the inc GST/tax prices is related to:

Code: Select all

// dbstr - Get Tax Class Id.
    public function getProductTaxClassId($product_id) {
        $query = $this->db->query("SELECT tax_class_id FROM " . DB_PREFIX . "product WHERE product_id = '" . (int)$product_id . "'");
which is found in catalog/model/checkout/order.php

Because, now that I've been using vQmod, I can see an error in my log stating:
Undefined variable: tax_class_id in vqmod/vqcache/vqcache_catalog_model_checkout_order.php on line 294 (and 297)
These two lines are:

Code: Select all

'price'    => $this->currency->format($this->tax->calculate($product['price'], $tax_class_id['tax_class_id'], $this->config->get('config_tax')), $order_query->row['currency'], $order_query->row['value']),

'total'    => $this->currency->format($this->tax->calculate($product['total'], $tax_class_id['tax_class_id'], $this->config->get('config_tax')), $order_query->row['currency'], $order_query->row['value'])
Now, there hasn't been this problem when implementing the same/similar code elsewhere, but for some reason it's happening only in this file.

So, just be aware that the vQmod/code changes above are slightly buggy, but do still work in general...

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by i2Paq » Wed Feb 02, 2011 2:33 pm

I have added your vQmod to the first post, this is the best way and easy for people to find it ;)

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by baobei18 » Thu Jun 30, 2011 9:23 am

Hi all,
I'm sure I'm missing something incredibly obvious, but I've been going around in circles...

I have installed vQmod as per the instructions here - http://forum.opencart.com/viewtopic.php?f=23&t=24529 (basically just an upload and instant install). I have then upload the vqmod_catalog_show_ALL_prices_with_GST.xml file to vqmod/xml/ . I have checked www.mysite.com/vqmod/install/ and it says "VQMOD ALREADY INSTALLED!" so I presume it's working fine.

However, I can't see any changes to the checkout confirm page etc?

Thanks for any help :)

Newbie

Posts

Joined
Tue Jun 28, 2011 10:49 am
Location - Victoria, Australia

Post by philbydevil » Mon Jul 04, 2011 9:05 am

This vQmod hasn't been updated for 1.5, so if that's the version you are using it may not work.

I Image cmd-f, cmd-c, cmd-v, cmd-z + vQmod.
My favourite page...
v1.5.4.1


User avatar
Active Member

Posts

Joined
Fri Dec 03, 2010 5:20 am
Location - Sunshine Coast, Australia

Post by baobei18 » Mon Jul 04, 2011 9:23 pm

philbydevil wrote:This vQmod hasn't been updated for 1.5, so if that's the version you are using it may not work.
Ahh, that might explain it, thanks for the info :)

Newbie

Posts

Joined
Tue Jun 28, 2011 10:49 am
Location - Victoria, Australia

Post by pierrelejohn » Mon Jul 11, 2011 2:29 am

Hi
getting in a pickle with this

installed the vmod, installed all - shows prices with tax ....

the shipping still shows ex vat - i'M A BIT LOST

he first part of that post is just a USPS bug, but start reading from, "The display for taxes is still a bit buggy." It has a suggestion in there for changing the USPS shipping model file, so if you find the same $quote_data array in your shipping model file, the same solution might work. Basically, you need to wrap the $cost variable in $this->tax->calculate(), like so:

Code: Select all
$this->tax->calculate($cost, $this->config->get('usps_tax_class_id'))

and then set the tax_class_id to 0 (so it doesn't calculate tax twice).
This is what I want to change

'text' => $this->currency->format($this->tax->calculate($cost, $this->config->get('parcelforce_48_tax_class_id'), $this->config->get('config_tax')))
);

any help appreciated

Newbie

Posts

Joined
Fri Jun 10, 2011 4:28 pm

Post by andrixx » Sun Sep 11, 2011 8:13 pm

I don't fully understand. This vQmod file makes the price show WITH tax all over your shop?

That is what I want so I uploaded it to my store /vqmod/xml

But still, it looks like nothing is changed.


It's just confusing for the costumers to see the price without tax and then what the tax is.
I want them to see all prices with tax and then by the checkout the tax line can say "of which tax is" to inform that tax is included.

Attachments

tax.png

tax.png (195.21 KiB) Viewed 7887 times


New member

Posts

Joined
Sat Jun 18, 2011 7:23 pm

Post by andrixx » Sun Sep 11, 2011 10:17 pm

I bet the core files in 1.5.1.1 has been updated since the xml was made.

in vqmod_catalog_show_ALL_prices_with_GST.xml:

Code: Select all

'value'      => $this->cart->getSubTotal(),
should be changed to

Code: Select all

'value'      => $sub_total,
and

Code: Select all

 'text'       => $this->currency->format($this->cart->getSubTotal()),
changed to

Code: Select all

'text'       => $this->currency->format($sub_total),
Then it will work.

But not my flat rate shipping module. that still shows without tax rate added.

New member

Posts

Joined
Sat Jun 18, 2011 7:23 pm

Post by Xciso » Wed Sep 14, 2011 9:24 pm

Will this mod works good for swedish shops with 1.5.1.1 / 1.5.1.2?

Active Member

Posts

Joined
Fri Jul 15, 2011 5:20 am
Who is online

Users browsing this forum: No registered users and 5 guests