[ic] [shipping] mode ignoring one set of rows in shipping.asc

Barry Treahy, Jr. interchange-users@icdevgroup.org
Thu Sep 5 16:42:03 2002


Below is a segment from the checkout page.  The intent is that if a 
catalog is the only item on the order, that FREE be the 'SELECTED' 
option available in the list of options for the MV_SHIPMODE select where 
FREE represents free postal mailing if the quantity is one, otherwise it 
is a fixed rate per quantity.  Here is the segment from the shipping.asc 
file:

code    description     criteria        min     max     cost
FREE    Free Shipping!  quantity        0       0       e Nothing to ship!
FREE    Free Shipping!  quantity        1       1       f 0.00
FREE    Postal Mailing! quantity        2       9999    f 3.00 * @@TOTAL@@
FREE    Postal Mailing! quantity        10000   999999  e Too many free 
catalogs

The problem that I'm experiencing is that even if I properly detect the 
scenario for the use of the FREE code, and insert that into a scratch 
variable that is then used with the [shipping mode] ITL, IC is ignoring 
it.  I have gone as far as presenting the MV_SHIPMODE but the results 
are still the same, the prefixed list still ignores the modification.

Here is the source code snippet with the runtime results:

<!-- key='US' mv_shipmode=1DA mv_handling= -->
<!-- FPO FSO F2D FEG 1DM 1DA 2DA GNDCOM -->
	                    <select NAME=mv_shipmode>

<!-- ShipMode=FREE FPO FSO F2D FEG 1DM 1DA 2DA GNDCOM mv_shipmode=FREE mv_handling= -->

	      <option VALUE="FPO">FedEx Priority Overnight ($25.00)<option VALUE="FSO">FedEx Standard Overnight ($23.00)<option VALUE="F2D">FedEx 2-Day ($10.00)<option VALUE="FEG">FedEx Ground ($4.00)<option VALUE="1DM">UPS Next Day Early AM ($54.00)<option VALUE="1DA">UPS Next Day ($25.00)<option VALUE="2DA">UPS 2nd Day ($23.00)<option VALUE="GNDCOM">UPS Ground ($6.50)
	                    </select>

and the actual code from the below... I'm receiving no errors and cannot 
isolate why this is not working...

Recommendations?

Barry

<!-- key='[default country US]' mv_shipmode=[value mv_shipmode] 
mv_handling=[value mv_handling] -->
<!-- [data table=country key='[default country US]' col=shipmodes] -->
                            <SELECT NAME=mv_shipmode>
[perl]
$Tag->iclog('checkout: Free S&H check');
my $country=$Values->{country};
$Tag->iclog('checkout: country: ' . $country);
my $shipmode=$Values->{mv_shipmode};
$Tag->iclog('checkout: mv_shipmode: ' . $shipmode);
$modes=$Tag->data('country', 'shipmodes', $country);
$Tag->iclog('checkout: modes: ' . $modes);
my $count=0;
my $catalog=0;
delete $Scratch->{ShipMode};
foreach $item ( @{ $Carts->{'main'} } ) {
  $Tag->iclog('checkout: item:' . $item->{'code'});
  if ($item->{'code'} =~ m/^CAT-/) {
    $catalog=1;
  }
  $count=+1;
}
$out = $modes;
$Tag->iclog('checkout: catalog: ' . $catalog . ', count: ' . $count);
if ($catalog == 1) {
  if ($count == 1) {
    $out = 'FREE ' . $modes;
    $shipmode = 'FREE';
  }
}
$Tag->iclog('checkout: out: ' . $out);
$Tag->iclog('checkout: mv_shipmode: ' . $shipmode);
$Scratch->{ShipMode}=$out;
$Values->{mv_shipmode}=$shipmode;
return;
[/perl]
<!-- ShipMode=[scratch ShipMode] mv_shipmode=[value mv_shipmode] 
mv_handling=[value mv_handling] -->
              [shipping
                label=1
                mode=|[scratch ShipMode]|
              ]
                            </SELECT>
                          </td>