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

Paco Sánchez interchange-users@icdevgroup.org
Thu Jan 23 05:46:01 2003


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?

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?

Regards,

Paco Sánchez
http://pacosanchez.com
mailto:psanchez%40pacosanchez%2ecom