[ic] mv_order_route and "route expandable" dont work together?

Steffen Dettmer interchange-users@interchange.redhat.com
Fri Mar 15 02:55:01 2002


Hi,

thank you, it works like a charm. This mail is indended for the
mail archives if someone have a similar issue later.

* Kevin Walsh wrote on Fri, Mar 08, 2002 at 11:35 -0000:
 [...] 
> > ## This route copies the user to the second address
> > Route copy_user_copy  error_ok     1
> > Route copy_user_copy  report       etc/mail_receipt
> > Route copy_user_copy  track        logs/log
> > Route copy_user_copy  email        "[scratch emailcopy]"
 [...] 
> > Any ideas how to generate a second mail to a user/userdb
> > dependent email-address?
> > 
> Perhaps something like this:
> 
> 1) Get rid of the 'email' directive in your 'copy_user_copy'
>    route.  In fact, get rid of the whole route and make a new
>    one by making a copy of your existing 'copy_user' route.

I did, and it seems that empty = 1 does the trick.

> 3) Use your [scratch emailcopy] in the [email] tag's "to" parameter
>    in place of the [value email] tag in your etc/mail_receipt_copy
>    file.

This is a nice way to do it, it's much more straigth-forward than
my idea. 

> 4) Change the [if value email_copy] code, in the etc/mail_receipt_copy
>    file to read [if scratch emailcopy].

With this way it's easily possible to do really nice things. Even
a [data ...] works well to get email addresses from other tables.
If the [if] tag doen't match (I mean, evaluates to false), the
[email] isn't "active", and no mail gets send. So this is really
flexible!

Another point: it seems not possible to remove the mail report
from the default route. I tried anything I found, like mail = 0
and email = "" with emtpy = 1, but in this cases the receipt will
not be generated, and no new page get's displayed after the order
was successful. So it seems that the default route has to send a
mail.

And, dear reader, please note the different formats of the mail
templates of the default and other routes. In foundation, compare
/etc/mail_receipt and /etc/report. The mail used from the default
route don't have a [email] tag, so it seems that this mail isn't
as flexible as the others. 

Finally excerpts from the files.

catalog.cfg:
UserDB    default    scratch       "dealer price_level credit_limit emailcopy"
[...]
## This route copies the user to the second address
Route copy_user_copy  <<EOF
        empty        1
        error_ok     1
        encrypt      0
        increment    0
        report       etc/mail_receipt_copy
        supplant     0
        track        logs/log
EOF
[...]
Route   default   cascade         "log main copy_user copy_user_copy"

etc/mail_receipt_copy:

[if scratch emailcopy]
Sending second copy to [scratch emailcopy] of [value mv_order_number].
[email to="[scratch emailcopy]"
        subject="(Copy) Thanks for [value mv_order_number]!"
        from=|"foo" <bar@foo.de>| ]
here comes the mail body
[/email]
[else]eMail Kopie-Kopie des Auftrages [value mv_order_number] für
[scratch emailcopy] nicht verlangt.[/else]
[/if]

BTW, don't miss the [/email] Tag, it won't work :)

You can even do a:
[email to=|[data table="shopconfig" field="shopmail" key="[scratch shop_id]" interpolate=1]|
        subject="Order [value mv_order_number]!"
        from=|"Foo" <foo-notification-robot@bar.de>| ]

and so on (we have multiple shops on a single IC installation in
a single but very dynamic catalog which fetches it's templates
from /region-[scratch shop_id]/).

oki,

Steffen

-- 
Dieses Schreiben wurde maschinell erstellt,
es trägt daher weder Unterschrift noch Siegel.