still more debug
This commit is contained in:
parent
0fb37d4f2a
commit
2b49692623
1 changed files with 6 additions and 4 deletions
|
|
@ -114,7 +114,7 @@ sub priceLineItem {
|
||||||
my $price = $self->{_event}->{price};
|
my $price = $self->{_event}->{price};
|
||||||
# get the list of discount passes that this event is "under"
|
# get the list of discount passes that this event is "under"
|
||||||
my @discountPasses = split(/::/,$self->{_event}->{passId});
|
my @discountPasses = split(/::/,$self->{_event}->{passId});
|
||||||
$self->session->errorHandler->warn('discount passes: '.Dumper(\@discountPasses));
|
# $self->session->errorHandler->warn('discount passes: '.Dumper(\@discountPasses));
|
||||||
# return the default behavior if this event does not have a pass assigned.
|
# return the default behavior if this event does not have a pass assigned.
|
||||||
return ($price * $quantity) unless (scalar(@discountPasses) && ($self->{_event}->{passType} eq 'member'));
|
return ($price * $quantity) unless (scalar(@discountPasses) && ($self->{_event}->{passType} eq 'member'));
|
||||||
# keep a running total of this line item.
|
# keep a running total of this line item.
|
||||||
|
|
@ -129,14 +129,14 @@ sub priceLineItem {
|
||||||
my $numberOfPasses = 0;
|
my $numberOfPasses = 0;
|
||||||
# find out if we have any of this pass's events in our cart.
|
# find out if we have any of this pass's events in our cart.
|
||||||
foreach my $item (@$cartItems) {
|
foreach my $item (@$cartItems) {
|
||||||
$self->session->errorHandler->warn('quantity of this pass event: '.$item->{quantity});
|
# $self->session->errorHandler->warn('quantity of this pass event: '.$item->{quantity});
|
||||||
$numberOfPasses += $item->{quantity} if (
|
$numberOfPasses += $item->{quantity} if (
|
||||||
$item->{item}->type eq 'Event'
|
$item->{item}->type eq 'Event'
|
||||||
&& isIn($item->{item}->{_event}->{productId},@passEvents)
|
&& isIn($item->{item}->{_event}->{productId},@passEvents)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($numberOfPasses) {
|
if ($numberOfPasses) {
|
||||||
$self->session->errorHandler->warn('adding a discount pass.');
|
# $self->session->errorHandler->warn('adding a discount pass.');
|
||||||
$passesInCart{$passId} = $numberOfPasses;
|
$passesInCart{$passId} = $numberOfPasses;
|
||||||
$totalPassesInCart += $numberOfPasses;
|
$totalPassesInCart += $numberOfPasses;
|
||||||
}
|
}
|
||||||
|
|
@ -147,6 +147,7 @@ sub priceLineItem {
|
||||||
my $numberOfThisPass = $passesInCart{$passId};
|
my $numberOfThisPass = $passesInCart{$passId};
|
||||||
# calculate discount.
|
# calculate discount.
|
||||||
if ($pass->{type} eq 'newPrice') {
|
if ($pass->{type} eq 'newPrice') {
|
||||||
|
$self->session->errorHandler->warn('discounted price: '.$pass->{amount});
|
||||||
$discountedPrice = (0 + $pass->{amount}) if ($price > (0 + $pass->{amount}));
|
$discountedPrice = (0 + $pass->{amount}) if ($price > (0 + $pass->{amount}));
|
||||||
} elsif ($pass->{type} eq 'amountOff') {
|
} elsif ($pass->{type} eq 'amountOff') {
|
||||||
# not yet implemented!
|
# not yet implemented!
|
||||||
|
|
@ -155,8 +156,9 @@ sub priceLineItem {
|
||||||
}
|
}
|
||||||
# while we still have passes and items left to discount.
|
# while we still have passes and items left to discount.
|
||||||
while ($numberOfThisPass && $quantity) {
|
while ($numberOfThisPass && $quantity) {
|
||||||
$self->session->errorHandler->warn('applying a discount pass.');
|
# $self->session->errorHandler->warn('applying a discount pass.');
|
||||||
$totalPrice += $discountedPrice;
|
$totalPrice += $discountedPrice;
|
||||||
|
$self->session->errorHandler->warn('new discounted price: '.$discountedPrice);
|
||||||
$quantity--;
|
$quantity--;
|
||||||
$numberOfThisPass--;
|
$numberOfThisPass--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue