Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding images to new account emails


Guest

Recommended Posts

Hi there,

 

I was wondering if someone could tell me how I could add an image (e.g. the banner for my store) to the top of the email that is received when someone signs up for a new account please?

 

 

Also, say if I wanted to add a thumb next to the items that have been ordered in a order confirmation email, would that work in a similar way, would it be easy to do?

 

Thank you in advance! miaow! :)

Link to comment
Share on other sites

Hi there,

 

I was wondering if someone could tell me how I could add an image (e.g. the banner for my store) to the top of the email that is received when someone signs up for a new account please?

Also, say if I wanted to add a thumb next to the items that have been ordered in a order confirmation email, would that work in a similar way, would it be easy to do?

 

Thank you in advance! miaow! :)

It would mean sending html emails to the customer. I can't get my sites to do this, but there must be an answer.

Link to comment
Share on other sites

It would mean sending html emails to the customer. I can't get my sites to do this, but there must be an answer.

 

post about html emails

 

I know, I have been reading your thread that I joined in on a few days ago :/ I'm afraid I can't help because I really do not know enough... my account emails seem to work fine as they currently have bold parts which show fine... I've just re-read all the replies, I may have got this wrong, but did you say that the email test you did, DID show bold text??? Because obviously this would mean it is working fine... o_O I hope you get the problem sorted soon, sorry I can't be of more help.

Link to comment
Share on other sites

post about html emails

 

I know, I have been reading your thread that I joined in on a few days ago :/ I'm afraid I can't help because I really do not know enough... my account emails seem to work fine as they currently have bold parts which show fine... I've just re-read all the replies, I may have got this wrong, but did you say that the email test you did, DID show bold text??? Because obviously this would mean it is working fine... o_O I hope you get the problem sorted soon, sorry I can't be of more help.

Yes, that part is working, BUT, the standard osc emails are still text. This means that it is possible to send html emails, but it does not happen.

I have tried several contribs, but the result is not what I wanted. In one, the store owner receives html the customer does not. They all rely on templates and massive changes to the files, some clash with other contribs, others need html editors, no wonder I am nearly bald!

Link to comment
Share on other sites

Yes, that part is working, BUT, the standard osc emails are still text. This means that it is possible to send html emails, but it does not happen.

I have tried several contribs, but the result is not what I wanted. In one, the store owner receives html the customer does not. They all rely on templates and massive changes to the files, some clash with other contribs, others need html editors, no wonder I am nearly bald!

 

Ahhhh! I see! So like, say, the order confirmation emails do not send in HTML??? Something I've not got round to changing the format of, but just did a little Bold test in the includes/languages/english/checkout_process.php and that worked fine on the order email :/ I guess this is the annoying thing with contribs is that they sometimes do not work together - did you say you checked that HTML sent on a fresh install and it was fine? Again, sorry I can't be of help, hope you don't pull any more hair out!!! o_O

Link to comment
Share on other sites

Ahhhh! I see! So like, say, the order confirmation emails do not send in HTML??? Something I've not got round to changing the format of, but just did a little Bold test in the includes/languages/english/checkout_process.php and that worked fine on the order email :/ I guess this is the annoying thing with contribs is that they sometimes do not work together - did you say you checked that HTML sent on a fresh install and it was fine? Again, sorry I can't be of help, hope you don't pull any more hair out!!! o_O

The fresh install worked only so far as the test email. The osc emails (create account, order update, checkout process) were just text.

Link to comment
Share on other sites

Hi Cat! :)

 

I've written programs that added pictures to emails before.

 

They were in written in PERL for a site I managed a few years ago.

 

I still have the source code at home (I'm at work now).

 

I'll look into it this afternoon/evening as I don't remember right now exactly how it's done.

 

So, I may be able to help with adding a store banner to the email.

 

The other part about thumbs for ordered items I don't think I can do, as it would involve pulling images from your database (it sounds like), and frankly I don't know squat about MYSQL.

:blush:

 

If someone hasn't posted solution for you by this afternoon, I'll look over my PERL programs and see what it might take to do the same in PHP to the osCommerce code.

 

I can't promise any results... Just that I'll look it over and see what I can do.

;)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Hi Cat! :)

 

......

 

If someone hasn't posted solution for you by this afternoon, I'll look over my PERL programs and see what it might take to do the same in PHP to the osCommerce code.

 

I can't promise any results... Just that I'll look it over and see what I can do.

;)

 

 

Hi :)

 

That would be super :) I guessed I would have to pull info from the database for the thumbs, but I guess that bit is not so important. But it would look loads better to have the banner for my store on the welcome email / order confirmation email. I understand the basic HTML tags for adding an image, but I just don't know where to put the information (i.e. which file) and also if I have to do any of that 'define' stuff! :blush: 3 years using oscomm and I still don't know what I'm talking about! eep! ;)

 

Thank you for your help :)

Link to comment
Share on other sites

PLEASE MAKE A BACKUP BEFORE MAKING ANY EDITS.

 

(see my signature rules... :D )

 

:blush:

 

In create_account.php find:

 

// build the message content
  $name = $firstname . ' ' . $lastname;

  if (ACCOUNT_GENDER == 'true') {
	 if ($gender == 'm') {
	   $email_text = sprintf(EMAIL_GREET_MR, $lastname);
	 } else {
	   $email_text = sprintf(EMAIL_GREET_MS, $lastname);
	 }
  } else {
	$email_text = sprintf(EMAIL_GREET_NONE, $firstname);
  }

 

Alter it to:

 

// build the message content

// added for image inclusion
 $img_code = '<center>\n';
 $img_code .= '<img src="http://www.yoursite.com/path_to_image/image_name" width="xxx" height="xxx" border="0">\n';
 $img_code .= '</center><br><br>\n';
// end of image inclusion addition

  $name = $firstname . ' ' . $lastname;

  if (ACCOUNT_GENDER == 'true') {
	 if ($gender == 'm') {
// "$img_code . " added for image inclusion
	   $email_text = $img_code . sprintf(EMAIL_GREET_MR, $lastname);
	 } else {
// "$img_code . " added for image inclusion
	   $email_text = $img_code . sprintf(EMAIL_GREET_MS, $lastname);
	 }
  } else {
// "$img_code . " added for image inclusion
	$email_text = $img_code . sprintf(EMAIL_GREET_NONE, $firstname);
  }

 

Be sure to change everything in here:

 

<img src="http://www.yoursite.com/path_to_image/image_name" width="xxx" height="xxx" border="0">

 

To reflect your URL, path to image, image name, and width and height parameters.

 

See if that works for you....

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

// build the message content

// added for image inclusion
 $img_code = '<center>\n';
 $img_code .= '<img src="http://www.yoursite.com/path_to_image/image_name" width="xxx" height="xxx" border="0">\n';
 $img_code .= '</center><br><br>\n';
// end of image inclusion addition

 

See if that works for you....

:)

 

 

That worked a treat! Thank you :) Only thing was I had to remove the three \n bits (shown above) as they were just showing as text next to the image :) Thank you again, my welcome emails look super now! Better than just boring plain text! I also added a link to the image so people can get back to the site easier:

 

$img_code .= '<a href="http://www.mydomain.com/store" target="_blank"><img src="http://www.mydomain.com/email.gif" width="580" height="80" border="0"></a>';

 

Now, just to annoy you a bit, do you know how I could do the same (adding banner image) to the top of my order confirmation emails??? :blink:

:)

Link to comment
Share on other sites

I'm glad it worked.

:rolleyes:

 

After looking at my PERL code yesterday, I came to the conclusion that building an HTML email is more or less like building an HTML web page.

 

Obviously, you did, too, since you went one step farther and added a link as well as the picture.

:thumbsup:

 

It had been a few years since I'd done this and, me and my pea-brain didn't remember...

:lol:

 

I'm at that stage that, in order to remember something, I have to forget something else to make room, O me of limited mental capacity...

:wacko:

 

I'm not sure about the deal with the "\n"... It's supposed ot translate to a "newline".

:unsure:

 

I think it's because it was encased in single tick marks, instead of quotes...

:blink:

 

But I digress.............................

 

I can't say that I'm 100 percent sure exactly which osC module sends the order confirmation email.

 

Following osC code (anyone elses's code for that matter) can be like a scavenger hunt..

:lol:

 

But, I believe I've found the correct module.

 

MAKE A BACKUP BEFORE MAKING ANY EDITS.

 

In "checkout_process.php" find:

 

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 

Alter to:

 

// lets start with the email confirmation

// added for image inclusion
 $img_code = '<center>';
 $img_code .= '<img src="http://www.yoursite.com/path_to_image/image_name" width="xxx" height="xxx" border="0">';
 $img_code .= '</center><br><br>';
// end of image inclusion addition

// "$img_code . " added for image inclusion
 $email_order = $img_code . STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 

I just posted what I did yesterday with regard to "$img_code". You've modified it slightly, so you should just be able to copy/paste what you set it to in the other PHP module and it should work.

 

Like I said, I believe this is the "order confirmation module".

 

If it isn't, we'll just have to search elsewhere.

:)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

That worked a treat! Thank you :) Only thing was I had to remove the three \n bits (shown above) as they were just showing as text next to the image :) Thank you again, my welcome emails look super now! Better than just boring plain text! I also added a link to the image so people can get back to the site easier:

 

$img_code .= '<a href="http://www.mydomain.com/store" target="_blank"><img src="http://www.mydomain.com/email.gif" width="580" height="80" border="0"></a>';

 

Now, just to annoy you a bit, do you know how I could do the same (adding banner image) to the top of my order confirmation emails??? :blink:

:)

I ended up with the whole email as a hyperlink back to the shop. Is this hows yours was?

Link to comment
Share on other sites

Did you change the other 3 lines?

:unsure:

 

I added "$img_code . " just before the "sprintf" 3 places.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I'm at that stage that, in order to remember something, I have to forget something else to make room, O me of limited mental capacity...

:wacko:

Quite like Homer Simpson, eh??? :)

 

 

Thanks again for this, now I've seen two examples of how the code is used it makes a lot more sense! The first time, I understood this bit:

// added for image inclusion
 $img_code = '<center>\n';
 $img_code .= '<img src="http://www.yoursite.com/path_to_image/image_name" width="xxx" height="xxx" border="0">\n';
 $img_code .= '</center><br><br>\n';
// end of image inclusion addition

 

But couldn't work out why $img_code was interspersed within the code below it, now I have woken up a bit I can see why! :-"

 

I'm going to try out the new info you gave me in a bit, I'll let you know how it goes :) :) :)

Link to comment
Share on other sites

I ended up with the whole email as a hyperlink back to the shop. Is this hows yours was?

 

Nope, just the image is a link :| With my limited experience, the main problem I would have thought would be that you didn't include the last end link tag </a> ...

Link to comment
Share on other sites

Nope, just the image is a link :| With my limited experience, the main problem I would have thought would be that you didn't include the last end link tag </a> ...

Fantastic, you are a genius.

Link to comment
Share on other sites

Fantastic, you are a genius.

 

.................

 

sometimes it's hard to see the wood for the trees. I'll just keep my gob shut shall I?

Link to comment
Share on other sites

MAKE A BACKUP BEFORE MAKING ANY EDITS.

 

In "checkout_process.php" find:

 

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 

Alter to:

 

// lets start with the email confirmation

// added for image inclusion
 $img_code = '<center>';
 $img_code .= '<img src="http://www.yoursite.com/path_to_image/image_name" width="xxx" height="xxx" border="0">';
 $img_code .= '</center><br><br>';
// end of image inclusion addition

// "$img_code . " added for image inclusion
 $email_order = $img_code . STORE_NAME . "\n" . 
			 EMAIL_SEPARATOR . "\n" . 
			 EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
			 EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .
			 EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 

It's all done and dusted now! Yay! The emails really do look so much better, just with a few colour changes to the text and an image, makes all the difference :)

 

Thanks again for your help :) :) :)

Link to comment
Share on other sites

It's all done and dusted now! Yay! The emails really do look so much better, just with a few colour changes to the text and an image, makes all the difference :)

 

Thanks again for your help :) :) :)

Hi Cat

 

How did you control the colours?

 

Thank you too Germ. You have been absolutlely great for this.

Link to comment
Share on other sites

Hi Cat

 

How did you control the colours?

 

Thank you too Germ. You have been absolutlely great for this.

 

Hi Leslie,

 

I have to say, I genuinely thought you were being sarcastic before when you commented on my reply about the </a> tag! :blink:

 

To format the text that appears in the order confirmation email, and the new account email, you need to edit:

 

For order email I edited : catalogue/includes/languages/english/checkout_process.php

 

So, my checkout_process.php currently looks like this:

 

*/

define('EMAIL_TEXT_SUBJECT', 'Your Order at My Store');
define('EMAIL_TEXT_ORDER_NUMBER', '<font color="#34afce"><b>Order Number:</b></font>');
define('EMAIL_TEXT_INVOICE_URL', '<font color="#34afce">Detailed Invoice:</font>');
define('EMAIL_TEXT_DATE_ORDERED', '<font color="#34afce">Date Ordered:</font>');
define('EMAIL_TEXT_PRODUCTS', '<font color="#34afce"><b>Products</b></font>');
define('EMAIL_TEXT_SUBTOTAL', '<font color="#f00b6d">Sub-Total:</font>');
define('EMAIL_TEXT_TAX', 'Tax:		');
define('EMAIL_TEXT_SHIPPING', '<font color="#f00b6d">Shipping: </font>');
define('EMAIL_TEXT_TOTAL', '<font color="#f00b6d"><b>Total:	</b></font>');
define('EMAIL_TEXT_DELIVERY_ADDRESS', '<font color="#34afce"><b>Delivery Address</b></font>');
define('EMAIL_TEXT_BILLING_ADDRESS', '<font color="#34afce"><b>Billing Address</b></font>');
define('EMAIL_TEXT_PAYMENT_METHOD', '<font color="#34afce"><b>Payment Method</b></font>');

define('EMAIL_SEPARATOR', '<font color="#f00b6d"><b>------------------------------------------------------</b></font>');
define('TEXT_EMAIL_VIA', 'via');
?>

 

Where you see #34afce - this indicates the colour, and as you can see I have used bold in some places, and each colour change and bold is finished with an end tag. You can copy this if you really want, but everything will come out Hot Pink and Baby Blue, so not sure if you want that!!! :blink:

 

 

And the file I had to edit for the new account email was catalogue/includes/languages/english/create_account.php

 

 

Hope this helps :) :) :)

Link to comment
Share on other sites

Hi Leslie,

 

I have to say, I genuinely thought you were being sarcastic before when you commented on my reply about the </a> tag! :blink:

 

To format the text that appears in the order confirmation email, and the new account email, you need to edit:

 

For order email I edited : catalogue/includes/languages/english/checkout_process.php

 

So, my checkout_process.php currently looks like this:

 

*/

define('EMAIL_TEXT_SUBJECT', 'Your Order at My Store');
define('EMAIL_TEXT_ORDER_NUMBER', '<font color="#34afce"><b>Order Number:</b></font>');
define('EMAIL_TEXT_INVOICE_URL', '<font color="#34afce">Detailed Invoice:</font>');
define('EMAIL_TEXT_DATE_ORDERED', '<font color="#34afce">Date Ordered:</font>');
define('EMAIL_TEXT_PRODUCTS', '<font color="#34afce"><b>Products</b></font>');
define('EMAIL_TEXT_SUBTOTAL', '<font color="#f00b6d">Sub-Total:</font>');
define('EMAIL_TEXT_TAX', 'Tax:		');
define('EMAIL_TEXT_SHIPPING', '<font color="#f00b6d">Shipping: </font>');
define('EMAIL_TEXT_TOTAL', '<font color="#f00b6d"><b>Total:	</b></font>');
define('EMAIL_TEXT_DELIVERY_ADDRESS', '<font color="#34afce"><b>Delivery Address</b></font>');
define('EMAIL_TEXT_BILLING_ADDRESS', '<font color="#34afce"><b>Billing Address</b></font>');
define('EMAIL_TEXT_PAYMENT_METHOD', '<font color="#34afce"><b>Payment Method</b></font>');

define('EMAIL_SEPARATOR', '<font color="#f00b6d"><b>------------------------------------------------------</b></font>');
define('TEXT_EMAIL_VIA', 'via');
?>

 

Where you see #34afce - this indicates the colour, and as you can see I have used bold in some places, and each colour change and bold is finished with an end tag. You can copy this if you really want, but everything will come out Hot Pink and Baby Blue, so not sure if you want that!!! :blink:

And the file I had to edit for the new account email was catalogue/includes/languages/english/create_account.php

Hope this helps :) :) :)

Thank you Cat.

No I wasn't being sarcastic, and I hope I never am on line. I completely missed it and was going around in circles.

Your solution is excellent, I was thinking more of a css file.

Thanks again to you and Germ, I don't often get help by asking questions on the forum.

Link to comment
Share on other sites

Awww... Shucks...

 

I just enjoy helping where I can.

:blush:

 

I used to do a lot of posting on a free Spyware removal forum. I've helped people get viruses and "spyware" off their machines for close to 4 years now. If you ever need help with that, I think I could probably assist.

 

I'm just one of those people that need "mental stimulation".

:blink:

 

Go figure....

 

Trashing viruses, debugging someone elses problems, and making minor edits to someone elses code seems to fill that need.

:D

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Hrmm... when I did HTML with my emails I wrote a PHP file that basically generated a large block of HTML. It allows for a bit of customization (banners, image borders, a bit of CSS, etc.)... I do believe it works correctly; it's never messed up for me (AFTER I finished tweaking it >__>) and none of our customers have ever complained... but, alas, I can't guarantee that. I would THINK that doing something like that would allow for the image thumbnails you want, Cat, but I would have to look at the code to be certain and I can already tell you that it's gonna be a bit of a messy process. If I get some free time around here (trying to build two websites from scratch, yay!) I'll take a look into it for you... Anyways, yeah... if you guys want more control/customization that HTML-block-writer-thing works pretty well for me.

 

-Ian

Ian Osos

Web Developer

Link to comment
Share on other sites

Hrmm... when I did HTML with my emails I wrote a PHP file that basically generated a large block of HTML. It allows for a bit of customization (banners, image borders, a bit of CSS, etc.)... I do believe it works correctly; it's never messed up for me (AFTER I finished tweaking it >__>) and none of our customers have ever complained... but, alas, I can't guarantee that. I would THINK that doing something like that would allow for the image thumbnails you want, Cat, but I would have to look at the code to be certain and I can already tell you that it's gonna be a bit of a messy process. If I get some free time around here (trying to build two websites from scratch, yay!) I'll take a look into it for you... Anyways, yeah... if you guys want more control/customization that HTML-block-writer-thing works pretty well for me.

 

-Ian

That would be great.

Link to comment
Share on other sites

Ok... here's the deal; I haven't tested this so I don't know if it will work. I kind of just threw something together, and assuming there aren't any typos or anything it SHOULD work but I can't promise that. That being the case, here's your fair warning: BACKUP, BACKUP, PLEASE BACKUP. Implement these code changes and then do a test order or something to make sure it's going ok... if it's not going ok... well... let me know and I'll mess around with it a bit eventually.

 

In checkout_process.php

Find:

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

 

And replace it with:

$eimagequery = 'SELECT products_image FROM products WHERE products_id = "' . $order->products[$i]['id'] . '"';
$eimageresult = mysql_query($eimagequery);
$eimage = mysql_fetch_array($eimageresult, MYSQL_ASSOC);

$products_ordered .= '<img src="' . DIR_WS_IMAGES . $eimage['products_image'] .'" alt="' . $order->products[$i]['name'] .'" title="' . $order->products[$i]['name'] .'" width="PICK A SIZE FOR YOUR THUMBNAILS" />' . $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

unset($eimagequery);
unset($eimageresult);
unset($eimage);

Don't forget to replace "PICK A SIZE FOR YOUR THUMBNAILS" with however wide you want these thumbnails.

 

That should stick a thumbnail directly to the left of each product... SHOULD. Whether or not this works, I'm almost certain (99% certain, for that matter) that it's possible to add thumbnails to your emails. Let me know what happens, and if something goes wrong I'll try to work with the code and fix it. Best of luck!

 

-Ian

Ian Osos

Web Developer

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...