line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Nitesi::Product; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1033
|
use Moo; |
|
1
|
|
|
|
|
30647
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
114911
|
use Sub::Quote; |
|
1
|
|
|
|
|
6203
|
|
|
1
|
|
|
|
|
683
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Nitesi::Product - Product class for Nitesi Shop Machine |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Generic product class for L. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 PRODUCTS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Each product has the following attributes: |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=over 4 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item sku |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Unique product identifier. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item name |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Product name. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item short_description |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Short product description. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item description |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Full product description. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item price |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Product price. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=item uri |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Link to Product. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item weight |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Product weight in grams. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item priority |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
The product priority is used for sorting products on |
54
|
|
|
|
|
|
|
search results and category listings. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item inactive |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Inactive products are excluded from search results and |
59
|
|
|
|
|
|
|
category listings. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=back |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has sku => ( |
66
|
|
|
|
|
|
|
is => 'rw', |
67
|
|
|
|
|
|
|
); |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has name => ( |
70
|
|
|
|
|
|
|
is => 'rw', |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has short_description => ( |
74
|
|
|
|
|
|
|
is => 'rw', |
75
|
|
|
|
|
|
|
); |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
has description => ( |
78
|
|
|
|
|
|
|
is => 'rw', |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has price => ( |
82
|
|
|
|
|
|
|
is => 'rw', |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
has uri => ( |
86
|
|
|
|
|
|
|
is => 'rw', |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
has weight => ( |
90
|
|
|
|
|
|
|
is => 'rw', |
91
|
|
|
|
|
|
|
lazy => 1, |
92
|
|
|
|
|
|
|
default => quote_sub q{return 0;}, |
93
|
|
|
|
|
|
|
); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
has priority => ( |
96
|
|
|
|
|
|
|
is => 'rw', |
97
|
|
|
|
|
|
|
lazy => 1, |
98
|
|
|
|
|
|
|
default => quote_sub q{return 0;}, |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
has inactive => ( |
102
|
|
|
|
|
|
|
is => 'rw', |
103
|
|
|
|
|
|
|
lazy => 1, |
104
|
|
|
|
|
|
|
default => quote_sub q{return 0;}, |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 METHODS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 api_attributes |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
API attributes for product class. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
has api_attributes => ( |
116
|
|
|
|
|
|
|
is => 'rw', |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 api_info |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
API information for product class. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub api_info { |
126
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
127
|
|
|
|
|
|
|
|
128
|
2
|
|
|
|
|
20
|
return {base => __PACKAGE__, |
129
|
|
|
|
|
|
|
table => 'products', |
130
|
|
|
|
|
|
|
key => 'sku', |
131
|
|
|
|
|
|
|
attributes => $self->api_attributes, |
132
|
|
|
|
|
|
|
foreign => {'Nitesi::Navigation' => { |
133
|
|
|
|
|
|
|
table => 'navigation_products', |
134
|
|
|
|
|
|
|
key => [qw/sku navigation/]} |
135
|
|
|
|
|
|
|
}, |
136
|
|
|
|
|
|
|
}; |
137
|
|
|
|
|
|
|
}; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Stefan Hornburg (Racke), |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Copyright 2012-2013 Stefan Hornburg (Racke) . |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
148
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
149
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |