[ic] Changing pricing based on any field

Nathan Wiger interchange-users@lists.akopia.com
Thu Jun 14 20:50:00 2001


Said "Mike Heins" <mikeh@minivend.com>:
>
> Quoting Nathan Wiger (nate@nateware.com):
>
> >    2. This field takes the format "name=price, name=price", so for
> >       example:
> >
> >           CBR=+25.00, Yamaha=+25.00
> >
> >    3. This field is split up appropriately, and a key is searched
> >       for one corresponding to the value of the main field chosen.
> >       So, if we chose "CBR" as our "size", then we would look
> >       in "size_price" for the key "CBR" and find the value "+25.00".
> >       If the key isn't found, no change is made to the price.
>
> It is done this much way in the 4.7.x options.

Right, my intent here was to maintain the same semantics as the separate
pricing database that currently exists.

> >    5. On checkout, these prices are added in the same order as
> >       the fields are listed with UseModifier. So, if we had
> >       said "UseModifier size color", then we would first go thru
> >       and look for "size_price" for that item, then "color_price".
> >
> > This has the advantage that it is flexible and can be tailored on a
per-item
> > basis. I supposed it could also be placed in an external table indexed
by
> > sku, but it seems like keeping it together in the products db would be
> > easier.
>
> And in addition, it is easy to write a UserTag that does the same thing. I
> have solved this problem many times, and it is almost easier to re-write
> the UserTag than it is to build a reusable version..

I've used UserTags to solve several different problems, but I guess I'm
confused how this could be used to tie into something as fundamental as
pricing? Perhaps UserTags are more powerful than I understand and can
override anything?

In order for this to work AFAIK, any UserTag would have to be able to plug
into the main pricing routines so that any arbitrary fields could make
changes to the price, correct? Is this a matter of adding a UserTag,
twiddling some hash values inside it, and adding an extra call in the
checkout stuff?

I realize this isn't a place for a complete UserTag tutorial, but reading
through the UserTag docs I've never gotten the impression they have this
capability.

Thanks,
Nate

--
Nathan Wiger
Systems Integrator and Perl Hacker
Nateware, Inc. -- www.nateware.com