MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] Sql in receipt-mail?



Stefan Hornburg wrote:

> ******    message to minivend-users from Stefan Hornburg <racke@linuxia.net>     ******
>
> Thomas Lang <tcl@physik.kfunigraz.ac.at> writes:
>
> > Is it possible to use sql-queries within the perl code in the receipt
> > page (the mail copy of the order!). - It seems MV is first interprating
> > its tags then perl and at last the sql - or something like that. So the
> > email only contains the [sql-param n] tags - but no values.
>
> It works definitely, it must be an error on your side.
> E.g.:
>
> [comment]Get country data[/comment]
> [perl arg=values interpolate=1]
> $hash=[sql type=hash interpolate=1]select * from country where id = [value newcid][/sql];
> foreach $key (keys %$hash) {
>   $Safe{'values'}->{countrypostcode} = $$hash{$key}->{postcode};
>   $Safe{'values'}->{countrypostcode} =~ s/\s+$//;
>   $Safe{'values'}->{countrypostcode} =~ s/^\s+//;
>   $Safe{'values'}->{countryprefix} = $$hash{$key}->{phoneprefix};
>   $Safe{'values'}->{countryprefix} =~ s/^\s*0+//;
> }
> [/perl]
>

Thanks for your answer - maybe I forgot something more: In the receipt.html the first part is
html and the second the email-copy to the customer. There the Perl-Sql code is within a
"q{... ...};

here it is:

[if value email_copy]
[set name=email_copy_sent interpolate=1]
[perl arg=sub interpolate=1]
form_mail(  q{[value email]},
                  q{Thanks for your order #[value mv_order_number]!},
                  q{__COMPANY__ Service <__ORDERS_TO__>},
                  q{
[item-list]
[sql type=list query="SELECT * FROM products WHERE Nummer='[item-code]'"]
 [sql-param 0] [sql-param 1] ...
[/sql]
[/item-list]

})
[/perl][/set][/if]

Any suggestions now?



Search for: Match: Format: Sort by: