initialization (interchange-5.8.2) | : | initialization (interchange-5.10.0) | ||
---|---|---|---|---|
<!-- [set old_browser]1[/set][calc] | [weight hide=1 matrix=1 no-free-shipping=1] | |||
## Browser check, standalone so syntax error will not | ||||
## kill init code | ||||
my $regex = $Variable->{MV_DHTML_BROWSER}; | ||||
$regex ||= 'MSIE (?:[5-9]|\d\d).*Windows|Mozilla.*Gecko|Opera.*[7-9]'; | ||||
$regex = qr/$regex/; | ||||
if($Session->{browser} =~ $regex) { | ||||
delete $Scratch->{old_browser}; | ||||
} | ||||
return $Scratch->{old_browser} ? 'Not a DHTML browser' : 'DHTML browser'; | ||||
[/calc] --> | ||||
[perl tables="products country"] | [perl tables="products country"] | |||
## This section sets the shipping, handling, taxing, and payment | ## This section sets the shipping, handling, taxing, and payment initializations | |||
## initializations, as well as browser check | ||||
# Initialize country: | ## Initialize country: | |||
$Values->{country} ||= $Variable->{SHIP_DEFAULT_COUNTRY}; | $Values->{country} ||= $Variable->{SHIP_DEFAULT_COUNTRY}; | |||
# Initialize shipmode: | ## reset shipping to default if current mv_shipmode is not a valid mode. | |||
my @possible_and_valid = split ',', $Scratch->{ship_poss}; | ||||
my $curr = $Values->{mv_shipmode}; | ||||
my $ok = 0; | ||||
for(@possible_and_valid) { | ||||
$ok = 1 if $_ eq $curr; | ||||
} | ||||
unless($ok) { | ||||
$Tag->tmp('ship_reset', 1); | ||||
#Debug("doing ship_reset... possible_and_valid = " . join ',',@possible_and_vali | ||||
d); | ||||
} | ||||
## Initialize shipmode: | ||||
if ($Values->{mv_shipmode} eq 'default') { | if ($Values->{mv_shipmode} eq 'default') { | |||
my $shipmode = $Tag->data('country', 'shipmodes', $Values->{count ry}); | my $shipmode = $Tag->data('country', 'shipmodes', $Values->{count ry}); | |||
$shipmode =~ s/^\s+//; | $shipmode =~ s/^\s+//; | |||
$shipmode =~ s/\s.*//; | $shipmode =~ s/\s.*//; | |||
$Values->{mv_shipmode} = $shipmode; | $Values->{mv_shipmode} = $shipmode; | |||
} | } | |||
## Start with payment mode if none there | ## Start with payment mode if none there | |||
$Values->{mv_order_profile} ||= $Variable->{DEFAULT_PAYMENT_MODE} | $Values->{mv_order_profile} ||= $Variable->{DEFAULT_PAYMENT_MODE} | |||
||'credit_card'; | ||'credit_card'; | |||
## Check for COD order | ## Check for COD order | |||
my @handling; | my @handling; | |||
if($Values->{mv_handling}) { | if($Values->{mv_handling}) { | |||
@handling = split /[\s,\0]+/, $Values->{mv_handling}; | @handling = split /[\s,\0]+/, $Values->{mv_handling}; | |||
@handling = grep /\S/ && $_ ne 'cod', @handling; | @handling = grep /\S/ && $_ ne 'cod', @handling; | |||
$Values->{mv_handling} = join " ", @handling; | $Values->{mv_handling} = join " ", @handling; | |||
} | } | |||
if($Values->{mv_order_profile} eq 'cod') { | if($Values->{mv_order_profile} eq 'cod') { | |||
push @handling, 'cod'; | push @handling, 'cod'; | |||
} | } | |||
if(@handling) { | if(@handling) { | |||
$Values->{mv_handling} = join " ", @handling; | $Values->{mv_handling} = join " ", @handling; | |||
} | } | |||
#Debug("mv_handling=$Values->{mv_handling}"); | #Debug("mv_handling=$Values->{mv_handling}"); | |||
return; | return; | |||
[/perl] | [/perl] | |||
[if scratch ship_reset] | ||||
[shipping mode="__SHIP_DEFAULT_MODE__" default=1 hide=1] | ||||
[/if] | ||||
End of changes. 7 change blocks. | ||||
19 lines changed or deleted | 19 lines changed or added |