Jump to content

Pb variable pour mail avis clients


Recommended Posts

Bonjour,

je pauffine mes mail, et actuellement j'utilise un modue qui envoie un mail aux client suivant un statut de commande.

dans ce mail il y a la photo du produit ainsi que le nom du produit (+lien direct pour l'avis).

 

Je ne veux plus utiliser ce module, car j'ai des changement automatique de statut que ce module ne gère pas.

 

j'ai donc testé en envoyant directement le mail depuis le statut de commande, cela fonctionne, mais la variable ne s'affiche pas.

 

en effet elle reprend la variable product.du fichier TPL order_conf_product_list

 

ma question donc, comment avoir le même affichage dans ce mail sans utiliser le module?

 

j'ai ce code qui est dans un fichier php du module

<?php

			foreach($this->getProducts($order) as $review_product)

			{

				$product = new Product((int)$review_product['id_product'], true, (int)$id_lang);

				$image = Image::getCover((int)$review_product['id_product']);

				$product_link = Context::getContext()->link-> getProductLink((int)$review_product['id_product'], $product->link_rewrite, $product->category, $product->ean13, $id_lang, (int)$order->id_shop, 0, true);

				$image_url =  Context::getContext()->link->getImageLink($product->link_rewrite, $image['id_image'], 'small_default');

				$file_attachment .= array('content' => $image_url, 'name' => $product->name, 'mime' => 'image/jpg');

				

				$products_list .=

					'<table><tr style="background-color: '.($key % 2 ? '#FFFFFF' : '#FFFFFF').';">

						<td style="padding: 0.6em 0.4em;width: 25%;text-align: center;"><a href="'.$product_link.'#post_review" title="'.$this->l('Cliquez pour donner votre avis').'"><img src="'.$image_url.'" title="'.$product->name.'" alt="'.$product->name.'" /></a></td>

						<td style="padding: 0.6em 0.4em;width: 75%;text-align: left;"><strong><a href="'.$product_link.'#post_review" title="'.$this->l('Cliquez pour donner votre avis').'">'.$product->name.'</a></strong></td>

					</tr></table>';

			}



			$data = array(

			    '{firstname}' => $this->context->customer->firstname,

			    '{lastname}' => $this->context->customer->lastname,

			    '{products}' => $this->formatProductForEmail($products_list)

		    );



		    if (Validate::isEmail($this->context->customer->email))

		        Mail::Send(

		            (int)$id_lang, 'post_review',

			        Mail::l('Voulez-vous évaluer votre transaction', (int)$id_lang),

			        $data, $this->context->customer->email,

			        $this->context->customer->firstname.' '.$this->context->customer->lastname,

			        $file_attachment, null, null, null, dirname(__FILE__).'/mails/', false, (int)$order->id_shop

		        );

		}

    }



	public function formatProductForEmail($content)

	{

		return $content;

	}

	

	public function hookHeader($params)

	{

		if(Tools::getValue('id_product'))

		{

		    $html = '

			<script type="text/javascript">

			    $(document).ready(function(){

				    var hash = window.location.hash;

                    if(hash == \'#post_review\'){

				        $(\'#product_comments_block_extra\').find(\'.open-comment-form\').click();

					}

				});

			</script>';

		

		    return $html;

		}

	}

}

?>


Je pense ne pas etre loin de la solution, mais je demande un peut d'aide les amis :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...