[ic] Quick and dirty "write to file"

Chris Kershaw chris at endpoint.com
Tue Sep 28 18:27:50 UTC 2010


Peter N wrote:
> And a followup question: I have the following code snippet:
>
> [if cgi add_to_list]
>  [log file="email_list.txt" type="text" interpolate=1]
>   [cgi email]
>  [/log]
> [/if]
>
> Where do I need to place this code so that it is invoked on checkout?
> I tried putting it on receipt.html, but nothing is written to the log,
> presumably because my form variable, add_to_list, is not being passed
> from checkout.html.
>   

Hi Peter,

CGI variables get copied into the Values hash during checkout so you
likely need to use [value email]. You could essentially put this within
any file that is part of the checkout routes but I would recommend
creating a new route for this to keep things separated. So the quick and
easy way would be to:

1) Create an include ~catalogs/store/include/update_mailing_list
2) Place the include on some checkout page such as etc/receipt or
etc/log_transaction

My preferred method would be to:

1) Create the mail list file with your business logic
~catalogs/store/etc/update_mailing_list

2) Create new route in catalog.cfg

Route update_mailing_list  <<EOF
    empty        1
    encrypt      0
    increment    0
    report       etc/update_mailing_list
    supplant     0
    track        logs/mail_list_log
EOF

3) Update your checkout order route:

Route   default   cascade         "log  update_mailing_list main copy_user"

4) Restart Interchange and checkout.

Hope this helps
Chris

-- 
Chris Kershaw
End Point Corp.
Direct Line: 919-249-5356
Fax: 866-281-1373 
http://www.endpoint.com




More information about the interchange-users mailing list