[ic] Ship modes by prod_group

Joshua Lavin joshua at kingdomdesign.com
Tue May 17 16:09:36 EDT 2005

I need to offer Postal Book Rate shipping only when books are in the  
cart, and nothing else. All of our books are in the 'Books' product  
group, and I am using this code:

[if value country =~ /(^US)/]
[tmp shipmodes][data base=country field=shipmodes key='[default  
country US]'][/tmp]
          my $cat = q{[item-field prod_group]};
          my @modes = split /\s+/, $Scratch->{shipmodes};
          if ( $cat ne 'Books' ) {
             $Scratch->{shipmodes} = $Values->{mv_shipmode} = 'std';
           else {
             $Values->{mv_shipmode} = shift @modes unless $Values-> 
[/if]<!-- [scratch shipmodes] -->

Which I got from here:

Our country database has 'br std' for the US shipmodes.

The HTML comment on that last line shows the correct shipmodes ('std'  
unless all the prod_groups are Books), but the shipping widget (which  
comes directly after this code) has all the shipmodes no matter what  
items are in the cart.

What am I doing wrong in that the shipping widget is not getting  
updated? Or is there a better way to do this...?


Josh Lavin
Kingdom Design   http://www.kingdomdesign.com/

More information about the interchange-users mailing list