Revision 591

Date:
2016/09/15 12:25:22
Author:
ahitrov
Revision Log:
Coupon with min order sum filter now takes the sum correctly.

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/webshop/lib/webshop/Coupon.pm

     
    122 122 next unless $bi->{item}->price > 0 && $bi->{item}->storage;
    123 123 $found_sum += $bi->number * $bi->{item}->price;
    124 124 }
    125 return $found_sum > 0 ? $self->can_discount( $found_sum ) : 0;
    125 return $found_sum > 0 ? $self->can_discount( $found_sum, $sum_total ) : 0;
    126 126 }
    127 127
    128 128
     
    130 130 {
    131 131 my $self = shift;
    132 132 my $sum = shift;
    133 my $total = shift || $sum;
    133 134 return 0 unless $sum;
    134 135
    135 136 my $discount = $self->discount;
     
    144 145 }
    145 146 my $rest = $sum - $count;
    146 147 warn "Min Sum: $min_sum. Rest: $rest\n" if $DEBUG;
    147 $count = 0 if ($min_sum && $sum < $min_sum) || $rest <= 0;
    148 $count = 0 if ($min_sum && $total < $min_sum) || $rest <= 0;
    148 149 warn "Count: $count\n" if $DEBUG;
    149 150 return $count;
    150 151 }