[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Change the price on the fly, without CommonAdjust
Quoting Jim Balcom (jim@idk-enterprises.com):
> On Wed, 27 Jun 2001, Ron Phipps wrote:
>
> RP>>Thanks Ed, this thread passed me by as well. I'll check my local archive to
> RP>>see if I can find the complete context, I appreciate you pointing me in this
> RP>>direction. It sounds like using a UserTag that determines the price and
> RP>>returns it to CommonAdjust is the way to go.
>
> I captured most of it....
>
>
> Actually, there is more detailed documentation. I have edited this to
> reflect current reality, and offer:
>
> =head2 Chained Pricing
>
> A flexible chained pricing scheme is available when the I<CommonAdjust>
> directive is set.
>
> We talk below about a I<CommonAdjust string>; it will be defined
> in due time.
>
> NOTE: while we call the field C<common_adjust> below, usually PriceField
> is set to C<no_price> in the Interchange demos.
>
> A few rules about CommonAdjust, all assuming the I<PriceField> directive
> is set to C<common_adjust>:
>
[snip rest of pretty complex docs]
Thanks Jim. I would recommend changing the reference to C<common_adjust>
field to C<price_field>, but it looks like pretty good stuff.
<self-justify>
The reason all of this is so complicated is that other means were too
slow. I did investigate Parse::RecDescent and other types of parsers,
and did significant work on those before settling on this. It is difficult
to beat split() and ^anchored regexes for speed in Perl. And the compiled
nature of UserTag makes it quite fast.
Pre-compilation of the entire price expression was not an option because
the price settors can come from a database.
Despite the complexity of this stuff, people seem to use it and sometimes
even seem to understand it. It is significantly faster than any rule-based
parser I ran across, and when you are running [item-price] over a list
of 50 or more items in a search list that makes a big difference.
</self-justify>
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
"Even if you're on the right track, you'll get run over if you just
sit there." -- Will Rogers