OpenCart Extension – Email Notification on Affiliate Registration


Till OpenCart version, we don’t get an email notification when an Affiliate signs up. This article describes a very simple process to create an extension that will enable sending email notification for each Affiliate signup to the store owner. I didn’t check the process with OpenCart version 1.5.6. But, it should be working.

While developing a site using OpenCart version, I found that on each new Affiliate signup, my client doesn’t get an email notification about the signup. Each time he has to login in the administration panel and check whether any new Affiliate has signed up or not. I started investigating the same and found that in the entire codebase of OpenCart, that’s missing. To resolve the issue, I cam up with the following simple vQMod extension.

The Code (XML):

  <id><![CDATA[Email Notification on Each Affilifate Signup  ]]></id>
  <author><![CDATA[AxeFinch (vqmod by axefinch)]]></author>
  <file name="catalog/controller/affiliate/register.php">
    <search position="after" index="1"><![CDATA[ $this->model_affiliate_affiliate->addAffiliate($this->request->post);]]></search>
    <add><![CDATA[$message ="<strong>You have a new affiliate waiting to be approved.</strong><br><br>"
                             .'<a href="">Login to review</a>';
                  $message .= '<br><br>';
                  $message .= '<strong>Name:</strong> ' . $this->request->post['firstname'] . ' ' . $this->request->post['lastname'];
                  $message .= '<br>';
                  $message .= '<strong>Email:</strong> ' . $this->request->post['email'];

                  $mail = new Mail();
                  $mail->protocol = $this->config->get('config_mail_protocol');
                  $mail->parameter = $this->config->get('config_mail_parameter');
                  $mail->hostname = $this->config->get('config_smtp_host');
                  $mail->username = $this->config->get('config_smtp_username');
                  $mail->password = $this->config->get('config_smtp_password');
                  $mail->port = $this->config->get('config_smtp_port');
                  $mail->timeout = $this->config->get('config_smtp_timeout');
                  $mail->setSubject("An Affiliate Account Has Been Requested");

How to deploy the code:

  1. You MUST have vQMod installed and enabled in your OpenCart installation
  2. Copy the above code
  3. Open a text editor and paste the code
  4. Change the and EMAIL_ADDRESS_TO_NOTIFY as per your requirement
  5. Save the file as an XML file. You can name it anything like affiliate_signup_notification.xml
  6. Upload the XML file in vqmoq/xml folder in your OpenCart installation
  7. That’s all.

I didn’t test it with the latest OpenCart version 1.5.6. Please let me know your findings and/or comments through the comments area below.

Happy coding :)


7 thoughts on “OpenCart Extension – Email Notification on Affiliate Registration

  1. This is rreally cool. Thanks for the code.
    I can use it in a couple of uses
    1) When an user review comes, send email to admin
    2) With some modificiation, send FedEx Shipping number to the customer

    Appreciate this.


I will be happy to answer your queries

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s