Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order confirmation email - Company logo


AndrewRavenwood

Recommended Posts

Hi all,

 

I was pretty sure that this one would be an easy win, but it seems as though it's not quite as straight forward as I had thought.

 

When the customer receives an email confirmation of their order I thought that it would be a nice touch of professionalism to have that email contain the site logo, seems an obvious enough request!

 

So I tracked down the php file that concatenates the email and adapted it thus:-

 

$email_order = '<a href="siteHref"><img src="logoHref' /></a>';

$email_order .= STORE_NAME . "\n" .

 

The function tep_mail() apparently allows the variable $email_text to contain HTML entities, so I assumed that this would just work. However it does not!

 

I googled this and found a few questions on a few message boards going back 4-5 years, but no answers. I also note that there is at least one contribution that was maintained up until V2.2 of OSCom but I don't really want to implement something like this at this stage in the game.

 

Probably should mention that the store is set to send out HTML emails via the admin panel and I've successfully produced a "welcome to the store" html email.

 

I'm interested in discovering if anyone has managed to achieve the addition of a company logo on this particular email in the past?

Link to comment
Share on other sites

@@dailce Yeah that's the contribution that I found. I'm put off by the fact that it's only been maintained up until v2.2 and the fact that at this stage in the game I don't want to be adding more code to the mix when all I think that I should need to do is "hack" a file elsewhere :D

Link to comment
Share on other sites

 $email_order .=  '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'logo.png').'</a>';

 

This should add the logo image (your logo is most likely named something other than logo.png, or use the OSCommerce variable for this) to the html string you have identified that builds the email. It should also make it linkable to your home page.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

@@npn2531 This solution is the same as the one that I tried albeit properly constructed instead of the hard-coded approach that I tried.

 

I notice that when viewing the source in the email that is produced by the system, the only html written are the ubiquitous <br> tags! Everything else has been stripped out including all html that I added to $email_order.

Link to comment
Share on other sites

check admin>configuration>email options> and make sure 'Use MIME HTML when sending Emails' is set to 'true'. The ubiquitous <br> tags is something else. The program translates every line break on your web editor as a <br/>. Look here for the fix:

http://www.oscommerce.com/forums/topic/382723-help-with-newsletter-and-send-mail-extra-brs/

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

 $email_order .=  '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'logo.png').'</a>';

 

This should add the logo image (your logo is most likely named something other than logo.png, or use the OSCommerce variable for this) to the html string you have identified that builds the email. It should also make it linkable to your home page.

 

 

you will need too change this part in includes/functions/general.php

 

// Build the text version

$text = strip_tags($email_text);

if (EMAIL_USE_HTML == 'true') {

$message->add_html($email_text, $text, DIR_FS_CATALOG . DIR_WS_IMAGES);

} else {

$message->add_text($text);

}

 

 

then it will work!

 

Do the same in ADMIN/includes/functions/general.php for admin emails

Link to comment
Share on other sites

Sorry about abandoning this thread for a while without reporting on whether any of the solutions given worked for me. I had to drop this project for a few days.

 

Anyway.

 

@@OSC-Sevilla Your solution didn't work for me but I was convinced that it should have done so I did some more 'investigating' on how OSCommerce works and to an extent I accept the charge of "user error" as I was making my changes in checkout_process.php.

 

I have discovered that the actual payment module (In my case paypal) writes out the confirmation email and that this document (paypal_standard.php) is where I should have originally made my changes - Which of course leaves me to wonder why checkout_process.php also concocts an email?

 

So for Googlers this is how I eventually added the store logo and other HTML to the confirmation email.

  1. adapted includes/languages/english.php to include the following:
    define('EMAIL_HTML_HEAD', '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'logo.png').'</a>');
  2. in includes/modules/payments/paypal_standard.php added
    $email_order = EMAIL_HTML_HEAD; -- at line 502
  3. Ensured that the next line looked like this
    $email_order .= STORE_NAME . "\n" .

Whenever the code creates an email I can add my new "EMAIL_HTML_HEAD" string to give a uniform look to the emails.

 

@@npn2531 I'm going to look into your suggestion as the <br> tags do tend to bug me :)

Link to comment
Share on other sites

  • 2 months later...

I have followed the directions here and my store logo is not displayed in the confirmation email. Here is my code sample:

 

// checkout_process in ..language/english/

 

define('EMAIL_HTML_HEAD', tep_image(DIR_WS_IMAGES . 'store_logo.png'));

 

 

//checkout_process in root

 

$email_order = EMAIL_HTML_HEAD . "\n" .

 

// functions.php

 

$text = strip_tags($email_text);

if (EMAIL_USE_HTML == 'true') {

$message->add_html($email_text, $text, DIR_WS_CATALOG . DIR_WS_IMAGES);

 

what have I missed please?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...