[ic] Force a payment method at checkout for some items

Mike Heins interchange-users@icdevgroup.org
Thu Jan 23 12:21:06 2003


Quoting Paco S?nchez (lists@e-civitas.com):
> From: "Mike Heins" <mike@perusion.com>
> >
> > It would be better to have a "cod_allowed" field in pricing or inventory.
> >
> > This is a typical need of tying the database to the shopping cart
> > to test for shipping/pricing alternatives. IC has some facilities
> > that make it fairly easy to do it.
> >
> 
> Could I do this for only allowing a shipping method in case COD is selected
> as payment method?

Of course.

> The problem here is that COD is only compatible with normal shipping with
> the post office (well, the truth is that it is with other shipping methods,
> but at a higher rate, thus I would rather disallow it with those shipping
> methods).
> 
> > Add a column to the inventory database (or anywhere you choose) named
> > "cod_allowed". Set it to 1 if COD is allowed, blank otherwise.
> >
> > In catalog.cfg:
> >
> > AutoModifier  inventory:cod_allowed
> >
> > (Of course you restart/apply changes, having changed configuration.)
> >
> > Now there will be a cod_allowed attribute in the shopping cart. At that
> point,
> > you can do:
> >
> > [calc]
> > $Scratch->{allow_cod} = 1;
> > foreach my $item (@$Items) {
> > next if $item->{cod_allowed};
> > $Scratch->{allow_cod} = 0;
> > last;
> > }
> > return;
> > [/calc]
> >
> > Now you can test for your allowed payment methods:
> >
> > [if scratch allow_cod]
> > # ITL you need to enable COD
> > [/if]
> >
> 
> Now I guess this tag in particular could also be applied to shipping by
> doing something like
> 
> [if scratch allow_cod]
> # allow only Standard Post Office shipping
> [else]
> # allow all shipping method for that destination
> [/else]
> [/if]
> 
> However I do not really see where to apply it.  If it is done in the html
> for the shipping methods menu (checkout.html), the only effect is just not
> displaying it.  Any clues, or something like this cannot be used for
> shipping?

You could put [if scratch allow_cod] somewhere in the cost or criterion
field, and set it to 0 if not set. 

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

For a successful technology, reality must take precedence over public
relations, for Nature cannot be fooled. -- Dick Feynman