[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 "Alexei Yakimovich" <alex@del.donetsk.ua> ******
Dear,
Can you explain me why it is not work for me.
I insert the same code below ( set_up_extra_check )
into MV4.04 basic demo, and I see only:
No format check routine for 'my_last_name'
Thanks,
Alexsei
> ****** message to minivend-users from Mike Heins <mikeh@minivend.com>
******
>
> Quoting Ton Verhagen (ton@verhagen.net):
> > ****** message to minivend-users from "Ton Verhagen"
<ton@verhagen.net> ******
> >
> > Hi all,
> >
> > I am wondering how I could add additional format check routines
> > to the ones already defined in Order.pm.
> >
> > Has anyone done this before, or does anyone know how to go about?
> >
> > Many thanks in advance for your kind cooperation.
>
> 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