Revision b6e62764
Von Werner Hahn vor mehr als 6 Jahren hinzugefügt
SL/ShopConnector/Shopware.pm | ||
---|---|---|
12 | 12 |
use LWP::Authen::Digest; |
13 | 13 |
use SL::DB::ShopOrder; |
14 | 14 |
use SL::DB::ShopOrderItem; |
15 |
use SL::DB::History; |
|
16 |
use SL::DB::File; |
|
15 | 17 |
use Data::Dumper; |
16 | 18 |
use Sort::Naturally (); |
17 | 19 |
use SL::Helper::Flash; |
... | ... | |
126 | 128 |
$pos_insert->save; |
127 | 129 |
$position++; |
128 | 130 |
} |
129 |
$shop_order->{positions} = $position; |
|
131 |
$shop_order->{positions} = $position-1;
|
|
130 | 132 |
|
131 | 133 |
# Only Customers which are not found will be applied |
132 | 134 |
my $proposals = SL::DB::Manager::Customer->get_all_count( |
... | ... | |
158 | 160 |
'fax' => $shop_order->billing_fax, |
159 | 161 |
'phone' => $shop_order->billing_phone, |
160 | 162 |
'ustid' => $shop_order->billing_vat, |
161 |
'taxincluded_checked' => 1, # TODO hardcoded
|
|
162 |
'taxincluded' => 1, # TODO hardcoded
|
|
163 |
'klass' => 908, # TODO hardcoded
|
|
164 |
'taxzone_id' => 4, # TODO hardcoded, use default taxzone instead
|
|
163 |
'taxincluded_checked' => $self->config->pricetype eq "brutto" ? 1 : 0,
|
|
164 |
'taxincluded' => $self->config->pricetype eq "brutto" ? 1 : 0,
|
|
165 |
'klass' => (split '\/',$self->config->price_source)[1],
|
|
166 |
'taxzone_id' => $self->config->taxzone_id,
|
|
165 | 167 |
'currency' => 1, # TODO hardcoded |
166 | 168 |
'payment_id' => 7345,# TODO hardcoded |
167 | 169 |
); |
... | ... | |
203 | 205 |
$shipping_pos_insert->save; |
204 | 206 |
|
205 | 207 |
} |
206 |
my $attributes->{last_order_number} = $ordnumber; |
|
207 |
$self->config->assign_attributes( %{ $attributes } ); |
|
208 |
$self->config->save; |
|
209 |
$ordnumber++; |
|
210 | 208 |
# EOT Versandkosten DF |
209 |
my $attributes->{last_order_number} = $ordnumber; |
|
210 |
$self->config->assign_attributes( %{ $attributes } ); |
|
211 |
$self->config->save; |
|
212 |
$ordnumber++; |
|
211 | 213 |
} |
212 | 214 |
} |
213 | 215 |
my $shop = $self->config->description; |
... | ... | |
238 | 240 |
} |
239 | 241 |
|
240 | 242 |
sub update_part { |
241 |
my ($self, $shop_part, $json) = @_; |
|
243 |
my ($self, $shop_part, $json, $todo) = @_;
|
|
242 | 244 |
|
243 | 245 |
#shop_part is passed as a param |
244 | 246 |
die unless ref($shop_part) eq 'SL::DB::ShopPart'; |
... | ... | |
303 | 305 |
$taxrate = @$rate[0]->{taxrate}*100; |
304 | 306 |
|
305 | 307 |
# mapping to shopware still missing attributes,metatags |
306 |
my %shop_data = ( name => $part->{description}, |
|
307 |
tax => $taxrate, |
|
308 |
mainDetail => { number => $part->{partnumber}, |
|
309 |
inStock => $part->{onhand}, |
|
310 |
prices => [ { from => 1, |
|
311 |
price => $price, |
|
312 |
customerGroupKey => 'EK', |
|
313 |
}, |
|
314 |
], |
|
315 |
}, |
|
316 |
supplier => $cvars->{freifeld_7}->{value}, |
|
317 |
descriptionLong => $shop_part->{shop_description}, |
|
318 |
active => $shop_part->active, |
|
319 |
images => [ @upload_img ], |
|
320 |
__options_images => { replace => 1, }, |
|
321 |
categories => [ @cat ], |
|
322 |
description => $shop_part->{shop_description}, |
|
323 |
active => $shop_part->active, |
|
324 |
images => [ @upload_img ], |
|
325 |
__options_images => { replace => 1, }, |
|
326 |
categories => [ @cat ], #{ path => 'Deutsch|test2' }, ], #[ $categories ], |
|
327 |
|
|
328 |
) |
|
329 |
; |
|
308 |
my %shop_data; |
|
309 |
$main::lxdebug->dump(0, 'WH:TODO ',\$todo); |
|
310 |
|
|
311 |
if($todo eq "price"){ |
|
312 |
%shop_data = ( mainDetail => { number => $part->{partnumber}, |
|
313 |
prices => [ { from => 1, |
|
314 |
price => $price, |
|
315 |
customerGroupKey => 'EK', |
|
316 |
}, |
|
317 |
], |
|
318 |
}, |
|
319 |
); |
|
320 |
}elsif($todo eq "stock"){ |
|
321 |
%shop_data = ( mainDetail => { number => $part->{partnumber}, |
|
322 |
inStock => $part->{onhand}, |
|
323 |
}, |
|
324 |
); |
|
325 |
}elsif($todo eq "price_stock"){ |
|
326 |
%shop_data = ( mainDetail => { number => $part->{partnumber}, |
|
327 |
inStock => $part->{onhand}, |
|
328 |
prices => [ { from => 1, |
|
329 |
price => $price, |
|
330 |
customerGroupKey => 'EK', |
|
331 |
}, |
|
332 |
], |
|
333 |
}, |
|
334 |
); |
|
335 |
}elsif($todo eq "active"){ |
|
336 |
%shop_data = ( mainDetail => { number => $part->{partnumber}, |
|
337 |
}, |
|
338 |
active => ($part->{partnumber} == 1 ? 0 : 1), |
|
339 |
); |
|
340 |
}elsif($todo eq "all"){ |
|
341 |
# mapping to shopware still missing attributes,metatags |
|
342 |
%shop_data = ( name => $part->{description}, |
|
343 |
tax => $taxrate, |
|
344 |
mainDetail => { number => $part->{partnumber}, |
|
345 |
inStock => $part->{onhand}, |
|
346 |
active => $shop_part->active, |
|
347 |
prices => [ { from => 1, |
|
348 |
price => $price, |
|
349 |
customerGroupKey => 'EK', |
|
350 |
}, |
|
351 |
], |
|
352 |
}, |
|
353 |
supplier => $cvars->{freifeld_7}->{value}, |
|
354 |
descriptionLong => $shop_part->{shop_description}, |
|
355 |
active => $shop_part->active, |
|
356 |
images => [ @upload_img ], |
|
357 |
__options_images => { replace => 1, }, |
|
358 |
categories => [ @cat ], |
|
359 |
description => $shop_part->{shop_description}, |
|
360 |
active => $shop_part->active, |
|
361 |
images => [ @upload_img ], |
|
362 |
__options_images => { replace => 1, }, |
|
363 |
categories => [ @cat ], |
|
364 |
); |
|
365 |
}else{ |
|
366 |
my %shop_data = ( mainDetail => { number => $part->{partnumber}, }); |
|
367 |
} |
|
368 |
$main::lxdebug->dump(0, 'WH:SHOPDATA ',\%shop_data); |
|
369 |
|
|
330 | 370 |
my $dataString = SL::JSON::to_json(\%shop_data); |
331 | 371 |
$dataString = encode_utf8($dataString); |
332 | 372 |
|
... | ... | |
338 | 378 |
#update |
339 | 379 |
my $partnumber = $::form->escape($part->{partnumber});#shopware dosn't accept / in articlenumber |
340 | 380 |
my $upload = $self->connector->put("http://$url/api/articles/$partnumber?useNumberAsId=true",Content => $dataString); |
381 |
$main::lxdebug->dump(0, 'WH:iUPLOAD ',\$upload); |
|
382 |
|
|
341 | 383 |
my $data_json = $upload->content; |
342 | 384 |
$upload_content = SL::JSON::decode_json($data_json); |
343 | 385 |
}else{ |
... | ... | |
346 | 388 |
my $data_json = $upload->content; |
347 | 389 |
$upload_content = SL::JSON::decode_json($data_json); |
348 | 390 |
} |
391 |
# Don't know if this is needed |
|
349 | 392 |
if(@upload_img) { |
350 | 393 |
my $partnumber = $::form->escape($part->{partnumber});#shopware don't accept / in articlenumber |
351 | 394 |
$self->connector->put("http://$url/api/generateArticleImages/$partnumber?useNumberAsId=true"); |
Auch abrufbar als: Unified diff
Shopmodul: ShopPart: Artikel hochladen und Anzeigen
Webshop:: ShopPart
Webshop:: ShopPart
WebShop: ShopPart - Formatierungen ShopPart
Meldung bei Bildern wenn der Artikel noch keinem Shop zugeordnet ist
Conflicts:
templates/webpages/ic/tabs/_shop.html
Webshop: ShopPart Backgroundjob Upload
Conflicts:
SL/BackgroundJob/ShopPartMassUpload.pm
SL/ShopConnector/Shopware.pm
menus/user/10-shopimport.yaml
templates/webpages/shop_part/_list_articles.html
templates/webpages/shop_part/_transfer_status.html
templates/webpages/shop_part/_upload_status.html
Webshop: ShopPart - Webpart Filter nach Anbauer und Shop Anfang
Conflicts:
SL/Controller/ShopPart.pm
Webshop: ShopPart Menu
Conflicts:
menus/user/10-shopimport.yaml
Webshop: ShopPart
Webshop: ShopPart - Mergefehler in templates/webpages/ic/tabs/_shop.html
Conflicts:
templates/webpages/ic/tabs/_shop.html
Webshop: ShopPart
Conflicts:
templates/webpages/shop_part/_filter.html
WebShop: ShopPart - Unterschiedliche Uploadmöglichkeiten (Alles, Nur Preis, Nur Bestand, Bestand und Preis)
Conflicts:
menus/user/10-shopimport.yaml
Conflicts:
SL/Controller/ShopPart.pm
SL/ShopConnector/Shopware.pm
templates/webpages/shop_part/_list_articles.html
WebShop: ShopPart - Shopartikelliste Aktiv grafik
Conflicts:
SL/Controller/ShopPart.pm
SL/ShopConnector/Shopware.pm
js/kivi.shop_part.js
t/background_job/known_jobs.t
Conflicts:
SL/Controller/ShopPart.pm
SL/DB/ShopPart.pm
templates/webpages/ic/tabs/_shop.html