X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Send order notification to multiple email addresses (https://forum.x-cart.com/showthread.php?t=65238)

Warwick 11-01-2012 12:37 AM

Send order notification to multiple email addresses
 
I must have overlooked this or misunderstood how to get this done.

Is it possible to let the shop send order notifications to multiple mail addresses (with X-Cart 4.2.x)?

At the moment only this (one address) is accepted, for example:
sales@myshop.com

I tried adding an extra address like this:
sales@myshop.com,anothermailaddress@theinternet.com
sales@myshop.com, anothermailaddress@theinternet.com

But this isn't accepted by the system i.e. resulting in an error message.

totaltec 11-01-2012 05:28 AM

Re: Send order notification to multiple email addresses
 
You can go in and modify the PHP to send to multiple addresses. It would probably be easier to just use your server and forward the email address to multiple parties. http://www.systemsabuse.com/2008/04/29/creating-a-single-forward-to-multiple-email-addresses-with-cpanel/

Warwick 11-01-2012 05:39 AM

Re: Send order notification to multiple email addresses
 
Thanks for the pointer, but unfortunately the cPanel solution is not available since this specific webshop is using its own (external) mail servers.
You have any idea what php file should be modified and how this can be done?

totaltec 11-01-2012 06:15 AM

Re: Send order notification to multiple email addresses
 
I would think that any mail server would allow forwarding. Well anyway, I believe that include/func/func.order.php would control sending the mail.

I see this around line 1438 in 4.4.X
Code:

if ($admin_notify) {

            // Notify orders department by email

            $mail_smarty->assign('show_order_details', 'Y');

            func_send_mail(
                $config['Company']['orders_department'],
                'mail/' . $prefix . 'order_notification_subj.tpl',
                'mail/order_notification_admin.tpl',
                $userinfo['email'],
                true,
                true
            );

            $mail_smarty->assign('show_order_details', '');


Warwick 11-01-2012 11:43 AM

Re: Send order notification to multiple email addresses
 
That mail server can forward of course but it should not, a bit difficult to explain why not. :)

I will take a look at the function php file, thanks again!

rogue 11-02-2012 04:26 AM

Re: Send order notification to multiple email addresses
 
I think that all you will need to change is the code that checks for a valid email address. This is the function func_email_validation_regexp which is in include/func/func.core.php. You need to add a comma to the allowed characters of the email address.

totaltec 11-02-2012 07:21 AM

Re: Send order notification to multiple email addresses
 
Quote:

Originally Posted by rogue
You need to add a comma to the allowed characters of the email address.

Nice and easy solution, I like it. Might want to verify though that this is only in the admin, seems like a problem if the comma was accepted throughout the site on all email fields.

PhilJ 12-01-2012 03:55 AM

Re: Send order notification to multiple email addresses
 
This SQL patch does the trick... (v4.4.x - v4.5.x)
Code:

REPLACE INTO xcart_config VALUES ('orders_department','Orders department email address','first@email.com,second@email.com','Company',330,'text','','','email');

The others available are...
Code:

REPLACE INTO xcart_config VALUES ('site_administrator','Site administrator email address','first@email.com,second@email.com','Company',310,'text','','','email');
REPLACE INTO xcart_config VALUES ('users_department','Users department email address','first@email.com,second@email.com','Company',320,'text','','','email');
REPLACE INTO xcart_config VALUES ('support_department','Help/Support department email address','first@email.com,second@email.com','Company',340,'text','','','email');


The caveat is that where emails are displayed elsewhere in your store, it will show both, so you may need to adjust / hard code the order invoice etc.

DanielleHoyt 09-23-2014 11:11 AM

Re: Send order notification to multiple email addresses
 
Hi PhilJ
I've tried your patch on 4.6.4 and it keeps giving me error.
I have tried every variation; adding a space between the commas, switching up the email addresses, changing "REPLACE" to "INSERT".
I even tried editing the "xcart_data.sql" file in SQL Server rather than uploading the patch through x-cart.

Please help, do you have any more information on this?

totaltec 09-23-2014 11:14 AM

Re: Send order notification to multiple email addresses
 
Danielle, it would be helpful if you could explain what the error message said.


All times are GMT -8. The time now is 07:47 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.