Displaying the DISCOUNT CODE on All Order Emails

  • Posts: 284
  • Thank you received: 6
2 years 3 months ago #343673

-- url of the page with the problem -- : www.notable.au/new/
-- HikaShop version -- : 4.6.1
-- Joomla version -- : 4.1.5
-- PHP version -- : 8.0.21

I used to use this code to display the DISCOUNT CODE on all of the order emails:

<!--{IF:DISCOUNT}-->
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> {VAR:order.order_discount_code}
</p>
<!--{ENDIF:DISCOUNT}-->

However, with Joomla 4, this is no longer working and actually stops the "Order administrator notification" email from being sent.

Any ideas?

Thank you.

Last edit: 2 years 3 months ago by MSTACE.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 3 months ago #343677

Hi,

There is no

<!--{IF:DISCOUNT}--> ... <!--{ENDIF:DISCOUNT}-->
available in the HikaShop emails by default.
So you must have also added some code in the "preload" of the email to add this.
So either you're missing that code from the preload, or the code you added in the preload has a problem, not the tag in the HTML.

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

  • Posts: 284
  • Thank you received: 6
2 years 3 months ago #343678

Sorry, here is the original code that you all gave me years ago.
This one is not working either.

<!--{IF:DISCOUNT}-->
          <?php 
if(!empty($data->order_discount_code)){ ?>
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> {VAR:order.order_discount_code}
</p>
<?php
}
?>
<!--{ENDIF:DISCOUNT}-->

Last edit: 2 years 3 months ago by MSTACE.

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
2 years 3 months ago #343692

Hello,

Sorry for this returns, but in order to be sure, can you precise from which parts did you add this custom code (shown here).
In the HTML, TEXT or preload version ?
Did you just update your Joomla 4 version ? Or the HikaShop version too ?
Awaiting your returns to progress on your issue.

Regards

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

  • Posts: 284
  • Thank you received: 6
2 years 3 months ago #343750

I added this code to the HTML version.

This was a new Joomla 4 install.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 3 months ago #343763

Hi,

This code should work for the order creation notification and the order admin notification:

<?php 
if(!empty($data->order_discount_code)){ ?>
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> {VAR:order.order_discount_code}
</p>
<?php
}
?>
This should work for the order status notification and the payment notification emails:
<?php 
if(!empty($data->cart->order_discount_code)){ ?>
<p>
	<span style="color:#1c8faf !important;font-weight:bold;">COUPON used :</span> {VAR:order.order_discount_code}
</p>
<?php
}
?>
The second code might also work for the order creation notification and the order admin notification but it would require some testing to verify that.

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

  • Posts: 284
  • Thank you received: 6
2 years 3 months ago #343775

Excellent. These work great.

Thank you very much.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum