Jump to content

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

How Do I Send A Custom Email Tpl? Rate Topic   - - - - -

 
  • bebopboy
  • Advanced Member
  • Trial users
  • Join Date: 04-Feb 20
  • 72 posts

Posted 02 June 2020 - 01:38 AM #1

I want to send an email to the vendor right after they apply just to confirm that their application has been received.

 

From the original code and from the Event Notifications documentation, I know I should use Tygh::$app['mailer'], there are some parameters that I'm not quite sure what info to put in.

This is the default cs cart code that notifies the admin of a new vendor application:

        $mailer->send(array(
            'to' => 'default_company_users_department',
            'from' => 'default_company_users_department',
            'data' => array(
                'company_id' => $company_id,
                'company' => $data,
                'company_update_url' => fn_url('companies.update?company_id=' . $company_id, 'A', 'http')
            ),
            'template_code' => 'apply_for_vendor_notification',
            'tpl' => 'companies/apply_for_vendor_notification.tpl', // this parameter is obsolete and is used for back compatibility
        ), 'A', Registry::get('settings.Appearance.backend_default_language'));

My code, which goes right after that looks like this:

	$mailer->send(array(
            'to' => $data[email],
            'from' => 'default_company_users_department',
            'data' => array(
                'company_id' => $company_id,
                'company' => $data,
            ),
            'template_code' => 'application_notification',
            'tpl' => 'companies/application_notification.tpl', // this parameter is obsolete and is used for back compatibility
        ), 'C', Registry::get('settings.Appearance.backend_default_language'));

application_notification.tpl being the custom tpl file I made. But it's getting an error and not loading the tpl file. It's stored in /mail/templates/companies in the frontend design folder.

 

I also changed the AREA parameter to 'C' instead of 'A', I'm not sure if that does anything. I'm using the old email template system by the way. Is the 'tpl' parameter supposed to be absolute path or relative to somewhere?



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

Posted 02 June 2020 - 05:33 AM #2

Remove the template_code  parameter. In this case the system will not search template from database and will use file system

 

design/themes/responsive/mail/templates/companies/application_notification.tpl


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 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)