[ic] new discounting scheme

Russell Mann interchange-users@icdevgroup.org
Thu Jun 19 18:18:01 2003


> > I think I'm going to take my discount scheme a different
> > direction.  Could I
> > have a second price field in the database for "members"?  How
> > would I get IC
> > to use this alternate price field only for those who qualify?
>
> This is already built in. What version of IC are you using?
>
> Below is a snippit from the 4.9.8 catalog.cfg, which should
> explain itself.
>
> Jonathan
> www.webmaint.net

I'm on 4.8.3.

This is what I have in catalog.cfg currently:

PriceField     CommonAdjust

CommonAdjust   pricing:price_group,q3,q4,q5,q10, ;products:price, ;$
AutoModifier   pricing:price_group
AutoModifier   products:gift_cert

--------
I'm using some quantity pricing fields.

If I add this:

Profile member <<EOR
{
	CommonAdjust => <<EOF,
		pricing:price_group,q3,q4,q5,q10, ;products:member_price, ;$EOF
	NonTaxableField => 'nontaxable',
}
EOR

How would I tell interchange when a person is a member or not?  This is my
usertag that determines membership when a person logs into the member site:

UserTag member_compare_date Order username
UserTag member_compare_date addAttr
UserTag member_compare_date Interpolate
UserTag member_compare_date Routine <<EOR
sub {
use Date::Manip;
my $table = "userdb";
my $field = "member_expire_date";
my $message;
my ($username) = @_;
my $member_expire_date = &ParseDate($Tag->data($table, $field, $username));
my $today = &ParseDate("yesterday");
my $date_flag = &Date_Cmp($member_expire_date,$today);
if ($date_flag < 0) {
        $message = "Expired";
  } elsif ($date_flag == 0) {
        $message = "Success";
  } else {
        $message = "Success";
  }

return $message;
}
EOR


I use that usertag on a page like this:

[if scratch members_only]
[if !session logged_in][bounce href="[area help/mlogin]"][/if]
[if !scratch membership][seti membership][member_compare_date
username="[data session username]"][/seti][/if]
[if scratch membership =~ /Expired/][bounce href="[area
expired_membership]"][/if]
[/if]


Can I use the same usertag to tell IC which pricing profile to use?  Also,
will it work to just add the pricing code I mentioned above to my current
setup?  Or am I missing something?

Thanks,

Russell