isa_des Posted April 10, 2019 Share Posted April 10, 2019 (edited) Bonjour ! Suite à une mise à jour de PrestaShop 1.6.1.4 à 1.6.1.23, il y a eu une modification dans les emails de notification. Auparavant était écrit : Quote Référence Artiste - Nom de l'album - (Catégorie de Label) Prix Quantité Total Maintenant il n'y a plus que : Quote Référence Nom de l'album Prix Quantité Total Comment faire pour avoir de nouveau l'ancienne version ? C'est important pour mon client qui a besoin des informations de catégorie, de label et d'artiste pour facilement retrouver ses produits (plus de 18 000 références à ce jour en boutique ). Merci beaucoup d'avance ! Edited April 11, 2019 by isa_des (see edit history) Link to comment Share on other sites More sharing options...
Eolia Posted April 10, 2019 Share Posted April 10, 2019 si le mail avait été modifié, le contrôleur ou classe associé(e) devait l'être aussi (avec une override ou pas...) Si vous n'avez pas de sauvegarde il faut tout se retaper à la main... Link to comment Share on other sites More sharing options...
isa_des Posted April 10, 2019 Author Share Posted April 10, 2019 Merci @Eolia, Une petite idée de où trouver ce contrôleur-là ? (j'ai lu pas mal de choses sur PaymentModule mais ça me semble pas hyper logique que ce soit ça qu'il faille modifier pour faire fonctionner un email...) Ou un module qui le ferait à ma place ? Toute aide / piste est vraiment la bienvenue ! Link to comment Share on other sites More sharing options...
Eolia Posted April 10, 2019 Share Posted April 10, 2019 Ca dépend de quel mail on parle (template) je ne suis pas devin^^ il y a 38 minutes, isa_des a dit : dans les emails de notification Link to comment Share on other sites More sharing options...
isa_des Posted April 10, 2019 Author Share Posted April 10, 2019 Oui pardon, au temps pour moi ! Alors c'est nécessaire pour celui de notification de nouvelle commande (celui envoyé au propriétaire de la boutique) surtout. Mais je suppose que si on fait en sorte que ce soit inclus dans {items} ce sera bon ! J'ai comme l'intuition qu'en rajoutant ça à cet endroit ce serait bien, mais je ne sais pas quels éléments utiliser pour appeler la catégorie et la caractéristique précise :/ (c'est dans le fichier modules/mailalerts/mailalerts.php $items_table = ''; foreach ($order_return_products as $key => $product) { $url = $context->link->getProductLink($product['product_id']); $items_table .= '<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';"> <td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td> <td style="padding:0.6em 0.4em;"> <strong><a href="'.$url.'">'.$product['product_name'].'</a> </strong> </td> <td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td> </tr>'; } J'avais essayé ça : $items_table = ''; foreach ($order_return_products as $key => $product) { $url = $context->link->getProductLink($product['product_id']); $items_table .= '<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';"> <td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td> <td style="padding:0.6em 0.4em;"> '.$product['product_artist'].' <strong><a href="'.$url.'">'.$product['product_name'].'</a> </strong> ('.$product['product_category'].' de '.$product['product_label'].') </td> <td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td> </tr>'; } Merci beaucoup ! Link to comment Share on other sites More sharing options...
Eolia Posted April 10, 2019 Share Posted April 10, 2019 $product['product_category'] et $product['product_label'] n'existent pas à cet endroit... il faut les associer et ce bout de code correspond aux mails de retours client pas à celui de confirmation envoyé aux marchands Link to comment Share on other sites More sharing options...
isa_des Posted April 11, 2019 Author Share Posted April 11, 2019 (edited) Merci beaucoup @Eolia, j'ai pu avancer dans mes recherches. Je suis juste très stupidement coincée sur comment transformer ce bout de code (trouvé ailleurs sur le PrestaShop en question) : {foreach from=$product.features item=feature} {if $feature.id_feature == '11'} {assign value="artist"} <p>{$feature.value|ucwords}</p> {/if} {/foreach} En quelque chose que mailalerts.php puisse comprendre (j'ai pas l'impression que ce soit exactement le même langage). Une idée ? J'ai cherché des convertisseur / php beautifyer sur Google mais en vain Edited April 11, 2019 by isa_des edit code (see edit history) Link to comment Share on other sites More sharing options...
Eolia Posted April 11, 2019 Share Posted April 11, 2019 là c'est du tpl en php ca donnerai quelque chose comme: foreach($product['features'] as $feature) { if($feature['id_feature'] == '11') $product['product_artist'] = 'Artiste'; } Link to comment Share on other sites More sharing options...
isa_des Posted April 11, 2019 Author Share Posted April 11, 2019 Merci ! Je vais voir si avec ça j'arrive enfin à quelque chose Link to comment Share on other sites More sharing options...
isa_des Posted April 11, 2019 Author Share Posted April 11, 2019 (edited) Ok, j'ai trouvé ! Pour ceux qui en auraient besoin, voilà ce que j'ai fait pour obtenir le résultat recherché : $products = $params['order']->getProducts(); $customized_datas = Product::getAllCustomizedDatas((int)$params['cart']->id); Product::addCustomizationPrice($products, $customized_datas); foreach ($products as $key => $product) { $unit_price = Product::getTaxCalculationMethod($customer->id) == PS_TAX_EXC ? $product['product_price'] : $product['product_price_wt']; $customization_text = ''; if (isset($customized_datas[$product['product_id']][$product['product_attribute_id']])) { foreach ($customized_datas[$product['product_id']][$product['product_attribute_id']][$order->id_address_delivery] as $customization) { if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD])) foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] as $text) $customization_text .= $text['name'].': '.$text['value'].'<br />'; if (isset($customization['datas'][Product::CUSTOMIZE_FILE])) $customization_text .= count($customization['datas'][Product::CUSTOMIZE_FILE]).' '.$this->l('image(s)').'<br />'; $customization_text .= '---<br />'; } if (method_exists('Tools', 'rtrimString')) $customization_text = Tools::rtrimString($customization_text, '---<br />'); else $customization_text = preg_replace('/---<br \/>$/', '', $customization_text); } $url = $context->link->getProductLink($product['product_id']); $myprod = new Product($product['id_product']); $features = $myprod->getFrontFeatures(1); foreach ($features as $feature) { foreach ($feature as $key => $value) { if($value == "Label") { $label = $feature['value']; } if($value == "Artiste") { $artiste = $feature['value']; } } } $items_table .= '<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';"> <td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td> <td style="padding:0.6em 0.4em;"> '.$artiste.' - <strong><a href="'.$url.'">'.$product['product_name'].'</a>' .(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '') .(!empty($customization_text) ? '<br />'.$customization_text : '') .'</strong> ('.$label.') </td> <td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td> <td style="padding:0.6em 0.4em; text-align:center;">'.(int)$product['product_quantity'].'</td> <td style="padding:0.6em 0.4em; text-align:right;">' .Tools::displayPrice(($unit_price * $product['product_quantity']), $currency, false) .'</td> </tr>'; } Merci @Eolia pour ton aide ! Edited April 11, 2019 by isa_des réponse trouvée (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now