[ic] Pricing Questions

Thomas J.M. Burton tom at globalfocusdm.com
Wed Jun 9 18:19:03 EDT 2004

Hello IC Users,

I'm currently working on a major upgrade to a client's catalog that has
been running on Minivend for a few years now. I'm rebuilding it in
Interchange 5.0 and in doing so am trying to stay within IC's 
established way of doing things as much as possible (i.e. no crazy 
custom code).

This client has a few specialized discounts that have been handled in
the past using some custom code. I'd like to know if these can be
handled using the pricing table and CommonAdjust.

One of these is a video discount. If four or more videos are ordered,
they take 10% off of the price of all videos in the order. The other is
for some training hurdles, order 6 or more in either of two sizes and
10% is discounted from the price of all hurdles in the order. The code
that's been used in the Minivend catalog is as follows:

   [perl arg=scratch interpolate=1]
       $tq{"[item-code]"} = "[item-quantity]";
       if ('[item-field category]' eq 'Videos') {
         $qv += [item-quantity], $sv += [discount-price noformat=1] * 
       $Safe{'scratch'}{'q_videos'} = $qv;
       $Safe{'scratch'}{'s_videos'} = $sv;
       $Safe{'scratch'}{'q_hurdles'} = $tq{"HURDLE6"} + $tq{"HURDLE12"};

This takes the contents of the cart, picks out all items that have 
category=Videos, and creates a Video Subtotal ($sv) and a Video Quantity 
Count ($qv). It assigns those to scratch values q_videos and s_videos, 
respectively. A scratch value for Hurdle quantity is also set.

Then, I have the following:

   [if scratch q_videos >= 4]
     [discount ENTIRE_ORDER]
       my $d = (1 - 0.90) * $sv;
       return $s - $d;
     [discount ENTIRE_ORDER][/discount]

This checks the q_videos to see if the combined video quantity qualifies 
for the discount. If so, it takes 10% of the video subtotal and 
discounts the entire order by that dollar amount.

This is also done for the Hurdles, but with a slight twist. There's also 
a Product of the Month that gets a 10% discount. The Hurdles are a 
Product of the Month during a couple of months and the 10% applies on 
top of any quantity discount. So, in the code to discount the Hurdles, I 
have a few extra checks to do a double discount if necessary:

   [if scratch q_hurdles >= 6]
     [set promoHURDLE]1[/set]
     [set promo_noteHURDLE6]Promo Price (ordered 6 or more hurdles)[/set]
     [set promo_noteHURDLE12]Promo Price (ordered 6 or more hurdles)[/set]
     [set promoHURDLE][/set]
     [set promo_noteHURDLE6][/set]
     [set promo_noteHURDLE12][/set]
   [if scratch hurdleDisc][and scratch promoHURDLE]
     [discount HURDLE6] ($s * .9) *.9 [/discount]
     [discount HURDLE12] ($s * .9) *.9 [/discount]
   [elsif scratch promoHURDLE]
     [discount HURDLE6] $s * .9 [/discount]
     [discount HURDLE12] $s * .9 [/discount]
     [discount HURDLE6][/discount]
     [discount HURDLE12][/discount]

So is this possible using what exists in IC's foundation template (using 
price groups, perhaps)? If so, could someone please provide an example 
of how it should be set up? Otherwise, I'll just be cleaning up some of 
that old PERL and working it into the new catalog.

Thomas J.M. Burton
Design & Production Director + Other Hats
Global Focus Digital Media, LLC

More information about the interchange-users mailing list