PDA

View Full Version : Adding Product Thumbnail to Order Confirmation Email



arpitbajpai
11-09-2011, 06:01 AM
Hi!

I know this should not be hard, but I'm not sure how to customize the Order Process email...


I just want to add product thumbnail images to the order confirmation emails;


Please advise.

Thanks
Arpit

Luxoria
11-25-2011, 02:37 PM
Here's a smash and grab code example how to begin to implement thumbnails in the confirmation email....

*This code is untested. Do not test on a live store!*

in checkout_process.php find around line 365....


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

And replace with....



//BOF - show thumb in order process email
//grab image URL and make image thumb HTML tag
$grab_product_image = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id ='" . $order->products[$i]['id'] . "'");
$product_image = tep_db_fetch_array($grab_product_image);
$image_tag = '<img src="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR . $product_image['products_image'] . addslashes($random_product['products_name']) .'" width="' . SMALL_IMAGE_WIDTH . '" height="' . SMALL_IMAGE_HEIGHT . '">';
//EOF - show thumb in order process email

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

//modified code for : show thumb in order process email
//add image thumb HTML tag
$products_ordered .= $image_tag . "\n" . $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['code'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

*This code is untested. Do not test on a live store!*

My dev server is not running or I would test it. If someone tests it out please report back. =)

*edit*

The code needs a check to see if the custom selected text emails and not HTML emails.

Luxoria
11-26-2011, 03:39 PM
I want to add I did not realize the Order Process email is also generated in ipn.php, paypal_standard.php, and a few more other locations. So you will need to modify those files as well.