I=E2=80=99ve been working on formatting this message for an email that =
will send out with mivascript, however for some reason some of the =
variables aren=E2=80=99t assigning properly (with extra toppings). I =
get output that looks like this:
=20
1 Pizza =E2=80=93 Large White
[1 of 3]
=20
1 Subs =E2=80=93 Cheesesteak
[2 of 3]
=20
2 Subs =E2=80=93 Cheesesteak with Works
[3 of 3]
=20
But I want to get the toppings to show up like this:
=20
1 Pizza =E2=80=93 Large White
[1 of 3]
=20
1 Subs =E2=80=93 Cheesesteak
[2 of 3]
=20
2 Subs =E2=80=93 Cheesesteak with Works
Sauce =E2=86=90 note these two =
lines
Lettuce and Tomatoes ($.35) =E2=86=90
[3 of 3]
=20
Something isn=E2=80=99t working with <MvASSIGN NAME =3D "{ 'l.extra' $ =
l.extracount }" VALUE =3D "{ gettoken(l.tempvar, ',' , l.counter) }"> =
and <MvASSING NAME =3D "l.tempextra" VALUE =3D =
"{miva_variable_value('g.extra' $ l.counter)}">
=20
I would really appreciate if someone would take a peak at my code and =
let me know what=E2=80=99s wrong with it. I know this isn=E2=80=99t =
very elegant either, but so far most of it is working.
=20
l.completeorder looks like =E2=80=9CPizza,Large =
White,,1;Subs,Cheesesteak,,1;Subs,Cheesesteak with Works,Sauce, Lettuce =
and Tomatoes ($.35),2;=E2=80=9D
It is set up as follows =
=E2=80=9CCategory,Item,ExtraTopping,AmountItem;
=20
=20
<MvASSIGN NAME=3D"g.recipient" =
VALUE=3D"[email protected]">
<MvASSIGN NAME=3D"g.subject" VALUE=3D"{'Website Order'}">
<MvASSIGN NAME=3D"g.mailhost" VALUE=3D"smtp.earthlink.net">
<MvASSIGN NAME=3D"g.email" =
VALUE=3D"[email protected]">
<MvASSIGN NAME=3D"l.lfcr" VALUE=3D"{asciichar(10) $ =
asciichar(13)}">
<MvASSIGN NAME=3D"l.mail_string" VALUE=3D"">
<MvASSIGN NAME =3D "l.completeorder" VALUE =3D "{ =
decodeentities(l.completeorder) }">
<MvASSIGN NAME =3D "l.index" VALUE =3D "1">
=20
<MvCOMMENT>Find out how many items there are in this =
order</MvCOMMENT>
<MvWHILE EXPRESSION =3D "{gettoken(l.completeorder, ';', =
l.index2 + 1) OR NOT 1}">
<MvASSIGN NAME =3D "l.index2" VALUE =3D "{ =
index2+1 }">
</MvWHILE>
=20
<MvCOMMENT> Look up information on each item including =
prices from the menu database</MvCOMMENT>
<MvWHILE EXPRESSION =3D "{gettoken(l.completeorder, ';', =
l.index) OR NOT l.index}">
<MvASSIGN NAME =3D "l.tempvar" VALUE =3D "{ =
gettoken(l.completeorder, ';', l.index) }">
<MvIF EXPR =3D "{l.tempvar}">
<MvASSIGN NAME =3D "l.category" =
VALUE =3D "{ gettoken(l.tempvar, ',', 1) }">
<MvASSIGN NAME =3D "l.item" VALUE =
=3D "{ gettoken(l.tempvar, ',', 2) }">
=20
<MvCOMMENT>Find out what extras are =
included with this item and if it is the last token, it is the amount of =
items like this</MvCOMMENT>
<MvASSIGN NAME =3D "l.extracount" =
VALUE =3D "">
<MvASSIGN NAME =3D "l.counter" VALUE =
=3D "3">
<MvCOMMENT>The l.counter starts with =
the 3rd field (extra1) and the second part, counter + 1 allows for no =
extras (3rd field is null)</MvCOMMENT>
<MvWHILE EXPRESSION =3D =
"{gettoken(l.tempvar, ',', l.counter) OR gettoken(l.tempvar, ',', =
l.counter + 1)}">=20
<MvIF EXPR =3D "{ =
gettoken(l.tempvar, ',', l.counter + 1) }">
<MvASSIGN =
NAME =3D "l.extracount" VALUE =3D "{l.extracount + 1}">
<MvASSIGN =
NAME =3D "{ 'l.extra' $ l.extracount }" VALUE =3D "{ gettoken(l.tempvar, =
',' , l.counter) }">
<MVEVAL =
EXPR=3D"{ miva_variable_value('l.extra' $ l.extracount) $ ' ' $ =
l.counter }">
<MvELSE>
<MvASSIGN =
NAME =3D "l.amount" VALUE =3D "{ gettoken(l.tempvar, ',' , l.counter) =
}">
<MVASSIGN =
NAME =3D "l.amount" VALUE =3D "{encodeentities(l.amount)}">
</MvIF>
<MvASSIGN NAME =3D =
"l.counter" VALUE =3D "{l.counter + 1}">
</MvWHILE>
</MvIF>
=20
<MvASSIGN NAME=3D"l.mail_string" =
VALUE=3D"{l.mail_string $ l.amount $ ' ' $ l.category $ ' - ' $ l.item $ =
l.lfcr}">
=20
<MvASSIGN NAME =3D "l.counter" VALUE =3D "">
<MvWHILE EXPRESSION =3D "{l.counter LT =
l.extracount}">
<MvASSIGN NAME =3D "l.counter" VALUE =
=3D "{l.counter + 1}">
<MvASSING NAME =3D "l.tempextra" =
VALUE =3D "{miva_variable_value('g.extra' $ l.counter)}">
<MvIF EXPR =3D "{l.tempextra}">
<MvASSIGN =
NAME=3D"l.mail_string" VALUE=3D"{l.mail_string $ ' ' $ l.tempextra $ =
l.lfcr}">
</MvIF>
</MvWHILE>
=20
<MvASSIGN NAME=3D"l.mail_string" =
VALUE=3D"{l.mail_string $ '[' $ l.index $ ' of ' $ l.index2 $ ']' $ =
l.lfcr $ l.lfcr}">
=20
<MvASSIGN NAME =3D "l.index" VALUE =3D "{ =
index+1 }">
</MvWHILE>
=20
<MvASSIGN NAME=3D"l.mail_string" VALUE=3D"{l.mail_string $ =
l.lfcr $ l.lfcr $ l.checksum}">
=20
<MvSMTP
TO=3D"{ encodeentities(g.recipient) }"
SUBJECT=3D"{ encodeentities(g.subject) }"
CC=3D""
MAILHOST=3D"{ encodeentities(g.mailhost) }"
FROM=3D"{ encodeentities(g.email) }">
=20
<MvEVAL EXPR =3D "{ l.lfcr }">
<MvEVAL EXPR =3D "{ l.mail_string }">
</MvSMTP>
=20
=20
Thanks for taking your time to look at this!
=20
Andrew Rosborough
<A HREF ="http://www.rosborough.net">http://www.rosborough.net</A>
=20