]>
Commit | Line | Data |
---|---|---|
58baa27b TC |
1 | package BSE::TB::ProductOption; |
2 | use strict; | |
3 | use base 'Squirrel::Row'; | |
4 | ||
5 | sub columns { | |
6 | return qw/id product_id name type global_ref display_order enabled default_value/; | |
7 | } | |
8 | ||
9 | sub table { | |
10 | "bse_product_options"; | |
11 | } | |
12 | ||
13 | sub defaults { | |
14 | return | |
15 | ( | |
16 | global_ref => undef, | |
17 | enabled => 1, | |
18 | type => "select", | |
19 | default_value => 0, | |
20 | ); | |
21 | } | |
22 | ||
23 | sub values { | |
24 | my ($self) = @_; | |
25 | ||
26 | require BSE::TB::ProductOptionValues; | |
27 | return sort { $a->{display_order} <=> $b->{display_order} } | |
28 | BSE::TB::ProductOptionValues->getBy(product_option_id => $self->{id}); | |
29 | } | |
30 | ||
31 | sub key { | |
32 | my $self = shift; | |
33 | return "prodopt_" . $self->id; | |
34 | } | |
35 | ||
36 | 1; |