Send email to user when status changes

  • Posts: 171
  • Thank you received: 9
9 years 9 months ago #164310

Hi!

When editing an order on frontend, I wanted to let the subvendor to notify the user, but email was not sent out.

I've found this thread , and just noticed there's this notify checkbox in the code. But this just shown to the main vendor, for subvendors not. I've modified this:

if(isset($this->edit) && $this->edit === true && ($this->vendor->vendor_id == 0 || $this->vendor->vendor_id == 1) && hikamarket::acl('order_edit_notify')) {

to this
if(isset($this->edit) && $this->edit === true && hikamarket::acl('order_edit_notify')) {

Also modified:
<input type="checkbox" id="data[notify]" name="data[notify]"/>
to:
<input type="checkbox" id="data[notify]" name="data[notify]" checked="checked"/>

Now the fields are shown, but system is just sending out the email if I'm the main vendor, for subvendor no emails arriving. Any option to get this work for subvendors (and subvendor users) as well?

Thanks for your help in advance.

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
9 years 9 months ago #164311

Hi,

HikaMarket was not design to let the vendors send automatic notifications to the user.
The reason is that the vendor might not be the only vendor in the order.
So, even if the checkbox is there, HikaMarket won't read it to send the order notification.

The fact is that I want to improve some elements in HikaShop/HikaMarket in order to support partial statuses.
So vendors would be able to notify the user that a part of the order status changed (for some products).
But I guess that we can authorize the order notification is the vendor is the only vendor in the order (and there is no main vendor products too).

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: 171
  • Thank you received: 9
9 years 9 months ago #164360

I understand the usual case, but in our case all the items are orderable from all vendors, so on our side it won't happen/it's not a problem.

Could you give me an advice, what and in which file should I modify to let subvendors as well to modify the orders (status, notification, ordered items deletion/modification)? As I see of course that would be a "hack", which should be overwritten every time after re-installing a new version, but now it's a must have for us. :S

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
9 years 9 months ago #164361

Hi,

So you will have to edit two classes.
The first one : order (adminstrator/components/com_hikamarket/classes/order.php)
In order to replace :

if($vendor_id == 0 && !empty($data['notify']) && hikamarket::acl('order_edit_notify')) {
	if(empty($order->history))
		$order->history = new stdClass();
	$order->history->history_notified = true;
}
By:
if(!empty($data['notify']) && hikamarket::acl('order_edit_notify')) {
	if(empty($order->history))
		$order->history = new stdClass();
	$order->history->history_notified = true;
	if(empty($order->hikamarket))
		$order->hikamarket = new stdClass();
	$order->hikamarket->force_email = true;
}

The second one : mail (adminstrator/components/com_hikamarket/classes/mail.php)
The idea is to authorize the notification for a sub order when you have the variable which says so.
So in the function processOrderEmail.
if($subsaleEmail) {
	$do = false;
	return;
}
By:
if($subsaleEmail && empty($mail->data->hikamarket->force_email)) {
	$do = false;
	return;
}
It should authorize the vendor to send order notifications for their sub orders.

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: pepecortez

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

  • Posts: 171
  • Thank you received: 9
9 years 9 months ago #164410

The code is perfect, working now like a charm. I should push "Thank you" button a hundred times, if system would let it.

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

Moderators: Obsidev
Time to create page: 0.068 seconds
Powered by Kunena Forum