Jump to content

Question sur {delivery_block_html}


Recommended Posts

Bonjour, 

 

Savez vous pourquoi la variable {delivery_block_html} ne fonctionne que sur le fichier order_conf.html.

 

Lorsque je personnalise un autre fichier (ou en crée un) la variable ne fonctionne plus !

 

Merci par avance, 

 

Franck 

Link to comment
Share on other sites

j'ai fais un copier coller d'un autre template (je ne sais plus le quel) mail du dossier "mail" j'ai changer deux trois phrases dedans, donc j'en ai un que j'ai appelé 'livre.html' et l'autre 'conge.html' 

 

Voici :

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>Message de {shop_name}</title>
 
 
<style> @media only screen and (max-width: 300px){ 
body {
width:218px !important;
margin:auto !important;
}
.table {width:195px !important;margin:auto !important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto !important;display: block !important;}
span.title{font-size:20px !important;line-height: 23px !important}
span.subtitle{font-size: 14px !important;line-height: 18px !important;padding-top:10px !important;display:block !important;}
td.box p{font-size: 12px !important;font-weight: bold !important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr { 
display: block !important; 
}
.table-recap{width: 200px!important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
@media only screen and (min-width: 301px) and (max-width: 500px) { 
body {width:308px!important;margin:auto!important;}
.table {width:285px!important;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
.table-recap table, .table-recap thead, .table-recap tbody, .table-recap th, .table-recap td, .table-recap tr { 
display: block !important; 
}
.table-recap{width: 295px !important;}
.table-recap tr td, .conf_body td{text-align:center !important;}
 
}
@media only screen and (min-width: 501px) and (max-width: 768px) {
body {width:478px!important;margin:auto!important;}
.table {width:450px!important;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
}
@media only screen and (max-device-width: 480px) { 
body {width:308px!important;margin:auto!important;}
.table {width:285px;margin:auto!important;}
.logo, .titleblock, .linkbelow, .box, .footer, .space_footer{width:auto!important;display: block!important;}
 
.table-recap{width: 295px!important;}
.table-recap tr td, .conf_body td{text-align:center!important;}
.address{display: block !important;margin-bottom: 10px !important;}
.space_address{display: none !important;}
}
</style>
 
</head>
<body style="-webkit-text-size-adjust:none;background-color:#fff;width:650px;font-family:Open-sans, sans-serif;color:#555454;font-size:13px;line-height:18px;margin:auto" >
<table class="table table-mail" style="width:100%;margin-top:10px;-moz-box-shadow:0 0 5px #afafaf;-webkit-box-shadow:0 0 5px #afafaf;-o-box-shadow:0 0 5px #afafaf;box-shadow:0 0 5px #afafaf;filter:progid:DXImageTransform.Microsoft.Shadow(color=#afafaf,Direction=134,Strength=5)">
<tr>
<td class="space" style="width:20px;padding:7px 0"> </td>
<td align="center" style="padding:7px 0">
<table class="table" bgcolor="#ffffff" style="width:100%">
<tr>
<td align="center" class="logo" style="border-bottom:4px solid #333333;padding:7px 0">
<a title="{shop_name}" href="{shop_url}" style="color:#337ff1">
<img src="{shop_logo}" alt="{shop_name}" />
</a>
</td>
</tr>
 
<tr>
<td align="center" class="titleblock" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span class="title" style="font-weight:500;font-size:28px;text-transform:uppercase;line-height:33px">Bonjour Mme/Mr {lastname},</span>
</font>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important"> </td>
</tr>
<tr>
<td class="box" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
<table class="table" style="width:100%">
<tr>
<td width="10" style="padding:7px 0"> </td>
<td style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
Votre commande est livrée </p>
<span style="color:#777">
Votre commande ayant pour référence <strong><span style="color:#333">{order_name}</span></strong> est livrée.
</span><br /> <br />
<span style="color:#777">
Vous trouverez ci-joint le PDF de livraison concernant votre commande.
</span>
</font>
</td>
<td width="10" style="padding:7px 0"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="space_footer" style="padding:0!important"> </td>
</tr>
<tr>
<td class="linkbelow" style="padding:7px 0">
<font size="2" face="Open-sans, sans-serif" color="#555454">
<span>
Vous pouvez consulter le détail de votre commande via le lien <a href="{history_url}" style="color:#337ff1">"Historique de mes commandes"</a> dans la rubrique <a href="{my_account_url}" style="color:#337ff1">"Mon Compte"</a> sur notre site. </span>
</font>
</td>
</tr>
<tr>
<td class="linkbelow" style="padding:7px 0">
</td>
</tr>
 
<tr>
<td class="space_footer" style="padding:0!important"> </td>
</tr>
<tr>
<td class="footer" style="border-top:4px solid #333333;padding:7px 0">
<span><a href="{shop_url}" style="color:#337ff1">{shop_name}</a> </span>
</td>
</tr>
</table>
</td>
<td class="space" style="width:20px;padding:7px 0"> </td>
</tr>
</table>
</body>
</html>
Link to comment
Share on other sites

Bonsoir,

 

A titre personnel et selon votre version de PrestaShop, je vous conseillerais plus vite d'avoir un module utilisant un des points d'accroches disponibles quant à l'injection de variable pour vos templates d'email.

 

Par exemple, 

function hookActionGetExtraMailTemplateVars($params) {
        if ($params['template'] == 'livre' || $params['template'] == 'conge') {
            $order = new Order((int)$params['template_vars']['{id_order}']);
            $delivery = new Address((int)$order->id_address_delivery);

            $params['extra_template_vars']['{delivery_block_html}'] = AddressFormat::generateAddress($delivery, array('avoid' => array()), '<br />', ' ', array(
                'firstname'    => '<span style="font-weight:bold;">%s</span>',
                'lastname'    => '<span style="font-weight:bold;">%s</span>'
            ));
        }
    }
Link to comment
Share on other sites

Je préfère qu'on apprenne les bonnes pratiques dès le départ, même si ça nécessite plus de pédagogie dans leur apprentissages, :)

 

Je donne un exemple en fonction de son besoin, mais on peut d'ailleurs se passer de la première conditionnelle et faire un module bien plus dynamique, mais je crains que ce ne soit ni la demande, ni le besoin. Et, d'ailleurs, c'est là qu'on alourdit l'exemple et qu'on rends la compréhension plus difficile.

 

Si franckisys n'a pas les connaissances pour rajouter ce code au sein d'un module, je pense qu'il est d'autant plus judicieux de ne pas jouer avec les surcharges elles-mêmes. Sans mépris aucun pour lui, bien entendu.

 

On peut donc tout à fait y aller à son rythme, mais en commençant par les bonnes bases et en profitant des mécanismes qui sont offerts au sein de PrestaShop ;-)

Link to comment
Share on other sites

Je ne vois pas le rapport entre la demande, les surcharges et le module Advanced Search 4, cela dit.

 

On pourrait, à l’extrême, éditer les controlleurs directement. On irait encore plus vite que l'utilisation d'une surcharge, si on va par là.

 

Mais oui, chaque besoin est différent et tout dépend la notion de chacun.

Disons aussi qu'ici, on sait qu'avec le module, on gère la partie précise de ce qu'on veut modifier.

 

Je pense que, comme moi, tu te rends bien compte que la méthode qui contient la ligne 540 du fichier pointé est tout bonnement et simplement trop ample.

J'entends par là qu'elle devrait être scindée par différentes méthodes pour gérer au mieux la maintenance et procéder à des surcharges plus courtes, plus précise et donc moins sujettes à des mises à jours non prises en compte lors des upgrades de PrestaShop, notamment.

 

Ensuite, je donne bel et bien un conseil avec un exemple (bien plus qu'un exemple, d'ailleurs). Libre à l'auteur du sujet de l’utiliser ou non, selon. Il s'agit avant tout d'un conseil; ni plus ni moins. ;-)

 

Au moins, grâce à nous deux, plusieurs pistes s'offrent à lui :)

  • Like 1
Link to comment
Share on other sites

Bonjour,

 

Merci pour toutes ces réponses par contre ducoup je ne sais pas par quel bout commencer :)

 

Effectivement avec un module qui permet de gérer mes template de mail ce serait génial surtout qu'ils vont être amenés à évolués, en revanche cela me fait peur car ce n'est pas dutout ma tasse de thé :) je pense qu'il faut faut des grandes compétences que je n'ai pas, j'ai juste quelques connaissances sans plus...

 

Pour faire le tour complet et peut être que vous pourrez me proposer la façon la plus idéale possible, j'ai besoin dans mes template :

- modifier un contenu

- lire des variables 

- créer des variables 

 

Merci par avance, 

 

Franck

Link to comment
Share on other sites

Bonjour, 

 

dans la ligne $templateVars = array('{test}' => 'ma variable qui fonctionne dans tous les mails au changement d\'état'); 

 

j'ai mis : $templateVars = array('{client}' => $delivery_address->company);

 

En revanche quand jajoute la variable {client} dans le template ca ne fonctionne toujours pas 

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...