Revision 226002b0
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
SL/PriceSource/Discount.pm | ||
---|---|---|
46 | 46 |
|
47 | 47 |
=head1 NAME |
48 | 48 |
|
49 |
SL::PriceSource::Price - contrainer to pass calculated prices around
|
|
49 |
SL::PriceSource::Discount - contrainer to pass calculated discounts around
|
|
50 | 50 |
|
51 | 51 |
=head1 SYNOPSIS |
52 | 52 |
|
53 | 53 |
# in PriceSource::Base implementation |
54 |
$price = SL::PriceSource::Price->new(
|
|
54 |
$price = SL::PriceSource::Discount->new(
|
|
55 | 55 |
discount => 10, |
56 | 56 |
spec => 'summersale2014', # something you can easily parse later |
57 | 57 |
description => t8('10% discount during summer sale 2014'), |
58 | 58 |
price_source => $self, |
59 | 59 |
) |
60 | 60 |
|
61 |
# special empty price in SL::PriceSource, for internal use.
|
|
62 |
SL::PriceSource::Price->new(
|
|
61 |
# special empty discount in SL::PriceSource, for internal use.
|
|
62 |
SL::PriceSource::Discount->new(
|
|
63 | 63 |
description => t8('None (PriceSource)'), |
64 | 64 |
); |
65 | 65 |
|
66 | 66 |
# price can't be restored |
67 |
SL::PriceSource::Price->new(
|
|
67 |
SL::PriceSource::Discount->new(
|
|
68 | 68 |
missing => t8('Um, sorry, cannot find that one'), |
69 | 69 |
price_source => $self, |
70 | 70 |
); |
71 | 71 |
|
72 |
# invalid price
|
|
73 |
SL::PriceSource::Price->new(
|
|
74 |
price => $original_price,
|
|
72 |
# invalid discount
|
|
73 |
SL::PriceSource::Dicount->new(
|
|
74 |
discount => $original_discount,
|
|
75 | 75 |
spec => $original_spec, |
76 | 76 |
description => $original_description, |
77 | 77 |
invalid => t8('Offer expired #1 weeks ago', $dt->delta_weeks), |
... | ... | |
82 | 82 |
|
83 | 83 |
See L<SL::PriceSource> for information about the mechanism. |
84 | 84 |
|
85 |
This is a container for prices that are generated by L<SL::PriceSource::Base>
|
|
85 |
This is a container for discounts that are generated by L<SL::PriceSource::Base>
|
|
86 | 86 |
implementations. |
87 | 87 |
|
88 | 88 |
=head1 CONSTRUCTOR FIELDS |
... | ... | |
93 | 93 |
|
94 | 94 |
The discount in percent. A discount of 0 will be ignored. If passed as |
95 | 95 |
part of C<available_prices> it will be filtered out. If returned as |
96 |
C<best_price> or C<price_from_source> it will trigger a warning.
|
|
96 |
C<best_discount> or C<discount_from_source> it will trigger a warning.
|
|
97 | 97 |
|
98 | 98 |
=item C<spec> |
99 | 99 |
|
100 | 100 |
A unique string that can later be understood by the creating implementation. |
101 |
Can be empty if the implementation only supports one price for a given
|
|
101 |
Can be empty if the implementation only supports one discount for a given
|
|
102 | 102 |
record_item. |
103 | 103 |
|
104 | 104 |
=item C<description> |
105 | 105 |
|
106 |
A localized short description of the origins of this price.
|
|
106 |
A localized short description of the origins of this discount.
|
|
107 | 107 |
|
108 | 108 |
=item C<price_source> |
109 | 109 |
|
... | ... | |
111 | 111 |
|
112 | 112 |
=item C<missing> |
113 | 113 |
|
114 |
OPTIONAL. Both indicator and localized message that the price with this spec
|
|
114 |
OPTIONAL. Both indicator and localized message that the discount with this spec
|
|
115 | 115 |
could not be reproduced and should be changed. |
116 | 116 |
|
117 |
If price is missing, you do not need to supply anything except C<source>.
|
|
117 |
If discount is missing, you do not need to supply anything except C<source>.
|
|
118 | 118 |
|
119 | 119 |
=item C<invalid> |
120 | 120 |
|
121 | 121 |
OPTIONAL. Both indicator and localized message that the conditions for this |
122 |
price are no longer valid, and that the price should be changed.
|
|
122 |
discount are no longer valid, and that the discount should be changed.
|
|
123 | 123 |
|
124 |
If price is missing, you do not need to supply anything except C<source>.
|
|
124 |
If discount is missing, you do not need to supply anything except C<source>.
|
|
125 | 125 |
|
126 | 126 |
=back |
127 | 127 |
|
Auch abrufbar als: Unified diff
PriceSource: Dokufix