[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] 4.03 How to add user defined format check routines?
****** message to minivend-users from "Ton Verhagen" <ton@verhagen.net> ******
Thanks Mike!!
Now i remember again. I tossed all 3.xx from my server and when
grepping the docs and sources I didn't find anything usefull.
Again thanks a million for your answer and the really magnificent
MV.
Ton
>I put this in back in 3.xx, and it still applies:
>
> * Added order profile checks for "state", "province",
> "province_or_state", "postcode", "ca_postcode", and "zip".
Sorry,
> only US/Canada supported, but you can add a check yourself
> in a GlobalSub:
>
>GlobalSub <<EOF
>sub set_up_extra_check {
> BEGIN {
> package Vend::Order;
> sub _pt_postcode {
> # $ref is to Vend::Session->{'values'} hash
> # $var is the passed name of the variable
> # $val is current value of checked variable
> my($ref, $var, $val) = @_;
>
> if ($ref->{country} =~ /^(PT|portugal)$/i) {
> return $val =~ /^\d\d\d\d$/ ? 1 : 0;
> }
> else {
> return 1;
> }
> }
> }
>}
>EOF
>
> Now you can specify in an order profile:
>
> postcode=pt_postcode
>
> There must be an underscore preceding the routine name in
this
> case. Very elaborate checks are possible, of course. If
some user
> takes on the polyglot it would be appreciated if they
contribute
> the routines.
>
> To you MiniVend hackers out there, this is a general
technicque you can
> use to override MV subroutines. For the most part, I try
to keep the
> same call interface, and this should make updates *much*
easier.
>
>
>--
>Internet Robotics, 131 Willow Lane, Floor 2, Oxford, OH 45056
>phone +1.513.523.7621 fax 7501 <mikeh@minivend.com>
>
>Fast, reliable, cheap. Pick two and we'll talk. -- unknown
>-
>To unsubscribe from the list, DO NOT REPLY to this message.
Instead, send
>email with 'UNSUBSCRIBE minivend-users' in the body to
Majordomo@minivend.com.
>Archive of past messages:
http://www.minivend.com/minivend/minivend-list
>
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list