Hikashop - Message from an Order

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
2 weeks 6 days ago #371519

-- HikaShop version -- : 6.3.0
-- Joomla version -- : 5.4.2

Hello

I'm validating transactional emails for Hikashop, and one isn't working. When a user makes a purchase, they can access the order details page, which they can also access from their user profile. On that page, they have the option to send a message or ask a question by clicking the "Contact us about your order" button. When they click the button, a form opens to send a message. I assume the message is directed to the seller of the purchased order, but the email never arrives. I've checked the spam folders and run several tests, but it's still not getting through.

Could you explain how to validate this email and how to fix it?

Thanks!

Attachments:

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
2 weeks 6 days ago #371521

Hi,

There are two things you can do in priority:
- In System>Emails, you can see the list of emails HikaShop can send. There, you'll find the "Contact request" email. Make sure it is published. If not, the email won't be sent. Also, you can open it and use the "preview" button to check that the email can be generated by HikaShop.
- In Customers>Emails history, you can see the list of emails sent / generated by HikaShop. If you see the emails there but you don't receive them, it's likely a problem with either the settings of the Emails section of the Joomla configuration page, or with the settings of the Emails section of the HikaShop configuration page.

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
2 weeks 5 days ago #371534

Hello

I found the email in System > Emails, but I also discovered that the message is going to the site administrator's inbox, when it should be going to the inbox of the salesperson associated with the order.

How can I change the recipient?

Last edit: 2 weeks 5 days ago by nmacri.

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
2 weeks 5 days ago #371537

Hi,

The email goes to the email address you specify in the "Contact request email address" setting of the HikaShop configuration. You can change that setting, but you can't have it dynamic.
How is the salesperson associated with the order ?
That would probably require some kind of customization in System>Emails in order to override the email address of the recipient.

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
2 weeks 4 days ago #371542

Hello

But we agree that this isn't right, right?

On the one hand, if it's a multi-vendor e-commerce site, the site administrator can't possibly respond to inquiries from 100 or 1000 vendors; it's simply not feasible.

On the other hand, the user making the purchase has no way to communicate with the actual vendor, such as how to coordinate product delivery, payment, etc.

Can you make the change you mentioned?
Or at least give me instructions on which files I need to customize and whether I have access to the vendor object within them, which I understand contains the vendor's email address?

Thanks!

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
2 weeks 4 days ago #371544

Hi,

1. You had not mentioned this was a multivendor website and that a vendor is a salesperson on your website.

2. The current HikaMarket version doesn't have anything to allow the customer to directly contact the vendor from the order page. But that's a good idea. We'll look at improving this for the next version of HikaMarket.

3. If you can't wait, you can directly change the behavior of the email as I was hinting at in my previous message.
In System>Emails, you can edit the "contact request" email. There, in the preload section, you have access to the order data in $data. And you have access to the email data in $mail
While $data won't directly contain the vendor data, you'll have the order id in $data->order->order_id and you can use something like that:

if(!empty($data->order)
      && !empty($data->order->order_type) && $data->order->order_type == 'subsale'
      && !empty($data->order->order_vendor_id) && $data->order->order_vendor_id > 1
      && class_exists('hikamarket')) {
      $vendorClass = hikamarket::get('class.vendor');
      $vendor = $vendorClass->get((int)$data->order->order_vendor_id);
      if(!empty($vendor) && !empty($vendor->vendor_published) && !empty($vendor->vendor_email)) {
          $mail->dst_email = $vendor->vendor_email;
          $mail->dst_name  = $vendor->vendor_name;
      }
  }

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
2 weeks 4 days ago #371564

Hello,

I apologize for the confusion. Since I have been making several inquiries regarding Hikashop and HikaMarket, I inadvertently forgot to mention that I am using both extensions together.

Regarding the solution you provided—which I appreciate—after further analysis, I’ve noticed that the "Contact request" email is being triggered in two similar but distinct scenarios:

First scenario (the one that prompted this inquiry): A user places an order and, from the order details page, sends a query to the vendor. In this case, the email subject follows the configuration in System -> Emails, and the message is delivered to the email account configured in the Hikashop administration (the ecommerce administrator's address).

Second scenario: A guest user (not logged in) visits a specific product and submits a query about it. In this case, the email subject is "Contact request for order" (translation key: CONTACT_REQUEST_FOR_ORDER), and the message is delivered to the product vendor's email account.

It strikes me as unusual that if the same code is used to generate the email and the same preload code is applied, the messages are sent to different destinations.

Could you please look into this? I might be misinterpreting something, but I added custom text to the email body (to the code itself, NOT the template), and that text appears in both types of messages.

Thank you very much for your help, and sorry for the long explanation!

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
2 weeks 3 days ago #371569


It strikes me as unusual that if the same code is used to generate the email and the same preload code is applied, the messages are sent to different destinations.

Could you please look into this?

This is normal. HikaMarket already comes with some code to override the contact request email, but only for the product page, in order to send the email to the vendor instead of the shop owner.

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
1 week 6 days ago #371641

Hi

Perfect, I understand that's the normal behavior.

So, I tried adding the code block you shared in a previous post to load the seller's email as the message recipient. I've attached the complete code from the preload section. Is it correct to add it at the end? Because it's not working; the message is still being sent to the email address configured in the Hikashop admin panel.

Thanks!

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	6.3.0
 * @author	hikashop.com
 * @copyright	(C) 2010-2026 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
global $Itemid;
$url_itemid = '';
if(!empty($Itemid)) {
	$url_itemid = '&Itemid=' . $Itemid;
}

$texts = array(
	'MAIL_HEADER' => JText::_('HIKASHOP_MAIL_HEADER'),
	'CONTACT_TITLE' => JText::_('CONTACT_EMAIL_TITLE'),
	'CONTACT_BEGIN_MESSAGE' => JText::_('CONTACT_BEGIN_MESSAGE'),
	'USER_MESSAGE' => JText::_('CONTACT_USER_MESSAGE'),
	'USER' => JText::_('HIKA_USER'),
	'HI_USER' => JText::sprintf('HI_CUSTOMER', ''),
	'FOR_PRODUCT' => '',
);

$vars = array(
	'LIVE_SITE' => HIKASHOP_LIVE,
	'URL' => HIKASHOP_LIVE,
	'PRODUCT_DETAILS' => '',
	'FRONT_PRODUCT_DETAILS' => '',
	'PRODUCT' => false,
);

$main_element = null;
if(!empty($data->order)) {
	$texts['FOR_PRODUCT'] = JText::sprintf('CONTACT_REQUEST_FOR_ORDER', $data->order->order_number);

	$admin_url = JRoute::_('administrator/index.php?option=com_hikashop&ctrl=order&task=show&cid[]='.$data->order->order_id, false, true);
	$front_url = hikashop_frontendLink('index.php?option=com_hikashop&ctrl=order&task=show&cid='.$data->order->order_id.'&order_token='.$data->order->order_token.$url_itemid);
	$element_name = $data->order->order_number;
	$texts['PRODUCT'] = JText::_('HIKASHOP_ORDER');
	$vars['PRODUCT'] = true;
	$main_element = $data->order;
} elseif(!empty($data->product)) {
	$texts['FOR_PRODUCT'] = JText::sprintf('CONTACT_REQUEST_FOR_PRODUCT', $data->product->product_name);

	$admin_url = JRoute::_('administrator/index.php?option=com_hikashop&ctrl=product&task=edit&cid[]='.$data->product->product_id, false, true);
	$productClass = hikashop_get('class.product');
	$productClass->addAlias($data->product);
	$front_url = hikashop_frontendLink('index.php?option=com_hikashop&ctrl=product&task=show&cid='.$data->product->product_id.'&name='.$data->product->alias.$url_itemid);
	$element_name = strip_tags($data->product->product_name.' ('.$data->product->product_code.')');
	$texts['PRODUCT'] = JText::_('PRODUCT');
	$vars['PRODUCT'] = true;
	$main_element = $data->product;
}

$name = '';
if(!empty($data->element->email)) {
	$name = $data->element->email;
}
if(!empty($data->element->name)) {
	if(empty($name))
		$name = $data->element->name;
	else
		$name = $data->element->name.' ( '. $name . ' )';
}
if(!empty($name)) {
	$vars['USER_DETAILS'] = htmlentities($name, ENT_COMPAT, 'UTF-8');

}
$vars['USER'] = !empty($name);

if(!empty($data->element->altbody)) {
	$vars['USER_MESSAGE'] = str_replace(array("\r\n","\r","\n"), '<br/>', $data->element->altbody);
}

$vars['MESSAGE'] = !empty($data->element->altbody);

if(!empty($element_name)) {
	$vars['PRODUCT_DETAILS'] = '<p>'.$element_name;
	if(!empty($admin_url))
		$vars['PRODUCT_DETAILS'] .= ' <a href="'.$admin_url.'">'.JText::_('BACKEND_EDITON_PAGE').'</a>';
	if(!empty($front_url))
		$vars['PRODUCT_DETAILS'] .= ' <a href="'.$front_url.'">'.JText::_('FRONTEND_DETAILS_PAGE').'</a>';
	$vars['PRODUCT_DETAILS'] .= '</p>';
}

if(hikashop_level(1)) {
	$fieldsClass = hikashop_get('class.field');
	$contactFields = $fieldsClass->getFields('frontcomp',$main_element,'contact');
	if(!empty($contactFields)){
		foreach($contactFields as $field){
			$namekey = $field->field_namekey;
			if(!isset($data->element->$namekey)) continue;
			if(empty($data->element->$namekey) && !strlen($data->element->$namekey)) continue;
			$field->currentElement = $data->element;
			$vars['PRODUCT_DETAILS'] .= '<p>'.$fieldsClass->getFieldName($field).': '.$fieldsClass->show($field, $data->element->$namekey, 'admin_email').'</p>';
		}
		if(!empty($vars['PRODUCT_DETAILS']))
			$vars['PRODUCT'] = true;
	}
}


if(!empty($data->order) 
      && !empty($data->order->order_type) && $data->order->order_type == 'subsale' 
      && !empty($data->order->order_vendor_id) && $data->order->order_vendor_id > 1 
      && class_exists('hikamarket')) { 
      $vendorClass = hikamarket::get('class.vendor'); 
      $vendor = $vendorClass->get((int)$data->order->order_vendor_id); 
      if(!empty($vendor) && !empty($vendor->vendor_published) && !empty($vendor->vendor_email)) { 
          $mail->dst_email = $vendor->vendor_email; 
          $mail->dst_name = $vendor->vendor_name; 
      } 
  }

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
1 week 6 days ago #371645

Hi,

Note that the code is not tested. That's something I've written on the fly. It needs proper testing and potentially some changes.

However, since then, we've released HikaMarket 6.1.0:
www.hikashop.com/support/documentation/1...arket-changelog.html
And one of the main features of that new version is:

Customers can now contact each vendor of their order directly. A dedicated "Contact vendor" entry is added to the HikaShop order details toolbar, to the orders listing action dropdown, and to the order block on the user control panel. Each link opens the HikaShop contact form targeting the relevant vendor sub-order, and the email is automatically routed to that vendor's address. The contact form title is rewritten to reference the parent order number for clarity.

So, I would recommend updating your HikaMarket and avoiding this customization.

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
1 week 3 days ago #371662

I have been testing the new functionality you mentioned and there is a detail to correct, although it might be due to something I did not fully understand.

Case 1: I access the full list of placed orders. Each order has a dropdown menu that includes two options to send a message:

"Contact Store XXX" – this message is correctly sent to the vendor of the order.
"Contact us about your order" – this message is still sent to the ecommerce administrator. Is this the expected behavior?

Case 2: I access the order details, where the button "Contact us about your order" is displayed. Messages sent from this form continue to be sent to the ecommerce administrator. Is this the behavior you expect? As I mentioned before, the ecommerce administrator is not the appropriate person to respond to or coordinate actions regarding an order.

There may be cases where the buyer wants to contact the ecommerce administrator, and it would be good to have that option available. However, above all, the buyer should be able to easily contact the vendor of the product.

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
1 week 2 days ago #371668

Hi,

The expected behavior is to have on both cases a "Contact XXX" button where XXX is the name of a vendor (you'll have one button for each vendor, so if the user placed an order for products from 3 different vendors, he'll have 3 buttons, one per vendor), plus a "contact us about your order" which goes to the admin.
If you don't see the vendor specific buttons on the order details page, it could be because you have an old view override of order / show.php or toolbar / default.php in your template.
So please check for these under the templates/YOUR_TEMPLATE/html/com_hikashop/ folder via FTP. If you have one of them, rename it to deactivate it and see if that helps.

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
1 week 1 day ago #371696

Hello

I checked the view being used to display the toolbar on the order details page, "Toolbar -> Default". I edited it from "HikaShop panel -> Display -> Views", added text, and it appeared on the buttons. When I removed the customization, the button text disappeared. Both in the HikaShop, panel and when accessing via FTP, there are no customizations to that view, but the "Contact Vendor" button still doesn't appear.

I also checked the CSS styles that might be hiding the button, but that's not the problem.

Any other suggestions?

Thanks!

Attachments:

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
1 week 1 day ago #371698

Hi,

I don't see any other reason. And I checked on my end and it works.
We'll have to check directly on your website.
Please provide a frontend access with an order with the issue so that I can reproduce it, a backend access in order to check your settings, and a FTP access to check the files and do some debugging if necessary:
www.hikashop.com/support/contact-us.html
Make sure you include a link to this thread in your message.

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
1 week 19 hours ago #371718

Hi, after submitting the data, I ran more tests, but this time I completed the entire flow, from purchasing the product to sending the message from the order details page.

Once the order is completed, a link to the order details is displayed. In this case, the "Contact Seller" button is shown, but if I exit the order and access the details again from the order list, the "Contact Seller" button no longer appears.

Do you have access to review this?

Thanks!

Last edit: 1 week 18 hours ago by nmacri.

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

  • Posts: 85571
  • Thank you received: 14003
  • MODERATOR
1 week 8 hours ago #371720

Hi,

I got the accesses. I was able to connect to the frontend and the backend, but not to the FTP.
Could you double check the credentials and make sure they work ?

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

  • Posts: 61
  • Thank you received: 1
  • Hikamarket Multivendor Hikashop Business
1 week 4 hours ago #371725

My apologies, I shared the wrong FTP server. I've sent a new message with the subject "Hikashop Ticket Inquiry - Message from an Order - 2".

Thank you!

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

Time to create page: 0.094 seconds
Powered by Kunena Forum