[interchange-cvs] interchange - heins modified
code/UserTag/weight.tag
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Wed May 18 21:07:24 EDT 2005
User: heins
Date: 2005-05-19 01:07:24 GMT
Modified: code/UserTag weight.tag
Log:
* Add ability to give free shipping on certain items via the [weight]
tag.
For the purposes of the [weight] tag, free shipping is defined
as not assigning a weight for that item. This should be obvious,
but some users might misunderstand.
To make an item have no weight, you just set the mv_free_shipping
attribute in the item hash, i.e.
[calc]
for my $it (@$Items) {
$it->{mv_free_shipping} = 1
if free_shipping_check($it->{code});
}
return;
[/calc]
You can override this behavior by passing the no-free-shipping=1 parameter
to the weight tag. For example:
[weight no-free-shipping=`
# no free shipping outside our country
return 1 if $Values->{country} ne 'US';
# no ground shipping available, not free
return 1 if $Values->{state} =~ /AK|HI/;
# Free shipping in US and Canada
`]
A better example might be to have separate shipping modes for
AK and HI, and use [weight no-free-shipping=1] as the criteria
there.
Revision Changes Path
1.5 +3 -2 interchange/code/UserTag/weight.tag
rev 1.5, prev_rev 1.4
Index: weight.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/weight.tag,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- weight.tag 10 Feb 2005 14:38:39 -0000 1.4
+++ weight.tag 19 May 2005 01:07:24 -0000 1.5
@@ -1,10 +1,10 @@
# Copyright 2002 Interchange Development Group (http://www.icdevgroup.org/)
# Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: weight.tag,v 1.4 2005/02/10 14:38:39 docelic Exp $
+# $Id: weight.tag,v 1.5 2005/05/19 01:07:24 mheins Exp $
UserTag weight Order attribute
UserTag weight addAttr
-UserTag weight Version $Revision: 1.4 $
+UserTag weight Version $Revision: 1.5 $
UserTag weight Routine <<EOR
sub {
my ($attr, $opt) = @_;
@@ -92,6 +92,7 @@
my $total = 0;
for(@$cart) {
+ next if $_->{mv_free_shipping} && ! $opt->{no_free_shipping};
$total += $_->{quantity} * $wsub->($_);
next unless $osub;
$total += $_->{quantity} * $osub->($_);
More information about the interchange-cvs
mailing list