Revision b3483d9c
Von Werner Hahn vor mehr als 7 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
636 | 636 |
|
637 | 637 |
sub _set_javascript { |
638 | 638 |
my ($self) = @_; |
639 |
$::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.File kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery);
|
|
639 |
$::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.shop_part);
|
|
640 | 640 |
$::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $self->part->id ]})});") if $self->part->id; |
641 | 641 |
} |
642 | 642 |
|
... | ... | |
803 | 803 |
# used by edit, save, delete and add |
804 | 804 |
|
805 | 805 |
if ( $::form->{part}{id} ) { |
806 |
return SL::DB::Part->new(id => $::form->{part}{id})->load(with => [ qw(makemodels prices translations partsgroup) ]); |
|
806 |
return SL::DB::Part->new(id => $::form->{part}{id})->load(with => [ qw(makemodels prices translations partsgroup shop_parts shop_parts.shop) ]);
|
|
807 | 807 |
} else { |
808 | 808 |
die "part_type missing" unless $::form->{part}{part_type}; |
809 | 809 |
return SL::DB::Part->new(part_type => $::form->{part}{part_type}); |
SL/Controller/ShopPart.pm | ||
---|---|---|
409 | 409 |
if ($::form->{shop_part_id}) { |
410 | 410 |
SL::DB::Manager::ShopPart->find_by(id => $::form->{shop_part_id}); |
411 | 411 |
} else { |
412 |
SL::DB::ShopPart->new(shop_id => $::form->{shop_id}, part_id => $::form->{part_id}); |
|
412 |
SL::DB::ShopPart->new(shop_id => $::form->{shop_id}, part_id => $::form->{part_id})->load(with => ['shop']);
|
|
413 | 413 |
}; |
414 | 414 |
} |
415 | 415 |
|
SL/DB/Part.pm | ||
---|---|---|
58 | 58 |
type => 'one to many', |
59 | 59 |
class => 'SL::DB::ShopPart', |
60 | 60 |
column_map => { id => 'part_id' }, |
61 |
manager_args => { with_objects => [ 'shop' ] }, |
|
61 | 62 |
}, |
62 | 63 |
); |
63 | 64 |
|
SL/DB/Shop.pm | ||
---|---|---|
9 | 9 |
use SL::DB::Manager::Shop; |
10 | 10 |
use SL::DB::Helper::ActsAsList; |
11 | 11 |
|
12 |
__PACKAGE__->meta->add_relationships( |
|
13 |
shop_parts => { |
|
14 |
type => 'one to many', |
|
15 |
class => 'SL::DB::ShopPart', |
|
16 |
column_map => { id => 'shop_id' }, |
|
17 |
}, |
|
18 |
); |
|
12 |
#__PACKAGE__->meta->add_relationships(
|
|
13 |
# shop_parts => {
|
|
14 |
# type => 'one to many',
|
|
15 |
# class => 'SL::DB::ShopPart',
|
|
16 |
# column_map => { id => 'shop_id' },
|
|
17 |
# },
|
|
18 |
#);
|
|
19 | 19 |
|
20 | 20 |
__PACKAGE__->meta->initialize; |
21 | 21 |
|
js/kivi.shop_part.js | ||
---|---|---|
67 | 67 |
|
68 | 68 |
// gets all categories from the webshop |
69 | 69 |
ns.get_all_categories = function(shop_part_id) { |
70 |
var form = $('form').serializeArray(); |
|
70 |
var form = new Array; //$('form').serializeArray();
|
|
71 | 71 |
form.push( { name: 'action', value: 'ShopPart/get_categories' } |
72 | 72 |
, { name: 'shop_part_id', value: shop_part_id } |
73 | 73 |
); |
templates/webpages/part/_shop.html | ||
---|---|---|
18 | 18 |
<th>[% LxERP.t8("Action") %]</th> |
19 | 19 |
</tr> |
20 | 20 |
</thead> |
21 |
|
|
22 |
[%- FOREACH shop_part = SHOP_PARTS %] |
|
21 |
[% # L.dump(SELF.part) %] |
|
22 |
[%- FOREACH shop_part = SELF.part.shop_parts %] |
|
23 |
[% IF !shop_part.shop.obsolete %] |
|
23 | 24 |
<tr class="listrow"> |
24 | 25 |
<td>[% HTML.escape( shop_part.shop.description ) %]</td> |
25 | 26 |
<td>[% L.html_tag('span', shop_part.active, id => 'shop_part_active_' _ shop_part.id ) %]</td> |
... | ... | |
38 | 39 |
kivi.shop_part.update_stock([% shop_part.id %]); |
39 | 40 |
}); |
40 | 41 |
</script> |
42 |
[% END %] |
|
41 | 43 |
[%- END %] |
42 | 44 |
[%- FOREACH shop = SHOPS_NOT_ASSIGNED %] |
43 | 45 |
<tr> |
... | ... | |
55 | 57 |
|
56 | 58 |
|
57 | 59 |
[% # L.dump(shop_part) %] |
58 |
<h2>[% LxERP.t8("Shopvariables and Images - valid for all shops") %]</h2> |
|
59 |
[%- IF CUSTOM_VARIABLES.size %] |
|
60 |
[% # L.dump(CUSTOM_VARIABLES) %] |
|
61 |
<div id="shop_custom_variables"> |
|
62 |
<p> |
|
63 |
<table> |
|
64 |
[%- FOREACH var = CUSTOM_VARIABLES %] |
|
65 |
[%- IF var.name.match('^shop_') %] |
|
66 |
<tr> |
|
67 |
[% # IF !var.partsgroup_filtered %] |
|
68 |
<td align="right" valign="top">[% HTML.escape(var.description) %]</td> |
|
69 |
[% # END %] |
|
70 |
<td align="right" valign="top">[% var.VALID_BOX %]</td> |
|
71 |
<td valign="top">[% var.HTML_CODE %]</td> |
|
72 |
</tr> |
|
73 |
[%- END %] |
|
74 |
[%- END %] |
|
75 |
</table> |
|
76 |
</p> |
|
77 |
</div> |
|
78 |
[%- END %] |
|
60 |
<h2>[% LxERP.t8("Shopimages - valid for all shops") %]</h2> |
|
79 | 61 |
[%- IF shop_part.part_id %] |
80 | 62 |
<script type="text/javascript"> |
81 | 63 |
$(function() { |
Auch abrufbar als: Unified diff
Shopmodul: Anpassungen an neuen Partcontroller; Shopkategorien gehen noch nicht