Jump to content

Adding/Embedding extra images into customer notification emails 1.5.4.1


Recommended Posts

Dear friends,

 

how is it possible for me to add/embed inside the email template in the form of variables like {shop_logo} an image with a link.

What i want to do is simply add a facebook image with link to our page in facebook saying Like us also in facebook.

Or a youtube image saying find us also in Youtube.

 

The image to be embeded though inside the email. (of course after i upload it manually somewhere in the website folders).

 

Where those variables in 1.5.4.1 are defined?

 

Can anyone share some light on this?

 

Thank you

Nikos

Link to comment
Share on other sites

Well, i find the answer myself and it is like this:

 

Go to Classes folder and find the Mail.php file

Make of course somewhere a backup of this file.

 

Open it and go around line 249 where it says:

            if (isset($logo))
                $template_vars['{shop_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($logo), null, ImageManager::getMimeTypeByExtension($logo)));

 

bellow this you can add freely a code like this (the example is to be able to add a facebook logo image inside the emails that go to the customer for the order preparation or the order confirmation)

 

// facebook logo addition            
            $fb_logo = _PS_IMG_DIR_."/social/facebook.png";    
            $template_vars['{fb_url}'] = "http://www.facebook.com/yourfacebookaddresshere";           
            $template_vars['{fb_logo}'] = $message->attach(new Swift_Message_EmbeddedFile(new Swift_File($fb_logo), null, ImageManager::getMimeTypeByExtension($fb_logo)));

 

 

/social/facebook.png

is a folder that i created inside the img folder from the website route and i added an image called facebook.png - you can create whatever you want, i used this because easily exists the _PS_IMG_DIR_ which is actually this img folder from the website route.

 

 

after you do this modification upload the file back to your site.

 

then all you have to do is to go in the preparation.html (from the mails folder of the website route) of your language and paste wherever you want a code like this:

 

               <a href="{fb_url}" title="Visit us on Facebook"><img alt="Facebook" src="{fb_logo}" style="border:none;" ></a>

 

when customer receives the email, he will see embeded the image of facebook or whatever else you want to put there that is actually also a link.

 

I hope i helped a little bit.

  • Like 2
Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...