Revision 471
- Date:
- 2015/01/22 18:01:04
- Files:
Legend:
- Added
- Removed
- Modified
-
utf8/plugins/webshop/lib/webshop/Keeper.pm
128 128 } 129 129 @items = $keeper->get_documents ( 130 130 class => 'webshop::Basket', 131 status => 1, 131 status => [1,0], 132 132 order_id=> 0, 133 133 uid => $opts{uid}, 134 134 ); 135 my $total = 0; 136 my $sum = 0; 135 my ($basket_total, $basket_sum, $wishlist_total, $wishlist_sum) = (0,0,0,0); 137 136 foreach my $item ( @items ) { 138 $total += $item->number; 139 $sum += $item->number * $item->price; 137 if ( $item->status == 1 ) { 138 $basket_total += $item->number; 139 $basket_sum += $item->number * $item->price; 140 } else { 141 $wishlist_total += $item->number; 142 $wishlist_sum += $item->number * $item->price; 143 } 140 144 } 141 my @plugins = split (/[\ |\t]+/, $state->{plugins}); 142 if ( grep { $_ eq 'session' } @plugins && ref $session ) { 143 $session->set ( basket_total => $total, basket_sum => $sum ); 144 } 145 warn "Merge end\n" if $DEBUG; 146 return ($total, $sum); 145 warn "Merge end\n" if $DEBUG; 146 return ($basket_total, $basket_sum, $wishlist_total, $wishlist_sum); 147 147 } 148 148 149 149 -
utf8/plugins/webshop/lib/webshop/SQL/Basket.pm
167 167 sub _session_filter { 168 168 my ($self,%opts)=@_; 169 169 return undef unless ( exists $opts{session} ); 170 return &SQL::Common::_generic_text_filter('d.session', $opts{session}); 170 if ( $opts{session} && !ref $opts{session} ) { 171 my $que = '(d.session IN (?) AND (d.uid IS NULL OR d.uid = 0))'; 172 return $que, [$opts{session}]; 173 } else { 174 return &SQL::Common::_generic_text_filter('d.session', $opts{session}); 175 } 171 176 } 172 177 173 178 sub _item_filter {