[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [ic] Size and Weight - Again!
On 28 Nov, Dave "Duke of URL" Weiner wrote:
> Hi all. I've spent the last 2 hours or so searching the mailing list
> archives. Like many before me, I need to modify the shipping weight by
> size. I think I've got an angle on how to do it, but before I start
> re-inventing the wheel, I have a few questions.
>
> 1) Has anybody else come up with a nice clean way to handle this?
>
> 2) On a related note, I've read the section of the manual on the Perl
> Objects. I think I understand them, but does anybody have any sample code
> on how to loop through every item in the main basket using $Items?
>
> I'm running MV 4.01
>
> Thanks in Advance!
An example as an UserTag:
######## do something with all items of the basket
# use it as [do-xyz-with-mybasket]
#
#
UserTag do-xyz-with-mybasket Interpolate 1
UserTag do-xyz-with-mybasket Routine <<EOF
sub {
package Vend::Interpolate;
my $cart;
$cart = $Vend::Items;
my $code;
my $qty;
my $myvalue1;
my $myvalue2;
# mytablename1 = products for example
my $mydb1 = 'mytablename1';
my $myfield1 = 'myfieldname1';
# my other table
my $mydb2 = 'mytablename2';
my $myfield2 = 'myfieldname2';
foreach my $item (@$cart){
$code = $item->{code};
$myvalue1 = Vend::Interpolate::tag_data($mydb1, $myfield1, $code);
$myvalue2 = Vend::Interpolate::tag_data($mydb2, $myfield2, $code);
$qty = $item->{quantity};
.
.
.
# example to do anything with the quantity of the items
if($qty == < > != etc...$qty ) {
some perl stuff....
}
}
return '';
}
EOF
Joachim
--
Hans-Joachim Leidinger
buch online jojo@buchonline.net
Munscheidstr. 14 FAX: +49 209 1671441
45886 Gelsenkirchen FAX: 0209 1671441
_______________________________________________
Interchange-users mailing list
Interchange-users@www.minivend.com
http://www.minivend.com/mailman/listinfo/interchange-users