Revision 5a84725c
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.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.shop_part); |
|
639 |
$::request->layout->use_javascript("${_}.js") for qw(kivi.Part kivi.PriceRule ckeditor/ckeditor ckeditor/adapters/jquery kivi.shop_part kivi.FileUploader);
|
|
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 |
|
SL/Controller/ShopPart.pm | ||
---|---|---|
140 | 140 |
|
141 | 141 |
require SL::Shop; |
142 | 142 |
my $shop = SL::Shop->new( config => $self->shop_part->shop ); |
143 |
|
|
143 | 144 |
my $categories = $shop->connector->get_categories; |
144 | 145 |
|
145 | 146 |
$self->js |
... | ... | |
149 | 150 |
$self->render('shop_part/categories', { output => 0 }, CATEGORIES => $categories ) |
150 | 151 |
) |
151 | 152 |
->reinit_widgets; |
153 |
$self->js->render; |
|
152 | 154 |
|
153 | 155 |
$self->js->render; |
154 | 156 |
} |
SL/ShopConnector/Shopware.pm | ||
---|---|---|
212 | 212 |
my $data = $self->connector->get("http://$url/api/categories"); |
213 | 213 |
|
214 | 214 |
my $data_json = $data->content; |
215 |
$main::lxdebug->dump(0, 'WH:DATA ',\$data_json); |
|
215 | 216 |
my $import = SL::JSON::decode_json($data_json); |
217 |
$main::lxdebug->dump(0, 'WH:DATA2 ',\$import); |
|
216 | 218 |
my @daten = @{$import->{data}}; |
217 | 219 |
my %categories = map { ($_->{id} => $_) } @daten; |
218 | 220 |
|
... | ... | |
221 | 223 |
$parent->{children} ||= []; |
222 | 224 |
push @{$parent->{children}},$_; |
223 | 225 |
} |
226 |
$main::lxdebug->dump(0, 'WH:DATA3 ',\@daten); |
|
224 | 227 |
|
225 | 228 |
return \@daten; |
226 | 229 |
} |
js/kivi.shop_part.js | ||
---|---|---|
3 | 3 |
|
4 | 4 |
// this is called by sub render, with a certain prerendered html (edit.html,categories.html) |
5 | 5 |
ns.shop_part_dialog = function(title, html) { |
6 |
alert('HALLO'); |
|
6 | 7 |
var id = 'jqueryui_popup_dialog'; |
7 | 8 |
var dialog_params = { |
8 | 9 |
id: id, |
... | ... | |
15 | 16 |
$('#' + id).remove(); |
16 | 17 |
|
17 | 18 |
$dialog = $('<div style="display:none" id="' + id + '"></div>').appendTo('body'); |
19 |
alert('HALLO'); |
|
18 | 20 |
$dialog.attr('title', title); |
19 | 21 |
$dialog.html(html); |
20 | 22 |
$dialog.dialog(dialog_params); |
... | ... | |
67 | 69 |
|
68 | 70 |
// gets all categories from the webshop |
69 | 71 |
ns.get_all_categories = function(shop_part_id) { |
70 |
var form = new Array; //$('form').serializeArray(); |
|
71 |
form.push( { name: 'action', value: 'ShopPart/get_categories' } |
|
72 |
, { name: 'shop_part_id', value: shop_part_id } |
|
73 |
); |
|
74 |
|
|
75 |
$.post('controller.pl', form, function(data) { |
|
72 |
//var form = new Array; //$('form').serializeArray(); |
|
73 |
//form.push( { name: 'action', value: 'ShopPart/get_categories' } |
|
74 |
// , { name: 'shop_part_id', value: shop_part_id } |
|
75 |
//); |
|
76 |
$.post('controller.pl', { action: 'ShopPart/get_categories', shop_part_id: shop_part_id }, function(data) { |
|
76 | 77 |
kivi.eval_json_result(data); |
77 | 78 |
}); |
79 |
//$.post('controller.pl', form, function(data) { |
|
80 |
// kivi.eval_json_result(data); |
|
81 |
//}); |
|
78 | 82 |
} |
79 | 83 |
// write categories in kivi DB not in the shops DB TODO: create new categories in the shops db |
80 | 84 |
ns.save_categories = function(shop_part_id, shop_id) { |
Auch abrufbar als: Unified diff
Shopmodul: Anpassungen an neuen Partcontroller