[ic] Datamining with Interchange

Stefan Hornburg racke@linuxia.de
06 Feb 2001 19:08:46 +0100


"Phillip A. Ryals" <support@admiralexpress.com> writes:

> Hi all,
> 
> I'm new here, and I hope this hasn't been asked before...
> 
> I'm looking at Interchange to replace my company's current ecom software.
> It's a proprietary/unstable piece that I'm not allowed to touch (it's in
> another state).  The best option (and I've investigated many) is to create a
> new one.
> 
> The problem is that we have a proprietary system that all business runs on.
> Our current software interfaces through a gateway to get realtime customer
> pricing (via contracts) and a real system order number.  The nice thing is
> that it's all done for us, and we can just pull the order up in the system
> as if customer service put it in themselves.
> 
> I'm curious whether Interchange might be adaptable to this type of
> environment.  It would mean somehow linking it to a gateway that it could
> query for pricing. 

This should be quite possible. An example for a customized pricing
(you can use a global usertag which has the full power of Perl):

# Pricing 
UserTag calc_price Order code quantity
UserTag calc_price Routine <<EOF
sub {
    my ($code, $quantity);

	if ($Vend::Interpolate::item) {
		$code = $Vend::Interpolate::item->{code};
		$quantity = $Vend::Interpolate::item->{quantity};
	} else {
		($code, $quantity) = @_;
    }

	# sanity check
	if ($code !~ /^\d+$/ || $quantity !~ /^\d+$/) {
		Log ("Wrong input for calc_price: CODE $code QUANTITY $quantity");
        return;
    }

    my $db = Vend::Data::database_exists_ref('price');
	my $keys = $db->query ("select price,min from price where component_idf = $code order by min");
	my $price;

	if (@$keys) {
		# fallback price
		$price = $keys->[0]->[0];
		# check for appropriate price
		for (my $i = 0; $i < @$keys; $i++) {
			if ($quantity > $keys->[$i]->[1]) {
				$price = $keys->[$i]->[0];
			}
		}
	}
	$price;
}
EOF

CommonAdjust [calc_price]

> Also, when the order is placed, Interchange would need
> to let the order go through to our system (attaching the account number as
> the method of payment) instead of processing the order itself.

I produced a patch for IC so you can call any function "Sub" from
within a order route, so this is feasible too.

Ciao
        Racke

-- 
LinuXia Systems && Cobolt NetServices, eCommerce and more
Shop- und Datenbanklösungen mit MiniVend, Firewalls auf Debian-Basis
http://www.linuxia.de - http://www.cobolt.net
--> Junior Officer of the MiniVend/Interchange Bug Patrol <---