Skip to main content

Send email to user when status changes

More
12 years 2 months ago #164310 by pepecortez
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:
Code:
if(isset($this->edit) && $this->edit === true && ($this->vendor->vendor_id == 0 || $this->vendor->vendor_id == 1) && hikamarket::acl('order_edit_notify')) {

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

Also modified:
Code:
<input type="checkbox" id="data[notify]" name="data[notify]"/>
to:
Code:
<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.

More
12 years 2 months ago #164311 by Jerome
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.

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

More
12 years 2 months ago #164360 by pepecortez
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.

More
12 years 2 months ago #164361 by Jerome
Hi,

So you will have to edit two classes.
The first one : order (adminstrator/components/com_hikamarket/classes/order.php)
In order to replace :
Code:
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:
Code:
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.
Code:
if($subsaleEmail) { $do = false; return; }
By:
Code:
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.
The following user(s) said Thank You: pepecortez

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

More
12 years 2 months ago #164410 by pepecortez
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.218 seconds
Powered by Kunena Forum