[solved] Show Shipping without tax on order confirmation mail

  • Posts: 290
  • Thank you received: 22
7 years 7 months ago #267968

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.0.18

Hi,
I'm looking for the right string to modify in the confimation email that goes to the client.
In this email the shipping is showed with tax and I would like to show it without tax.

FYI : The setting of the site is to show both prices but on some parts of the site the displaying of prices is changed because that is what the customer would like to see.

I've managed to change the price display by changing the strings used to the ones without tax. This I managed to find on the forum myself but I have had no luck with changing the shippingprice.

Thanks in advance

Last edit: 7 years 6 months ago by nico.van.leeuwen. Reason: solved

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 7 months ago #267973

Hello,

In the "preload" part of the email you will find that code

	if($config->get('price_with_tax')){
		$shipping_data .= ' (' . $currencyHelper->format($price_params->price_with_tax, $data->cart->order_currency_id) . ')';
	}else{
		$shipping_data .= ' (' . $currencyHelper->format($price_params->price_with_tax - @$price_params->tax, $data->cart->order_currency_id) . ')';
	}
By changing the condition in the first "if", you can force the display of the shipping price with, or without taxes.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 7 months ago #268000

Hi Jerome,

Thank you very much for this. Unfortunately I must be doing something wrong with changing the code because it's not changing my result in the email.

I changed it to

if($config->get('price_with_tax')){
					$shipping_data .= ' (' . $currencyHelper->format($price_params->price_with_tax - @$price_params->tax, $data->cart->order_currency_id) . ')';
				}else{
					$shipping_data .= ' (' . $currencyHelper->format($price_params->price_with_tax - @$price_params->tax, $data->cart->order_currency_id) . ')';
				}

But the result has not changed. (this is also the reason I leave coding to coders :blink: )

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 7 months ago #268010

Hello,

Which email have you edited ? How are you testing the email content ?

If you take a look at my message, I was telling you to just change the "if" condition ; like a " if(false) ".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 6 months ago #268107

Hi Jerome,

Appologies for not changing the code the correct way :(

The email I'm trying to change is the one that is send when an order is created. (Configuration > System > Email).
There I select the order created mail and do the change in the Pre-load block.

I test by creating an order and see what's in the email that is send.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 6 months ago #268108

Hello,

You can edit the "order_notification" email ; that email is used when you click on the "email" toolbar button while displaying an order in the backend.
You can check that you're modifying the right email by adding some content in the "html" part.
By opening two tabs, one for the email edition and one for the order details ; you will be able to perform test easily (and confirm the modification you want to do).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: nico.van.leeuwen

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 6 months ago #268305

Hi,

Is just tested again if I'm in the right file and it's the "order creation notification" email I need to edit.
Testing with an extra piece in the HTML part is showing this in the confirmation email.

What I did not get right is the syntax for not showing the tax on the shipping.
Anyone willing to help with this by sending a piece of code that I can try ?

Thanks !

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 6 months ago #268318

Hi,

I can only confirm what Jerome said. Using if(false) should do what you want while if(true) will always display the shipping method price with tax on the email notification.

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 6 months ago #268433

Hi Nicolas,

No question about Jerome being right, I'm sure he is.

It's just me not getting it to show the shipping costs without tax ...
Tried my best but all I get is or syntax errors, or shipping with tax :(

I don't know anything about syntax so must be doing something wrong that does not seem obvious to me.

Your help is really appreciated don't get me wrong.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 6 months ago #268445

Hi,

Well, I don't know what you're doing but the modification is really simple.
You need to replace:
if($config->get('price_with_tax')){
by:
if(false){

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 6 months ago #268453

Hi Nicolas,

I did exactly what you suggested but the confirmation email still shows the shipping price with tax.
Tried the same modification on my clean development site and here it also shows the shipping with tax in the order creation notification email.

Sorry about the trouble but it looks like it's really not changing anything.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 6 months ago #268455

Hi,

Well, I don't know what you're doing wrong. Or maybe we're not talking about the same thing.
Please provide screenshots of the situation and the modifications, etc so that we can better understand.

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 6 months ago #268483

Hi,
Here are some screenshots of the config and the changes I made.

Attachments:
Last edit: 7 years 6 months ago by Jerome.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 6 months ago #268516

Hi,

Ok, we were not talking about the same place.
It's that code that you want to change then:

		if($config->get('price_with_tax')) {
			$t = $currencyHelper->format($data->cart->order_shipping_price,$data->cart->order_currency_id);
		}else{
			$t = $currencyHelper->format($data->cart->order_shipping_price-@$data->cart->order_shipping_tax,$data->cart->order_currency_id);
		}
replace the condition in the if like on the other code and that will do.

The following user(s) said Thank You: nico.van.leeuwen

Please Log in or Create an account to join the conversation.

  • Posts: 290
  • Thank you received: 22
7 years 6 months ago #268543

Hi Jerome and Nicolas,

Thanks for this, now it's working without showing Tax added to the shipping amount.

Great job !

Please Log in or Create an account to join the conversation.

Time to create page: 0.084 seconds
Powered by Kunena Forum