Jump to content

Display product image in Send to Friend email


Recommended Posts

Hi guys, (Using PS 1.5.4.1. and Send to Friend v1.2)

 

I'm really hoping someone can tell me how to display the product image within the email sent by the "Send to Friend:" module. Anyone? Anyone? :) Not having much luck finding a thread for this by searching the forum or Google... Just doesn't seem like it should be that hard.

 

 

best regards, "K"

Edited by KSteele (see edit history)
Link to comment
Share on other sites

  • 2 years later...

Hello,

 

I needed to add the image and I have found this post...

 

I will give you my solution :

 

Find the file ./modules/sendtoafriend/sendtoafriend_ajax.php

 

Then the Email generation part... You have 3 items : $product - $productLink and $customer, the idea is to add another item the Image link.

 

In your email you will be able to use {product_image_link} so you can write something like <img src="{product_image_link}" />

 

Good luck !

 

(This solution works with Prestshop 1.6 and sendtoafriend 1.8.0)

/* Email generation */
		$product = new Product((int)$id_product, false, $module->context->language->id);
		$productLink = $module->context->link->getProductLink($product);
		$customer = $module->context->cookie->customer_firstname ? $module->context->cookie->customer_firstname.' '.$module->context->cookie->customer_lastname : $module->l('A friend', 'sendtoafriend_ajax');
		
		$sqlIDimage = '	SELECT `'._DB_PREFIX_.'image`.`id_image`
											FROM `'._DB_PREFIX_.'image`
											WHERE `'._DB_PREFIX_.'image`.`cover` = 1
											AND `'._DB_PREFIX_.'image`.`id_product` = '.$id_product.'
										';
		
		$IDimage = Db::getInstance()->getValue($sqlIDimage);
		$URLimage = _PS_BASE_URL_.'/'.$IDimage.'-home_default/produit-hoptoys.jpg';

		$templateVars = array(
			'{product}' => $product->name,
			'{product_link}' => $productLink,
			'{customer}' => $customer,
			'{product_image_link}' => $URLimage,
			'{name}' => Tools::safeOutput($friendName)
		);
Edited by Regaton (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Hi

 

I try it but it dosesn't send the image

This is the code when I chek the HTML code from the email:

<img src="https://ci6.googleusercontent.com/proxy/Jk8X0ckc7fPhXN8LBUwnGl_zxlFDwpalNq0oYShj7BGBcEzJAoJ7ZwKsj5K9M3azyKITFBTPqeyUIee3VUXFkcPuiQrWsJkqZVJ2-z_U=s0-d-e1-ft#http://www.mbtee.com/26-home_default/produit-hoptoys.jpg" alt="{image_legend}" class="CToWUd">

How can I fix it?

 

Thanks

Link to comment
Share on other sites

×
×
  • Create New...