Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding images to new account emails


Guest

Recommended Posts

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

 

Hi Ian!

 

I've just tried this out, and the emails send fine but the image does not show. The placeholder is there, but just shows a blue square with a question mark in it (or I guess a square with a red cross if using a pc)... :huh:

 

I've checked the email in my mail prog and through webmail, then viewed the image separately, and it seems to be linking to the local address rather than linking from the site - does that make sense? o_O

EG Like this:

 

http://webmail.mydomain.com/mail/images/itempicture.jpg

 

:)

Link to comment
Share on other sites

Oh, you know what... I forgot that my configure.php file is set up just a bit differently. My mistake...

 

In that new block of code change:

<img src="' . DIR_WS_IMAGES . $eimage['products_image'] .'"

 

To:

<img src="' . HTTP_SERVER . DIR_WS_IMAGES . $eimage['products_image'] .'"

 

There... that should do it. So sorry.

 

-Ian

Ian Osos

Web Developer

Link to comment
Share on other sites

Crap... no wait... that's wrong too. Sorry. Here, THIS code should work. I'm just gonna start from the beginning.

 

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";

 

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="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . 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.

 

There... THAT should do it. Sorry for the confusion. If you have any more problems, let me know.

 

-Ian

Ian Osos

Web Developer

Link to comment
Share on other sites

You know what... that's probably still wrong. I've changed our configure.php so many times in so many different ways that I can't keep track of them all anymore. If the solution I just posted doesn't work, try this one:

 

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="http://www.MYWEBSITE.com/catalog/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 www.MYWEBSITE.com with your website.

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

 

Wooooo... sorry for the confusion/multiposts/everything... let me know if you have any trouble.

 

-Ian

Ian Osos

Web Developer

Link to comment
Share on other sites

Hi Ian! Just tried this out, and it works brilliantly! Looks really great :) Thanks for the info, very helpful :)

 

This is just for anyone reading up on this:

 

When I was testing this additional code, I was making test orders and paying via Personal Cheque - now, I've received a few orders over the past few days where people have paid via PayPal, and I've noticed the banner for my store, and the item thumbs are not showing, and I have realised that I probably have to add the same code to the includes>modules>payment php files - for me this will be in the paypal_ipn.php file as I have installed the PayPal IPN contrib.

 

Not sorted it to see if it works just yet, but will leave an update. :)

Link to comment
Share on other sites

I have tried adding the below code to my site on the catalog/checkout_process.php file but the email is still not showing the site image does anyone have any ideas?

 

// added for image inclusion

$img_code = '<center>';

$img_code .= '<img src="https://www.parakeetprint.co.uk/images/m01.jpg" width="400" height="103" 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";

Link to comment
Share on other sites

I have tried adding the below code to my site on the catalog/checkout_process.php file but the email is still not showing the site image does anyone have any ideas?

 

// added for image inclusion

$img_code = '<center>';

$img_code .= '<img src="https://www.parakeetprint.co.uk/images/m01.jpg" width="400" height="103" 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";

 

 

Hiya, I don't know anything about secure servers, but perhaps taking the "s" out of the https:// of the image url will work??? Worth a try :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...