Link to order in email

  • Posts: 357
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 2 months ago #329440

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.24
-- PHP version -- : 7.4

Hi

My frontpage has no area for a component, so the order link in the emails to my customers fails.
I see the link is from this in the emails:
{VAR:TPL_HEADER_URL}

But where can I change that?

Kind regards
Thomas

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

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
3 years 2 months ago #329447

Hi,

Well, it depends.
First, normally, HikaShop uses the current menu item.
So if the email is sent when the order is created on the checkout, it will take the menu item used for the checkout, and thus you shouldn't have the problem.
Similarily, for the email sent when the order is confirmed automatically by a payment plugin, it uses the menu item of the checkout.
So you shouldn't have a problem here either.
But for the same emails, you could have a problem with the "preview" button, since the preview is generated in the backend, or if you manually change the status of the order in the backend.
So the first question is where are the emails generated. You might be thinking that the links have a wrong menu item because you're testing the links generated from the preview while it might actually work fine as your customers get the emails generated from the checkout, with a correct menu item.

The link you get in TPL_HEADER_URL is generated in the file administrator/components/com_hikashop/classes/order.php with the code:

global $Itemid;
		$url = '';
		if(!empty($Itemid))
			$url='&Itemid='.$Itemid;
		if(isset($order->url_itemid))
			$url = (!empty($order->url_itemid) ? '&Itemid=':'') . $order->url_itemid;
		if((empty($order->customer->user_cms_id) || (int)$order->customer->user_cms_id == 0) && !empty($order->order_token)) {
			$url .= '&order_token='.urlencode($order->order_token);
		}
		$order->order_url = hikashop_contentLink('order&task=show&cid[]='.$order->order_id.$url, $order, false, false, false, true);
So you could theoretically force it there.
But I would rather recommend to have an area for a component on your homepage and configure its menu item to be of a type not displaying anything. For example an empty joomla article.

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

  • Posts: 357
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 2 months ago #329481

Hi

Thanks for explaining, but I'm not quite sure I understand.
I have tested the link in the email sent to the customer, not from the backend - and still just get the frontpage, not the order it self.
I would to rather have the menu item, but I'm not sure what I have to do to achieve this.

/Thomas

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

  • Posts: 81566
  • Thank you received: 13075
  • MODERATOR
3 years 2 months ago #329499

Hi,

Edit, the email via the menu System>Emails, and at the beginning of the preload section, add such line of code:

<?php 
if((empty($data->customer->user_cms_id) || (int)$data->customer->user_cms_id == 0) && !empty($data->order_token)) {
	$url .= '&order_token='.urlencode($data->order_token);
}
$data->order_url = hikashop_contentLink('order&task=show&cid[]='.$order->order_id.$url.'&Itemid=XX', $order, false, false, false, true); ?>
where XX is the id of the menu item you want to use.

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

  • Posts: 357
  • Thank you received: 24
  • Hikaserial Standard Hikashop Business
3 years 2 months ago #329514

Thanks, will have a look :-)

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

Time to create page: 0.059 seconds
Powered by Kunena Forum