Revision a42d9378
Von Werner Hahn vor mehr als 8 Jahren hinzugefügt
SL/Controller/Shop.pm | ||
---|---|---|
127 | 127 |
# whether the shop presents its prices as brutto or netto |
128 | 128 |
$self->price_types( [ { id => "brutto", name => t8('brutto')}, { id => "netto", name => t8('netto') } ] ); |
129 | 129 |
|
130 |
# the possible price sources to use for the shops: sellprice, lastcost, |
|
130 |
# the possible default price sources to use for the shops: sellprice, lastcost,
|
|
131 | 131 |
# listprice, or one of the pricegroups |
132 | 132 |
my $pricesources; |
133 |
push( @{ $pricesources } , { id => "sellprice", name => t8("Sellprice") },
|
|
134 |
{ id => "listprice", name => t8("Listprice") },
|
|
135 |
{ id => "lastcost", name => t8("Lastcost") }
|
|
133 |
push( @{ $pricesources } , { id => "master_data/sellprice", name => t8("Master Data")." - ".t8("Sellprice") },
|
|
134 |
{ id => "master_data/listprice", name => t8("Master Data")." - ".t8("Listprice") },
|
|
135 |
{ id => "master_data/lastcost", name => t8("Master Data")." - ".t8("Lastcost") }
|
|
136 | 136 |
); |
137 | 137 |
my $pricegroups = SL::DB::Manager::Pricegroup->get_all; |
138 | 138 |
foreach my $pg ( @$pricegroups ) { |
139 |
push( @{ $pricesources } , { id => $pg->id, name => $pg->pricegroup} );
|
|
139 |
push( @{ $pricesources } , { id => "pricegroup/".$pg->id, name => t8("Pricegroup") . " - " . $pg->pricegroup} );
|
|
140 | 140 |
}; |
141 | 141 |
|
142 | 142 |
$self->price_sources( $pricesources ); |
SL/Controller/ShopPart.pm | ||
---|---|---|
15 | 15 |
|
16 | 16 |
use Rose::Object::MakeMethods::Generic |
17 | 17 |
( |
18 |
scalar => [ qw(price_sources) ], |
|
18 | 19 |
'scalar --get_set_init' => [ qw(shop_part file) ], |
19 | 20 |
); |
20 | 21 |
|
21 | 22 |
__PACKAGE__->run_before('check_auth'); |
22 | 23 |
__PACKAGE__->run_before('add_javascripts', only => [ qw(edit_popup) ]); |
24 |
__PACKAGE__->run_before('load_pricesources', only => [ qw(create_or_edit_popup) ]); |
|
25 |
|
|
23 | 26 |
# |
24 | 27 |
# actions |
25 | 28 |
# |
... | ... | |
39 | 42 |
require SL::Shop; |
40 | 43 |
my $shop = SL::Shop->new( config => $shop_part->shop ); |
41 | 44 |
|
42 |
# TODO: generate data to upload to shop. Goes to SL::Connector::XXXConnector. Here the object holds all data from parts, shop_parts, files, custom_variables for one article
|
|
45 |
# data to upload to shop. Goes to SL::Connector::XXXConnector.
|
|
43 | 46 |
my $part_hash = $shop_part->part->as_tree; |
44 | 47 |
my $json = SL::JSON::to_json($part_hash); |
45 | 48 |
my $return = $shop->connector->update_part($self->shop_part, $json); |
... | ... | |
48 | 51 |
if ( $return == 1 ) { |
49 | 52 |
# TODO: write update time to DB |
50 | 53 |
my $now = DateTime->now; |
54 |
my $attributes->{last_update} = $now; |
|
55 |
$self->shop_part->assign_attributes(%{ $attributes }); |
|
56 |
$self->shop_part->save; |
|
51 | 57 |
$self->js->html('#shop_part_last_update_' . $shop_part->id, $now->to_kivitendo('precision' => 'minute')) |
52 | 58 |
->flash('info', t8("Updated part [#1] in shop [#2] at #3", $shop_part->part->displayable_name, $shop_part->shop->description, $now->to_kivitendo('precision' => 'minute') ) ) |
53 | 59 |
->render; |
... | ... | |
70 | 76 |
my ($self, %params) = @_; |
71 | 77 |
|
72 | 78 |
my $attributes = $::form->{ $::form->{form_prefix} } || die "Missing attributes"; |
73 |
$main::lxdebug->dump(0, 'WH: ATTRIBUTES: ', \$attributes); |
|
74 | 79 |
|
75 | 80 |
$attributes->{filename} = ((($::form->{ATTACHMENTS} || {})->{ $::form->{form_prefix} } || {})->{file_content} || {})->{filename}; |
76 | 81 |
|
... | ... | |
135 | 140 |
sub action_get_categories { |
136 | 141 |
my ($self) = @_; |
137 | 142 |
|
138 |
|
|
139 |
# my $shop_part = SL::DB::Manager::ShopPart->find_by(id => $::form->{shop_part_id}); |
|
140 |
# die unless $shop_part; |
|
141 | 143 |
require SL::Shop; |
142 | 144 |
my $shop = SL::Shop->new( config => $self->shop_part->shop ); |
143 | 145 |
my $categories = $shop->connector->get_categories; |
... | ... | |
146 | 148 |
->run( |
147 | 149 |
'kivi.shop_part.shop_part_dialog', |
148 | 150 |
t8('Shopcategories'), |
149 |
$self->render('shop_part/categories', { output => 0 }, CATEGORIES => $categories ) #, shop_part => $self->shop_part)
|
|
151 |
$self->render('shop_part/categories', { output => 0 }, CATEGORIES => $categories ) |
|
150 | 152 |
) |
151 | 153 |
->reinit_widgets; |
152 | 154 |
|
... | ... | |
159 | 161 |
$self->create_or_update; |
160 | 162 |
} |
161 | 163 |
|
164 |
sub action_show_price_n_pricesource { |
|
165 |
my ($self) = @_; |
|
166 |
|
|
167 |
my ( $price, $price_src_str ) = $self->get_price_n_pricesource($::form->{pricesource}); |
|
168 |
|
|
169 |
#TODO Price must be formatted. $price_src_str must be translated |
|
170 |
$self->js->html('#price_' . $self->shop_part->id, $price) |
|
171 |
->html('#active_price_source_' . $self->shop_part->id, $price_src_str) |
|
172 |
->render; |
|
173 |
} |
|
174 |
|
|
175 |
sub action_show_stock { |
|
176 |
my ($self) = @_; |
|
177 |
my ( $stock_local, $stock_onlineshop ); |
|
178 |
|
|
179 |
require SL::Shop; |
|
180 |
my $shop = SL::Shop->new( config => $self->shop_part->shop ); |
|
181 |
my $shop_article = $shop->connector->get_article($self->shop_part->part->partnumber); |
|
182 |
|
|
183 |
$stock_local = $self->shop_part->part->onhand; |
|
184 |
$stock_onlineshop = $shop_article->{data}->{mainDetail}->{inStock}; |
|
185 |
|
|
186 |
$self->js->html('#stock_' . $self->shop_part->id, $stock_local."/".$stock_onlineshop) |
|
187 |
->render; |
|
188 |
} |
|
189 |
|
|
190 |
|
|
162 | 191 |
sub create_or_update { |
163 | 192 |
my ($self) = @_; |
164 | 193 |
|
... | ... | |
171 | 200 |
|
172 | 201 |
$self->shop_part->save; |
173 | 202 |
|
203 |
my ( $price, $price_src_str ) = $self->get_price_n_pricesource($self->shop_part->active_price_source); |
|
204 |
|
|
205 |
#TODO Price must be formatted. $price_src_str must be translated |
|
174 | 206 |
flash('info', $is_new ? t8('The shop part has been created.') : t8('The shop part has been saved.')); |
175 | 207 |
$self->js->html('#shop_part_description_' . $self->shop_part->id, $self->shop_part->shop_description) |
176 | 208 |
->html('#shop_part_active_' . $self->shop_part->id, $self->shop_part->active) |
209 |
->html('#price_' . $self->shop_part->id, $price) |
|
210 |
->html('#active_price_source_' . $self->shop_part->id, $price_src_str) |
|
177 | 211 |
->run('kivi.shop_part.close_dialog') |
178 | 212 |
->flash('info', t8("Updated shop part")) |
179 | 213 |
->render; |
... | ... | |
240 | 274 |
$::request->{layout}->add_javascripts(qw(kivi.shop_part.js)); |
241 | 275 |
} |
242 | 276 |
|
277 |
sub load_pricesources { |
|
278 |
my ($self) = @_; |
|
279 |
|
|
280 |
# the price sources to use for the article: sellprice, lastcost, |
|
281 |
# listprice, or one of the pricegroups. It overwrites the default pricesource from the shopconfig. |
|
282 |
# TODO: implement valid pricerules for the article |
|
283 |
my $pricesources; |
|
284 |
push( @{ $pricesources } , { id => "master_data/sellprice", name => t8("Master Data")." - ".t8("Sellprice") }, |
|
285 |
{ id => "master_data/listprice", name => t8("Master Data")." - ".t8("Listprice") }, |
|
286 |
{ id => "master_data/lastcost", name => t8("Master Data")." - ".t8("Lastcost") } |
|
287 |
); |
|
288 |
my $pricegroups = SL::DB::Manager::Pricegroup->get_all; |
|
289 |
foreach my $pg ( @$pricegroups ) { |
|
290 |
push( @{ $pricesources } , { id => "pricegroup/".$pg->id, name => t8("Pricegroup") . " - " . $pg->pricegroup} ); |
|
291 |
}; |
|
292 |
|
|
293 |
$self->price_sources( $pricesources ); |
|
294 |
} |
|
295 |
|
|
296 |
sub get_price_n_pricesource { |
|
297 |
my ($self,$pricesource) = @_; |
|
298 |
|
|
299 |
my ( $price_src_str, $price_src_id ) = split(/\//,$pricesource); |
|
300 |
|
|
301 |
require SL::DB::Pricegroup; |
|
302 |
require SL::DB::Part; |
|
303 |
#TODO Price must be formatted. Translations for $price_grp_str |
|
304 |
my $price; |
|
305 |
if ($price_src_str eq "master_data") { |
|
306 |
my $part = SL::DB::Manager::Part->get_all( where => [id => $self->shop_part->part_id], with_objects => ['prices'],limit => 1)->[0]; |
|
307 |
$price = $part->$price_src_id; |
|
308 |
$price_src_str = $price_src_id; |
|
309 |
}else{ |
|
310 |
my $part = SL::DB::Manager::Part->get_all( where => [id => $self->shop_part->part_id, 'prices.'.pricegroup_id => $price_src_id], with_objects => ['prices'],limit => 1)->[0]; |
|
311 |
my $pricegrp = SL::DB::Manager::Pricegroup->find_by( id => $price_src_id )->pricegroup; |
|
312 |
$price = $part->prices->[0]->price; |
|
313 |
$price_src_str = $pricegrp; |
|
314 |
} |
|
315 |
return($price,$price_src_str); |
|
316 |
} |
|
317 |
|
|
243 | 318 |
sub check_auth { |
244 | 319 |
return 1; # TODO: implement shop rights |
245 | 320 |
# $::auth->assert('shop'); |
SL/DB/MetaSetup/Shop.pm | ||
---|---|---|
9 | 9 |
__PACKAGE__->meta->table('shops'); |
10 | 10 |
|
11 | 11 |
__PACKAGE__->meta->columns( |
12 |
connector => { type => 'text' }, |
|
13 |
description => { type => 'text' }, |
|
14 |
id => { type => 'serial', not_null => 1 }, |
|
15 |
login => { type => 'text' }, |
|
16 |
obsolete => { type => 'boolean', default => 'false', not_null => 1 }, |
|
17 |
password => { type => 'text' }, |
|
18 |
port => { type => 'integer' }, |
|
19 |
price_source => { type => 'text' }, |
|
20 |
pricetype => { type => 'text' }, |
|
21 |
sortkey => { type => 'integer' }, |
|
22 |
url => { type => 'text' }, |
|
12 |
connector => { type => 'text' }, |
|
13 |
description => { type => 'text' }, |
|
14 |
id => { type => 'serial', not_null => 1 }, |
|
15 |
last_order_number => { type => 'integer' }, |
|
16 |
login => { type => 'text' }, |
|
17 |
obsolete => { type => 'boolean', default => 'false', not_null => 1 }, |
|
18 |
orders_to_fetch => { type => 'integer' }, |
|
19 |
password => { type => 'text' }, |
|
20 |
port => { type => 'integer' }, |
|
21 |
price_source => { type => 'text' }, |
|
22 |
pricetype => { type => 'text' }, |
|
23 |
sortkey => { type => 'integer' }, |
|
24 |
url => { type => 'text' }, |
|
23 | 25 |
); |
24 | 26 |
|
25 | 27 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
SL/DB/MetaSetup/ShopPart.pm | ||
---|---|---|
9 | 9 |
__PACKAGE__->meta->table('shop_parts'); |
10 | 10 |
|
11 | 11 |
__PACKAGE__->meta->columns( |
12 |
active => { type => 'boolean', default => 'false', not_null => 1 }, |
|
13 |
front_page => { type => 'boolean', default => 'false', not_null => 1 }, |
|
14 |
id => { type => 'serial', not_null => 1 }, |
|
15 |
itime => { type => 'timestamp', default => 'now()' }, |
|
16 |
last_update => { type => 'timestamp' }, |
|
17 |
meta_tags => { type => 'text' }, |
|
18 |
mtime => { type => 'timestamp' }, |
|
19 |
part_id => { type => 'integer', not_null => 1 }, |
|
20 |
shop_category => { type => 'array' }, |
|
21 |
shop_description => { type => 'text' }, |
|
22 |
shop_id => { type => 'integer', not_null => 1 }, |
|
23 |
show_date => { type => 'date' }, |
|
24 |
sortorder => { type => 'integer' }, |
|
12 |
active => { type => 'boolean', default => 'false', not_null => 1 }, |
|
13 |
active_price_source => { type => 'text' }, |
|
14 |
front_page => { type => 'boolean', default => 'false', not_null => 1 }, |
|
15 |
id => { type => 'serial', not_null => 1 }, |
|
16 |
itime => { type => 'timestamp', default => 'now()' }, |
|
17 |
last_update => { type => 'timestamp' }, |
|
18 |
metatag_description => { type => 'text' }, |
|
19 |
metatag_keywords => { type => 'text' }, |
|
20 |
metatag_title => { type => 'text' }, |
|
21 |
mtime => { type => 'timestamp' }, |
|
22 |
part_id => { type => 'integer', not_null => 1 }, |
|
23 |
shop_category => { type => 'array' }, |
|
24 |
shop_description => { type => 'text' }, |
|
25 |
shop_id => { type => 'integer', not_null => 1 }, |
|
26 |
show_date => { type => 'date' }, |
|
27 |
sortorder => { type => 'integer' }, |
|
25 | 28 |
); |
26 | 29 |
|
27 | 30 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
SL/ShopConnector/Base.pm | ||
---|---|---|
13 | 13 |
|
14 | 14 |
sub update_part { die 'update_part needs to be implemented' } |
15 | 15 |
|
16 |
sub get_article { die 'get_article needs to be implemented' } |
|
17 |
|
|
16 | 18 |
sub get_categories { die 'get_order needs to be implemented' } |
17 | 19 |
1; |
18 | 20 |
|
SL/ShopConnector/Shopware.pm | ||
---|---|---|
171 | 171 |
|
172 | 172 |
my $url = $self->url; |
173 | 173 |
my $part = SL::DB::Part->new(id => $shop_part->{part_id})->load; |
174 |
$main::lxdebug->dump(0, 'WH: SHOPPART: ',\$part); |
|
174 | 175 |
|
175 |
# TODO: Prices (pricerules, pricegroups, |
|
176 |
# TODO: Prices (pricerules, pricegroups, multiple prices)
|
|
176 | 177 |
my $cvars = { map { ($_->config->name => { value => $_->value_as_text, is_valid => $_->is_valid }) } @{ $part->cvars_by_config } }; |
177 | 178 |
|
178 | 179 |
my @cat = (); |
179 | 180 |
foreach my $row_cat ( @{ $shop_part->shop_category } ) { |
180 | 181 |
my $temp = { ( id => @{$row_cat}[0], ) }; |
181 | 182 |
push ( @cat, $temp ); |
182 |
#push ( @cat, map { ( name => $_[1]) } @{ $row_cat } ); |
|
183 | 183 |
} |
184 | 184 |
|
185 | 185 |
my $images = SL::DB::Manager::File->get_all( where => [ modul => 'shop_part', trans_id => $part->{id} ]); |
186 |
|
|
187 |
#my $images2 = { map { |
|
188 |
# ( link => 'data:' . $_->{file_content_type} . ';base64,' . MIME::Base64::encode($_->{file_content},''), |
|
189 |
# description => $_->{title}, |
|
190 |
# position => $_->{position}, |
|
191 |
# extension => 'jpg', # muss $extionsion sein |
|
192 |
# path => $_->{filename}, # muss $path sein |
|
193 |
# ) } @{ $images } }; |
|
194 |
|
|
195 | 186 |
my @upload_img = (); |
196 | 187 |
foreach my $img (@{ $images }) { |
197 | 188 |
my ($path, $extension) = (split /\./, $img->{filename}); |
198 |
|
|
199 | 189 |
my $temp ={ ( link => 'data:' . $img->{file_content_type} . ';base64,' . MIME::Base64::encode($img->{file_content},''), |
200 | 190 |
description => $img->{title}, |
201 | 191 |
position => $img->{position}, |
202 | 192 |
extension => $extension, |
203 |
path => $path, |
|
204 | 193 |
)} ; |
205 | 194 |
push( @upload_img, $temp); |
206 | 195 |
} |
... | ... | |
231 | 220 |
my $dataString = SL::JSON::to_json(\%shop_data); |
232 | 221 |
$dataString = encode_utf8($dataString); |
233 | 222 |
|
223 |
my $upload_content; |
|
234 | 224 |
if($import->{success}){ |
235 | 225 |
#update |
236 | 226 |
#TODO partnumber escapen slash uri_encode |
237 | 227 |
my $upload = $self->connector->put("http://$url/api/articles/$part->{partnumber}?useNumberAsId=true",Content => $dataString); |
238 | 228 |
my $data_json = $upload->content; |
239 |
my $upload_content = SL::JSON::decode_json($data_json); |
|
240 |
return $upload_content->{success}; |
|
229 |
$upload_content = SL::JSON::decode_json($data_json); |
|
241 | 230 |
}else{ |
242 | 231 |
#upload |
243 | 232 |
my $upload = $self->connector->post("http://$url/api/articles/",Content => $dataString); |
244 | 233 |
my $data_json = $upload->content; |
245 |
my $upload_content = SL::JSON::decode_json($data_json); |
|
246 |
return $upload_content->{success}; |
|
234 |
$upload_content = SL::JSON::decode_json($data_json); |
|
235 |
} |
|
236 |
if(@upload_img) { |
|
237 |
$self->connector->put("http://$url/api/generateArticleImages/$part->{partnumber}?useNumberAsId=true"); |
|
238 |
#$self->connector->delete("http://$url/api/caches/"); |
|
247 | 239 |
} |
240 |
return $upload_content->{success}; |
|
241 |
} |
|
242 |
|
|
243 |
sub get_article { |
|
244 |
my ($self,$partnumber) = @_; |
|
248 | 245 |
|
246 |
my $url = $self->url; |
|
247 |
my $data = $self->connector->get("http://$url/api/articles/$partnumber?useNumberAsId=true"); |
|
248 |
my $data_json = $data->content; |
|
249 |
return SL::JSON::decode_json($data_json); |
|
249 | 250 |
} |
250 | 251 |
|
251 | 252 |
sub init_url { |
js/kivi.shop_part.js | ||
---|---|---|
107 | 107 |
$('#shop_images').load(url); |
108 | 108 |
} |
109 | 109 |
|
110 |
//shows the Name and price in _shop.html. Pricerules not implemented yet, just master_data and pricegroups |
|
111 |
ns.update_price_n_price_source = function(shop_part_id,price_source) { |
|
112 |
$.post('controller.pl', { action: 'ShopPart/show_price_n_pricesource', shop_part_id: shop_part_id, pricesource: price_source }, function(data) { |
|
113 |
kivi.eval_json_result(data); |
|
114 |
}); |
|
115 |
} |
|
116 |
//shows the local and the online stock |
|
117 |
ns.update_stock = function(shop_part_id) { |
|
118 |
$.post('controller.pl', { action: 'ShopPart/show_stock', shop_part_id: shop_part_id }, function(data) { |
|
119 |
kivi.eval_json_result(data); |
|
120 |
}); |
|
121 |
} |
|
122 |
|
|
110 | 123 |
}); |
sql/Pg-upgrade2/shop_parts_4.sql | ||
---|---|---|
1 |
-- @tag: shop_parts_4 |
|
2 |
-- @description: Add tables for part information for shop |
|
3 |
-- @charset: UTF-8 |
|
4 |
-- @depends: release_3_3_0 shops |
|
5 |
-- @ignore: 0 |
|
6 |
ALTER TABLE shop_parts ADD COLUMN active_price_source text; |
|
7 |
ALTER TABLE shop_parts ADD COLUMN metatag_keywords text; |
|
8 |
ALTER TABLE shop_parts ADD COLUMN metatag_description text; |
|
9 |
ALTER TABLE shop_parts ADD COLUMN metatag_title text; |
|
10 |
ALTER TABLE shop_parts DROP COLUMN meta_tags; |
sql/Pg-upgrade2/shops2.sql | ||
---|---|---|
1 |
-- @tag: shops2 |
|
2 |
-- @description: Alter table shops more columns for configuration |
|
3 |
-- @charset: UTF-8 |
|
4 |
-- @depends: release_3_4_0 shops |
|
5 |
-- @ignore: 0 |
|
6 |
|
|
7 |
ALTER TABLE shops ADD COLUMN last_order_number integer; |
|
8 |
ALTER TABLE shops ADD COLUMN orders_to_fetch integer; |
templates/webpages/ic/tabs/_shop.html | ||
---|---|---|
2 | 2 |
[%- USE Dumper %] |
3 | 3 |
[%- USE JavaScript -%] |
4 | 4 |
<div id="shop_variables"> |
5 |
[% LxERP.t8("Active shops:") %]
|
|
6 |
<table> |
|
5 |
<h2>[% LxERP.t8("Active shops:") %]</h2>
|
|
6 |
<table width="100%">
|
|
7 | 7 |
<thead> |
8 |
<tr> |
|
8 |
<tr class="listheading">
|
|
9 | 9 |
<th>[% LxERP.t8("Shop") %]</th> |
10 | 10 |
<th>[% LxERP.t8("Active") %]</th> |
11 | 11 |
<th>[% LxERP.t8("Shop part") %]</th> |
12 |
<th>[% LxERP.t8("Price source") %]</th> |
|
13 |
<th>[% LxERP.t8("Price") %]</th> |
|
14 |
<th>[% LxERP.t8("Stock Local/Shop") %]</th> |
|
12 | 15 |
<th>[% LxERP.t8("Last update") %]</th> |
13 | 16 |
<th>[% LxERP.t8("Action") %]</th> |
14 | 17 |
<th>[% LxERP.t8("Action") %]</th> |
18 |
<th>[% LxERP.t8("Action") %]</th> |
|
15 | 19 |
</tr> |
16 | 20 |
</thead> |
17 | 21 |
[%- FOREACH shop_part = SHOP_PARTS %] |
18 |
<tr> |
|
22 |
<tr class="listrow">
|
|
19 | 23 |
<td>[% HTML.escape( shop_part.shop.description ) %]</td> |
20 | 24 |
<td>[% L.html_tag('span', shop_part.active, id => 'shop_part_active_' _ shop_part.id ) %]</td> |
21 | 25 |
<td>[% L.html_tag('span', shop_part.shop_description, id => 'shop_part_description_' _ shop_part.id ) %]</td> |
26 |
<td> [% L.html_tag('span',LxERP.t8(), id => 'active_price_source_' _ shop_part.id) %] </td> |
|
27 |
<td>[% L.html_tag('span','Price', id => 'price_' _ shop_part.id) %]</td> |
|
28 |
<td>[% L.html_tag('span','Stock', id => 'stock_' _ shop_part.id) %]</td> |
|
22 | 29 |
<td>[% L.html_tag('span', shop_part.last_update.to_kivitendo('precision' => 'minute'), id => 'shop_part_last_update_' _ shop_part.id ) %]</td> |
23 | 30 |
<td>[% L.button_tag("kivi.shop_part.edit_shop_part(" _ shop_part.id _ ")", LxERP.t8("Edit")) %]</td> |
24 | 31 |
<td>[% L.button_tag("kivi.shop_part.update_shop_part(" _ shop_part.id _ ")", LxERP.t8("Upload")) %]</td> |
25 | 32 |
<td>[% L.button_tag("kivi.shop_part.get_all_categories(" _ shop_part.id _ ")", LxERP.t8("Shopcategories")) %]</td> |
26 | 33 |
</tr> |
34 |
<script type="text/javascript"> |
|
35 |
$(function() { |
|
36 |
kivi.shop_part.update_price_n_price_source([% shop_part.id %],'[% shop_part.active_price_source %]'); |
|
37 |
kivi.shop_part.update_stock([% shop_part.id %]); |
|
38 |
}); |
|
39 |
</script> |
|
27 | 40 |
[%- END %] |
28 | 41 |
[%- FOREACH shop = SHOPS_NOT_ASSIGNED %] |
29 | 42 |
<tr> |
... | ... | |
39 | 52 |
|
40 | 53 |
|
41 | 54 |
[% # L.dump(shop_part) %] |
42 |
<hr>
|
|
55 |
<h2>[% LxERP.t8("Shopvariables and Images - valid for all shops") %]</h2>
|
|
43 | 56 |
[%- IF CUSTOM_VARIABLES.size %] |
44 | 57 |
[% # L.dump(CUSTOM_VARIABLES) %] |
45 | 58 |
<div id="shop_custom_variables"> |
... | ... | |
62 | 75 |
[%- END %] |
63 | 76 |
<script type="text/javascript"> |
64 | 77 |
$(function() { |
65 |
kivi.shop_part.show_images([% shop_part.part_id %]);
|
|
78 |
kivi.shop_part.show_images([% shop_part.part_id %]); |
|
66 | 79 |
}); |
67 | 80 |
</script> |
68 | 81 |
<div id="shop_images" border=1 > |
templates/webpages/shop_part/edit.html | ||
---|---|---|
3 | 3 |
[%- USE L -%] |
4 | 4 |
[%- USE P -%] |
5 | 5 |
[%- USE LxERP -%] |
6 |
[%- USE Dumper -%] |
|
6 | 7 |
|
7 | 8 |
[% LxERP.t8("Part") %]: [% HTML.escape(SELF.shop_part.part.displayable_name) %]<br> |
8 | 9 |
[% LxERP.t8("Shop") %]: [% HTML.escape(SELF.shop_part.shop.description) %] |
9 |
|
|
10 |
[% Dumper.dump_html(SELF) %] |
|
10 | 11 |
<form action="controller.pl" method="post"> |
11 | 12 |
<div> |
12 | 13 |
[% IF SELF.shop_part.id %] |
... | ... | |
26 | 27 |
<td>[% LxERP.t8("Active") %]</td> |
27 | 28 |
<td>[% L.yes_no_tag("shop_part.active", SELF.shop_part.active) %]</td> |
28 | 29 |
</tr> |
30 |
<tr> |
|
31 |
<th align="right">[% 'Price Source' | $T8 %]</th> |
|
32 |
[% IF SELF.shop_part.active_price_source %] |
|
33 |
[% SET price_source = SELF.shop_part.active_price_source %] |
|
34 |
[% ELSE %] |
|
35 |
[% SET price_source = SELF.shop_part.shop.price_source %] |
|
36 |
[% END %] |
|
37 |
<td>[% L.select_tag('shop_part.active_price_source', SELF.price_sources, value_key = 'id', title_key = 'name', with_empty = 0, default = price_source, default_value_key='id' ) %]</td> |
|
38 |
</tr> |
|
29 | 39 |
<tr> |
30 | 40 |
<td>[% LxERP.t8("Sort order") %]</td> |
31 | 41 |
<td>[% L.input_tag("shop_part.sortorder", SELF.shop_part.sortorder, size=2) %]</td> |
... | ... | |
39 | 49 |
<td>[% L.yes_no_tag('shop_part.front_page', SELF.shop_part.front_page) %]</td> |
40 | 50 |
</tr> |
41 | 51 |
<tr> |
42 |
<td>[% LxERP.t8("Meta Tags") %]</td> |
|
43 |
<td>[% L.input_tag("shop_part.meta_tags", SELF.shop_part.meta_tags, size=2) %]</td> |
|
52 |
<td>[% LxERP.t8("Meta tag title") %]</td> |
|
53 |
<td>[% L.input_tag("shop_part.metatag_title", SELF.shop_part.metatag_title, size=12) %]</td> |
|
54 |
</tr> |
|
55 |
<tr> |
|
56 |
<td>[% LxERP.t8("Meta tag keywords") %]</td> |
|
57 |
<td>[% L.input_tag("shop_part.metatag_keywords", SELF.shop_part.metatag_keywords, size=22) %]</td> |
|
58 |
</tr> |
|
59 |
<tr> |
|
60 |
<td>[% LxERP.t8("Meta tag description") %]</td> |
|
61 |
<td>[% L.textarea_tag("shop_part.metatag_description", SELF.shop_part.metatag_description, rows=4) %]</td> |
|
44 | 62 |
</tr> |
45 | 63 |
</table> |
46 | 64 |
[% # L.dump(SELF.shop_part) %] |
templates/webpages/shops/form.html | ||
---|---|---|
1 | 1 |
[%- USE HTML -%][%- USE LxERP -%][%- USE L -%][%- USE P -%][%- USE T8 -%] |
2 |
[%- USE Dumper -%] |
|
2 | 3 |
|
3 | 4 |
[% SET style="width: 400px" %] |
4 | 5 |
[% SET size=34 %] |
5 | 6 |
|
6 | 7 |
<h1>[% HTML.escape(title) %]</h1> |
7 |
|
|
8 |
[% # Dumper.dump_html(SELF.shop) %] |
|
8 | 9 |
<form action="controller.pl" method="post"> |
9 | 10 |
|
10 | 11 |
[%- INCLUDE 'common/flash.html' %] |
... | ... | |
26 | 27 |
</tr> |
27 | 28 |
<tr> |
28 | 29 |
<th align="right">[% 'Price Source' | $T8 %]</th> |
29 |
<td>[% L.select_tag('shop.price_source', SELF.price_sources, value_key = 'id', title_key = 'name', with_empty = 1, default = SELF.shop.price_source, default_value_key='id' ) %]</td>
|
|
30 |
<td>[% L.select_tag('shop.price_source', SELF.price_sources, value_key = 'id', title_key = 'name', with_empty = 0, default = SELF.shop.price_source, default_value_key='id' ) %]</td>
|
|
30 | 31 |
</tr> |
31 | 32 |
<tr> |
32 | 33 |
<th align="right">[% 'URL' | $T8 %]</th> |
... | ... | |
39 | 40 |
<th align="right">[% 'User' | $T8 %]</th> |
40 | 41 |
<td>[%- L.input_tag("shop.login", SELF.shop.login, size=12) %]</td> |
41 | 42 |
</tr> |
42 |
<tr>
|
|
43 |
<tr> |
|
43 | 44 |
<th align="right">[% 'Password' | $T8 %]</th> |
44 | 45 |
<td>[%- L.input_tag("shop.password", SELF.shop.password, size=12) %]</td> |
45 | 46 |
</tr> |
46 |
</tr> |
|
47 |
<tr> |
|
48 |
<th align="right">[% 'Last ordernumber' | $T8 %]</th> |
|
49 |
<td>[%- L.input_tag("shop.last_order_number", SELF.shop.last_order_number, size=12) %]</td> |
|
50 |
</tr> |
|
51 |
<tr> |
|
52 |
<th align="right">[% 'Orders to fetch' | $T8 %]</th> |
|
53 |
<td>[%- L.input_tag("shop.orders_to_fetch", SELF.shop.orders_to_fetch, size=12) %]</td> |
|
54 |
</tr> |
|
47 | 55 |
<tr> |
48 | 56 |
<th align="right">[% 'Obsolete' | $T8 %]</th> |
49 | 57 |
<td>[% L.checkbox_tag('shop.obsolete', checked = SELF.shop.obsolete, for_submit=1) %]</td> |
Auch abrufbar als: Unified diff
Shoppart: Alle Daten werden angezeigt (Lager Lokal/Shop, Preisquelle, Preis) Lastupload Zeit wird in DB geschrieben und auch angezeigt.
Formatierungen in den js für Zahlen fehlen noch Kleinere TODOs