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

Mike Heins interchange-users@icdevgroup.org
Sat Jan 18 10:08:00 2003


Quoting Paco S?nchez (lists@e-civitas.com):
> Hello
> 
> I have two groups of products, one which can accept COD or other payment
> methods, and another group which can only accept all methods but COD.
> 
> Is it anyway to force interchange to eliminate COD in the payment methods
> list at checkout when one of the items not accepting this kind of payment is
> included in the basket?
> 
> I suppose it can be done by adding a special prefix to the products SKU,
> like A-xxx for products accepting COD and B-xxx for all other products.
> Then a script could do it at the checkout page.

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.

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]
	

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

Friends don't let friends use Outlook. -- Bob Blaylock