maalik Posted January 30 Share Posted January 30 Hello, I'M using Prestashop 8.2.0. When sending an email with the template "in_transit", the variable "{meta_products}" will just be send as it is. It won't be converted to any other text. Is this intended? Did I make an error? Or is this a bug? Is there a list of the existing variables, so that I can check, what actually stands behind a variabel? Additional hint, don't know if that changes anything: I changed the email template for the status change of "shipped" to the template "in_transit" Thanks Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 I'm afraid there is no list anywhere, it's all in the code. For example for the in_transit email it looks like this in the OrderCarrier.php: So {meta_products} should be set. Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 (edited) Hey Daresh, thanks for the quick reply. It helped me figure out where the problem is: I changed the OrderCarrier.php, so that no E-Mail will be sent, when adding the shipping number in the backend. This also led to the metadata variable not being generated. My OrderCarrier.php currently looks like this: <?php /** * OrderCarrier override : disable in_transit emails * */ defined('_PS_VERSION_') or die; class OrderCarrier extends OrderCarrierCore { /** * @param Order $order Required * * @return bool */ public function sendInTransitEmail($order) { return true; } } Do you know, how I can change the original file, so that the metadata variable will be generated, but NO email is send, when adding the shipping number? Will it be enough to comment out this block? if (@Mail::Send( $orderLanguageId, 'in_transit', $this->trans( 'Package in transit', [], 'Emails.Subject', $orderLanguage->locale ), $templateVars, $customer->email, $customer->firstname . ' ' . $customer->lastname, null, null, null, null, _PS_MAIL_DIR_, true, (int) $order->id_shop )) { return true; } else { return false; } Or this? $sendemail = (bool) Tools::getValue('sendemail', false); Edited January 30 by maalik (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 Yes, but in that case what do you need the metadata for? It's only used for sending the email as I see. Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 I use the in_transit template, when I change the status of an order to "shipped". The default "shipped" template contains neither the order-details nor the shipping number. Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 But when changing order state, there is no metadata variable, it's in a different parts of the code: OrderHistory.php. Only a few variables there: Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 I don't quite understand your answer unfortunately. What do you mean with "there is no metadata variable". To sum up, what I'm trying to do: 1) I don't want an email to be sent out, when I add the shipping number in the backend. 2) I want the the mail, that gets send when I change the order to "Shipped" to include the shipping url ({followup}) aswell as the articles of the order. What would be the best way to achieve this? Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 Your case is quite common, but it may require some more coding or some additional modules. PrestaShop simply sends totally different sets of email templates to the emails. So you can't just switch one email template to another assuming the other one will have all the variables set. Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 Does the "shipped" template know the {followup} variable? Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 Yes, I pasted a screenshot above. Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 Okay. So in order to get the {meta_products} variable to work again, I need to revert the changes in OrderCarrier.php, so that it contains the code for the creation of the variable. Which line would be best to comment out in OrderCarrier.php then, to disable the email being send? (sorry, if this is a repetition, but i can't quite keep up with the technical detail of your answers) Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 Nope, you're wrong. If you want to have the {meta_products} variable set for any email related to a general order status change, you would need to change OrderHistory.php and add some code there that will gather all the required information. Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 I think I understand now. I need to use the OrderHistory, because it handles the status changes; the OrderCarrier file only handles the carrier(shipping) related changes, right? I think I will just drop the {meta_products} variable then, my PHP knowledge is not that high unfortunately. Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 Yes, now you got it! Changing core is generally not a good practice, so dropping that variable may be a good decision here. And if you would like to block the 'in_transit' email from being sent without any core modifications, I have a module that can do this task: Email Toolbox Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 Thanks for the help! Do you have another URL? My browser or firewall or Pihole or something is blocking your URL entirely. Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 Try this one: https://codecanyon.net/item/disable-selected-automatic-prestashop-emails/29944638 Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 Thanks, this URL works. I'l give it a look and decide, after knowing how good my shop will perform Link to comment Share on other sites More sharing options...
maalik Posted January 30 Author Share Posted January 30 Oh, and maybe another question: When sending a testmail of the "order_conf", it contains the information from my last order. Is this an intented behaviour? Link to comment Share on other sites More sharing options...
Daresh Posted January 30 Share Posted January 30 I don't know but I can take a look at the code if I find a moment. But it would be best if you could create a new topic for it. 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