Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Bcc Order Department E-Mail Address For All Supplier Notifications? Rate Topic   - - - - -

 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 65 posts

Posted 20 January 2022 - 09:14 PM #1

Looking for a way to have all the supplier notifications Bcc'd to Order department e-mail address.
 
Looking through forums indicates that it should be possible but no easy fix for a newbie on CS-Cart.
 
​As many others have mentioned over the years, very surprised this is not implemented out of the box. In notifications area there really should be a way to select more than 1 receiver. 

osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • johnbol1
  • Never Re
  • Members
  • Join Date: 23-Feb 10
  • 5083 posts

Posted 21 January 2022 - 08:17 AM #2

Im not sure on multi vendor, but in standard cs cart you jast add more emails to the fields seperated by comma


4 14.1


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 65 posts

Posted 21 January 2022 - 01:51 PM #3

Im not sure on multi vendor, but in standard cs cart you jast add more emails to the fields seperated by comma

 

in suppliers add-on, when trying to add a second email address in the Contact Section with both a comma or semicolon you get a red error message

The email address in the E-mail field is invalid.

 

Running latest version of CS-Cart Ultimate 4.14.1.SP1

(That does work in the 
Company Settings for emails but there is still no way I can see to have the Supplier Notifications also sent to another emails address (ideally the company Orders dept.)


osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 22888 posts

Posted 21 January 2022 - 01:56 PM #4

I almost sure that it is required to extend the following schema to add bcc

 

app/addons/suppliers/schemas/notifications/events.post.php


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 65 posts

Posted 21 January 2022 - 02:10 PM #5

I almost sure that it is required to extend the following schema to add bcc

 

app/addons/suppliers/schemas/notifications/events.post.php

so in here?

$supplier_event = [
    'id'        => 'suppliers.order.supplier_notified',
    'group'     => 'orders',
    'name'      => [
        'template' => 'suppliers.event.order.supplier_notified.name',
        'params'   => [
            '[status]' => '',
        ],
    ],
    'data_provider' => [SuppliersDataProvider::class, 'factory'],
    'receivers' => [
        'S' => [
            MailTransport::getId() => MailMessageSchema::create([
                'area'            => 'A',
                'from'            => 'company_orders_department',
                'to'              => DataValue::create('supplier.data.email'),
                'reply_to'        => 'company_orders_department',
                'template_code'   => 'suppliers_notification',
                'legacy_template' => 'addons/suppliers/notification.tpl',
                'language_code'   => DataValue::create('lang_code', CART_LANGUAGE),
            ]),
        ],
    ],
];

would it work by just adding this below the 'to'?             
'bcc'        => 'company_orders_department',
 

osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 65 posts

Posted 21 January 2022 - 02:44 PM #6

no that does not work  as an easy edit, must be more to it  :-(


osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 22888 posts

Posted 24 January 2022 - 04:56 AM #7

In the code I see that the "bcc" parameter is supported

 

On what line did you place it? Have you cleared cache after these changes?


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 65 posts

Posted 26 January 2022 - 01:08 AM #8

I added it in like this

                'to'              => DataValue::create('supplier.data.email'),
                'bcc' => 'company_orders_department',
                'reply_to'        => 'company_orders_department',

cleared cache via admin and even deleting whole cache directory

did not work...


osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 22888 posts

Posted 26 January 2022 - 06:22 AM #9

After detailed examination, we found that the bcc is supported by mail sender, but not supported by the code which processes notification events schemas. Additional code changes are required here


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 1210     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 4025     CS-Cart + YOUPI      USD 1459      Multi-Vendor Ultimate       USD 7500 (6000)


 
  • thecigarhut
  • Advanced Member
  • Members
  • Join Date: 07-Dec 21
  • 65 posts

Posted 26 January 2022 - 12:39 PM #10

this thread "seems to point the way but as a CS-Cart newbie it is a bit beyond my scope here.

 

https://forum.cs-car...nd-notify-user/

 

Any further pointers or ideas?


osCommerce user since 2005 now upgrading to CS-Cart Ultimate.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 27 January 2022 - 11:57 PM #11

Here's a hook function you can use/modify to suit your needs:

function fn_[ADDON]_mailer_send_pre(&$mObj, &$transport, &$message, $area, $lang_code) {
  $params = $message->getData();
  $order_info = empty($params['order_info']) ? array() : $params['order_info'];
  $toAR = $message->getTo();
  $to = implode(',', array_keys($toAR));
 
  // If no $to OR no email in order_info OR 'email' does not contain $to
  // This should only BCC on order emails sent to customer
  if( empty($to) 
    || empty($order_info['email']) 
    || (strpos($order_info['email'], $to) === false)
  )
    return;
 
  // Set your conditions here.  I.e. has a parent_order_id, etc.
  if( $bcc = function_to_get_your_bcc_addresses() ) {  // Get the bcc address to use
  $_bcc = explode(',', $bcc);  // Split if mulitple
  foreach($_bcc as $addr) {
     if( !$addr )
      continue;
    $message->addBCC(trim($addr));
  }
  $params['Bcc'] = $bcc;
}
 

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.