- Posts: 171
- Thank you received: 9
Remove vendor address from email
- pepecortez
-
Topic Author
- Offline
Less
More
10 years 3 months ago #242296
by pepecortez
Remove vendor address from email was created by pepecortez
-- HikaMarket version -- : 2.3.5
Hi,
I've a really specialized problem and I would be really glad for a small help code snippet Jerome. In email (market.order_status_notification) I'm able to add a custom email address like below:
But I have to solve somehow to send status notification email in shipped status just to that specified custom email address. Neither for vendor, nor for customer, just to email@address.com. Can I solve it somehow?
Thanks for your help in advance!
Regards,
PePe
Hi,
I've a really specialized problem and I would be really glad for a small help code snippet Jerome. In email (market.order_status_notification) I'm able to add a custom email address like below:
Code:
if($data->order->order_status == 'shipped'){
$this->mailer->addBCC('email@address.com');
}
But I have to solve somehow to send status notification email in shipped status just to that specified custom email address. Neither for vendor, nor for customer, just to email@address.com. Can I solve it somehow?
Thanks for your help in advance!
Regards,
PePe
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242298
by Jerome
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.
Replied by Jerome on topic Remove vendor address from email
Hi,
The vendor order notification in HikaMarket is send to the vendor email (and his notified users).
Even if you can access to the mailer in the "preload" part of the email, the "dest email" is set after that in another function.
Which mean that you cannot replace the destination email unless you're doing the job just before the HikaShop job.
So if you want to override that, you'll need to use a plugin to catch (and modify) the email before it is sent by HikaShop.
www.hikashop.com/support/documentation/6...tml#onBeforeMailSend
Regards,
PS : Please note that HikaMarket 2.3.5 does not exists.
The vendor order notification in HikaMarket is send to the vendor email (and his notified users).
Even if you can access to the mailer in the "preload" part of the email, the "dest email" is set after that in another function.
Which mean that you cannot replace the destination email unless you're doing the job just before the HikaShop job.
So if you want to override that, you'll need to use a plugin to catch (and modify) the email before it is sent by HikaShop.
www.hikashop.com/support/documentation/6...tml#onBeforeMailSend
Regards,
PS : Please note that HikaMarket 2.3.5 does not exists.
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.
- pepecortez
-
Topic Author
- Offline
Less
More
- Posts: 171
- Thank you received: 9
10 years 3 months ago - 10 years 3 months ago #242389
by pepecortez
Replied by pepecortez on topic Remove vendor address from email
Thanks for the advice Jerome.
I've created a hikashop plugin, installed and activated it with the following content, but with no luck:
Any ideas what am I failed on?
I've created a hikashop plugin, installed and activated it with the following content, but with no luck:
Code:
function onBeforeMailSend(&$mail,&$mailer){
$app =JFactory::getApplication();
$orderid = $app->getUserState('com_hikashop.order_id');
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($orderid);
if($order->order_status == 'shipped'){
unset($mail->dst_email);
}
}
Any ideas what am I failed on?
Last edit: 10 years 3 months ago by pepecortez.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242394
by Jerome
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.
Replied by Jerome on topic Remove vendor address from email
Hi,
Please note that the "$mail" object contains a lot of useful information ; like the mail name which is currently send and also his data (like the "order" when it's an order notification).
And your goal is to replace the destination email with another element.
If you want to refuse the expedition of an email the best would be to use the trigger "onBeforeMailPrepare" which have a "$do" parameter to cancel the mail.
You can see an example of mail handling in HikaMarket ; in the class "mail" you will see the function "beforeMailPrepare" which call different sub functions depending the mail name ; like "processContactMail" to change the destination email to the vendor while the contact request is regarding a vendor product.
Regards,
Please note that the "$mail" object contains a lot of useful information ; like the mail name which is currently send and also his data (like the "order" when it's an order notification).
And your goal is to replace the destination email with another element.
If you want to refuse the expedition of an email the best would be to use the trigger "onBeforeMailPrepare" which have a "$do" parameter to cancel the mail.
You can see an example of mail handling in HikaMarket ; in the class "mail" you will see the function "beforeMailPrepare" which call different sub functions depending the mail name ; like "processContactMail" to change the destination email to the vendor while the contact request is regarding a vendor product.
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.
- pepecortez
-
Topic Author
- Offline
Less
More
- Posts: 171
- Thank you received: 9
10 years 3 months ago - 10 years 3 months ago #242542
by pepecortez
Replied by pepecortez on topic Remove vendor address from email
Hi Jerome!
Thanks, it seems the problem was that the order status was not loaded correctly. Also I added a BCC address to the dst_email, I modified to code this way, and it seems working ok:
Thanks for your help again!
Thanks, it seems the problem was that the order status was not loaded correctly. Also I added a BCC address to the dst_email, I modified to code this way, and it seems working ok:
Code:
function onBeforeMailPrepare(&$mail,&$mailer,&$do){
if($mail->data->order->order_status == 'shipped'){
$mail->dst_email = 'email@address.com';
}
}
Last edit: 10 years 3 months ago by pepecortez.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242554
by Jerome
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.
Replied by Jerome on topic Remove vendor address from email
Hi,
Please do not use that code in your website ; You can potentially affect every emails which have an "order" data ; not only the HikaMarket email but also the HikaShop one.
You will find the right tips in my previous message and information where you can see some code to base your code on.
Regards,
Please do not use that code in your website ; You can potentially affect every emails which have an "order" data ; not only the HikaMarket email but also the HikaShop one.
You will find the right tips in my previous message and information where you can see some code to base your code on.
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.
- pepecortez
-
Topic Author
- Offline
Less
More
- Posts: 171
- Thank you received: 9
10 years 3 months ago #242693
by pepecortez
Replied by pepecortez on topic Remove vendor address from email
Oooh... jeeez... you're right.
I was playing all day to somehow fix that problem, this looks ok now, as any other ideas I had was not working:
I was playing all day to somehow fix that problem, this looks ok now, as any other ideas I had was not working:
Code:
function onBeforeMailPrepare(&$mail,&$mailer,&$do){
if((($mail->data->order->order_status == 'shipped') || ($mail->data->order->order_status == 'confirmed'))){
$vendorClass = hikamarket::get('class.vendor');
$vendor = $vendorClass->get($mail->data->order->koltseghely);
//koltseghely field was an already created field for vendor_id
if ($vendor->vendor_email == $mail->dst_email){
$mail->dst_email = 'address@email.com';
}
}
}
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242696
by Jerome
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.
Replied by Jerome on topic Remove vendor address from email
Hi,
I have the impression that my tips are not read.
It will be the only submission of code in that thread ; please understand that custom development are not part of the support we are providing with our components.
Regards,
I have the impression that my tips are not read.
And I also told you to read the HikaMarket code in order to have a working base.Please note that the "$mail" object contains a lot of useful information ; like the mail name which is currently send
It will be the only submission of code in that thread ; please understand that custom development are not part of the support we are providing with our components.
Code:
public function onBeforeMailPrepare(&$mail, &$mailer, &$do) {
$mail_name = $mail->mail_name;
if(isset($mail->hikamarket) && !empty($mail->hikamarket))
$mail_name = 'market.' . $mail_name;
if($mail_name != 'market.order_status_notification' || empty($mail->data->order_vendor_id))
return;
$mail->dst_email = 'address@email.com';
$mail->dst_name = 'destination name";
}
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.
- pepecortez
-
Topic Author
- Offline
Less
More
- Posts: 171
- Thank you received: 9
10 years 3 months ago #242743
by pepecortez
Replied by pepecortez on topic Remove vendor address from email
Jerome, understood, I really appreciate your patience and help!
I've tried a lot ways you referenced in your earlier posts, but with no luck, so I had to try something that worked with my noob PHP skills.
Thank you again!
I've tried a lot ways you referenced in your earlier posts, but with no luck, so I had to try something that worked with my noob PHP skills.
Thank you again!
Please Log in or Create an account to join the conversation.
Moderators: Obsidev
Time to create page: 0.227 seconds