Jump to content



Photo
- - - - -

Order confirmation email - Company logo

html email order confirmation logo

This topic has been archived. This means that you cannot reply to this topic.
9 replies to this topic

#1   AndrewRavenwood

AndrewRavenwood
  • Members
  • 54 posts

Posted 03 July 2012 - 10:47

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?

#2   dailce

dailce
  • Members
  • 519 posts

Posted 03 July 2012 - 13:44

Try http://addons.oscommerce.com/info/8120 works great, you can create email templates with your logo etc...

#3   AndrewRavenwood

AndrewRavenwood
  • Members
  • 54 posts

Posted 03 July 2012 - 14:44

@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 /biggrin.png' class='bbc_emoticon' alt=':D' />

Edited by AndrewRavenwood, 03 July 2012 - 14:44.


#4   npn2531

npn2531
  • Members
  • 1,135 posts

Posted 03 July 2012 - 15:29

  $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.

Edited by npn2531, 03 July 2012 - 15:32.


#5   AndrewRavenwood

AndrewRavenwood
  • Members
  • 54 posts

Posted 03 July 2012 - 15:53

@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.

#6   npn2531

npn2531
  • Members
  • 1,135 posts

Posted 03 July 2012 - 16:21

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://forums.oscomm...mail-extra-brs/

#7   OSC-Sevilla

OSC-Sevilla
  • Members
  • 391 posts

Posted 04 July 2012 - 07:36

  $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
OSC 2.3.1
INSTALLED:Document Manager / Monthly Sales and Tax Returns / Batch Print Invoices / Ultimate HTML EMAILs / AJAX Attribute Manager / OSC PDF Catalog / Move Bookmarks / Sort Order / Easy Populate / Sales Reports / Low Stock Report / Admin: Model # on Category / Product Administration Screen / Mini images in admin / SLiCK reCaptcha / Google + / Beautiful Breadcrumbs / 2.3.1 - Banner Language Mod / ADD New Page / EASY MAP (google) v.3.0 / Who's Online Enhancement for 2.3.1 / Admin Notes / scrambled order number / remove_unused_images / Quantity Select / Unit Weight / Product Specifions (filter results) / AJAX Product Attributes/ Attribute Codes/ Date & Order No. to Invoice/ O.P.I. 2.0 / Attribute Images / Manual Order Editor / Attributes Clone / Order Editor / Create Order / Company VAT No. / Add customer/  CKEditor 2.3.1 / Page Manager / Default images via admin / Percentage Shipping Price / QTPro / Scroll to Top / PDF Invoice / Featured Products / Product Listing Enhancements / AutoBackups /  Ultimate SEO URLS 5 Pro / Kiss Tags/ ..Custom Admin Mods /

#8   AndrewRavenwood

AndrewRavenwood
  • Members
  • 54 posts

Posted 10 July 2012 - 10:57

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.
  • 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>');
  • in includes/modules/payments/paypal_standard.php added
    $email_order = EMAIL_HTML_HEAD; -- at line 502
  • 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 /smile.png' class='bbc_emoticon' alt=':)' />

#9   omadegbo

omadegbo
  • Members
  • 3 posts

Posted 18 September 2012 - 23:50

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?

#10   omadegbo

omadegbo
  • Members
  • 3 posts

Posted 19 September 2012 - 22:23

Bump