Issues with Ternary expression in printer template for ORder GROUPING

@emre I found something out while playing with printer template.

I did this:

[ORDERS:GROUP TAG=*]
<div style="font-size:18px;text-align:left;font-family:'Calibri'">
[='{PORTION}' == '' ? '<table><tr><td width="196">       {PRODUCT NAME}</td></tr></table>{ORDER TAGS}':'<table><tr><td width="196">       {PORTION} {PRODUCT NAME}</td></tr></table>{ORDER TAGS}']
</div>

I basically wanted it to show PORTION PRODUCTNAME aligned specifically. But in HTML if you have no portion it still puts the empty space where portion would have been misaligning the items. Now to my point. This ternary works! but only for any grouping after the FIrst one. THis is odd it leads me to think the first grouping did not actually have a GROUP TAG…why im not sure.

How it looks with single combo in ticket.

image

How it looks with that same order and then additional combos.

image

Actually it has something to do with main item if it has a portion. I wonder if ignore portion is doing it?

EDIT: I am baffled its strange… i think it has to do with portion…not sure.

Here is another exmaple:

image

The Ternary didnt show Pizza Burger at all but why would it allow chicken sandwich above… and then with Cheeseburger combo why does it not allow drink or the burger.

Here is what I am trying to avoid. Notice the space on items without portion.

image

Ok so I figured out my ternary printer template issue… It now works just fine. I had to take {ORDER TAGS} out of the ternary expression and put them at end of the tables like so.

[ORDERS:GROUP TAG=*]
<div style="font-size:18px;text-align:left;font-family:'Calibri'">
[='{PORTION}' == '' ? '<table><tr><td width="196">       {PRODUCT NAME}</td></tr></table>':'<table><tr><td width="196">       {PORTION} {PRODUCT NAME}</td></tr></table>']
</div>
{ORDER TAGS}

It now lines up perfectly.

image

1 Like