John Posted October 26, 2017 Share Posted October 26, 2017 My Order Confirmation email template contains a variable {$order_details} which contains all the details about the order. Due to these all being bulked together I can't change any of them. I have multiple product custom fields, of which one is a product password, which i really don't want to send in plain text via email to the customer ... for obvious reasons. After looking through the documentation i discovered EmailPreSend hook, but i have no idea how to remove my custom field using this hook, as I don't know what the variable names/arrays are. I experimented a little, all resulting in an "OOPS" page showing me i have no idea what i am doing lol. Any idea how to remove this product custom field from my order confirmation email? Any help in pointing me in the right direction would be greatly appreciated. Also, this is my first time here, so I didn't know if coding/hook questions go here or not. -John 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 27, 2017 Share Posted October 27, 2017 Hi John, you could do it in the template using Smarty... so let's say one of the customfields is called "Password", we can remove all customfields by doing this... {foreach from=$ordersplit item=keyword} {if $keyword|strstr:"Password"} {$keyword|strstr:'First'}<br /> {elseif $keyword neq "\n"} {$keyword|strstr:':':true}: {$keyword|strstr:':':false|replace:': ':''}<br /> {else} <br /> {/if} {/foreach} any products that don't have a password customfield will continue to show all customfields - so if you wanted to hide all customfields, you'd need to expand that initial {if} statement to include one CF from each product (you don't need to add them all, just one from each (or less if multiple products use the same CF names). also, note what I said in the above thread about the Smarty Security Policy - that's important as it won't work unless you make those changes (if you're using v7+). 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.