[ic] Item Discount Persists when clearing ALL_ITEMS

IC ic at tvcables.co.uk
Wed Feb 2 09:19:17 UTC 2011


> > > 	%{$Session->{discount}} = ();
> >
> > Newer versions of Interchange use the $Discounts hashref instead, so the
> > above code becomes:
> > %$Discounts = ();
> 
> Either one should work, as they are the same hash reference....
> 
> >
> > > if you don't want to preserve the special ENTIRE_ORDER
> > > and ALL_ITEMS discounts. If you do, then you could run:
> >
> > delete @{$Discounts}{grep { !/^(ALL_ITEMS|ENTIRE_ORDER)$/ } keys
> > %$Discounts}; # Untested, but should work.
> 
> Of course. But a lot of people would be surprised to find that
> it saves mostly typing, and not much processor power. I try
> and write for clarity when possible.

Thanks Mike and Peter, I used %{$Session->{discount}} = (); and it does
exactly what I wanted.

Best regards
Andy.





More information about the interchange-users mailing list