Jump to content

E-Mail Template Order Details


Marcell

Recommended Posts

Hi!

I would like to somehow manage to separate the order detail elements to parts, so I can example make our email look better.
Currently looks like this, but I would like to change this if possible.

Can you help? 

Also, I would like to congratulate for your new awesome community design. I love it!!

 

Screenshot_1.png

Edited by sqpp
Wanted to tell you how cool is the new forum.
Link to comment
Share on other sites

Hi Marcell,

17 hours ago, sqpp said:

I would like to somehow manage to separate the order detail elements to parts, so I can example make our email look better.
Currently looks like this, but I would like to change this if possible.

in some ways, you might be better off working out how you want the finished output to look and then working backwards from there to determine the best method to use.

the problem is that in the template, you'll only have {$order_details} to use - and that's basically just a string... some of the other email templates have arrays you can manipulate, but not this one! 9_9

so, let's assume this can be fixed with Smarty (whether it can will depend on your desired output) - the first step is to split the string into an array...

{assign "ordersplit" "<br>"|explode:$order_details}

btw - you may need to edit the order confirmation message value directly in tblemailtemplates rather than editing in the admin area (even if you use the HTML button) as it changes the values of < and > to the &lt; and &rt; and prevents the email from sending. :mad:

additionally, if you're using v7+, you'll need to add 'explode' to your modifiers section of Smarty Security Policy.

jFrxxEH.png

now that we have an array, we can loop through it with a foreach loop to output as desired...

{foreach from=$ordersplit item=keyword}
{$keyword|strstr:':':true} -> {$keyword|strstr:':':false|replace:': ':''}<br />
{/foreach}

V83lgID.png

for clarity, i've split the headings and values into two and separated them with -> ... but you should split them however you want to suit your design, e.g table cells, divs etc and drop the break return from the output...

as per before, if you need to output like this, you'll also need to add 'strstr' to your Smarty Security Policy.... there are Smarty alternatives, depending on how you want to output, but you'd most likely need to add those modifiers to the policy too if you use them (and if they're not on the default list).

the other solution would be to use an action hook to modify $order_details (or create another similar variable), but again you'll need to know what the desired output is going to be before heading down that road... though the chances are that using the Smarty solution will be more flexible for your needs. :idea:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated