Revision 138df19f
Von Tamino Steinert vor 15 Tagen hinzugefügt
- ID 138df19f61695aa7bcd5022404656e8e83b0b4e5
- Vorgänger 87572c0d
SL/Controller/ShopPart.pm | ||
---|---|---|
288 | 288 |
|
289 | 289 |
my $is_new = !$self->shop_part->id; |
290 | 290 |
my $params = delete($::form->{shop_part}) || { }; |
291 |
|
|
292 |
my $shop = SL::DB::Manager::Shop->find_by(id => $params->{shop_id}); |
|
293 |
if ($shop && $shop->connector eq 'shopware6') { |
|
294 |
die t8("Part Metatag Title is too long for this Shopware version. It should have lower than 255 characters.") |
|
295 |
if length $params->{metatag_title} > 255; |
|
296 |
die t8("Part Metatag Description is too long for this Shopware version. It should have lower than 255 characters.") |
|
297 |
if length $params->{metatag_description} > 255; |
|
298 |
} |
|
299 |
|
|
291 | 300 |
$self->shop_part->assign_attributes(%{ $params }); |
292 | 301 |
$self->shop_part->save; |
293 | 302 |
|
SL/ShopConnector/Shopware6.pm | ||
---|---|---|
134 | 134 |
? _u8($part->notes) |
135 | 135 |
: _u8($shop_part->shop_description); |
136 | 136 |
|
137 |
$update_p->{metaTitle} = _u8($shop_part->metatag_title) if $shop_part->metatag_title; |
|
138 |
$update_p->{metaDescription} = _u8($shop_part->metatag_description) if $shop_part->metatag_description; |
|
139 |
$update_p->{keywords} = _u8($shop_part->metatag_keywords) if $shop_part->metatag_keywords; |
|
140 |
|
|
137 | 141 |
# locales simple check for english |
138 | 142 |
my $english = SL::DB::Manager::Language->get_first(query => [ description => { ilike => 'Englisch' }, |
139 | 143 |
or => [ template_code => { ilike => 'en' } ], |
... | ... | |
180 | 184 |
} |
181 | 185 |
undef $update_p->{partNumber}; # we dont need this one |
182 | 186 |
$ret = $self->connector->PATCH('api/product/' . $one_d->{id}, to_json($update_p)); |
183 |
unless (204 == $ret->responseCode()) { |
|
184 |
die t8('Part Description is too long for this Shopware version. It should have lower than 255 characters.') |
|
185 |
if $ret->responseContent() =~ m/Diese Zeichenkette ist zu lang. Sie sollte.*255 Zeichen/; |
|
186 |
die "Updating part with " . $part->partnumber . " failed: " . $ret->responseContent() unless (204 == $ret->responseCode()); |
|
187 |
} |
|
187 |
$self->_die_on_error($part, $ret) unless (204 == $ret->responseCode()); |
|
188 | 188 |
} else { |
189 | 189 |
# create part |
190 | 190 |
# 1. get the correct tax for this product |
... | ... | |
227 | 227 |
$update_p->{price}->[0]->{linked} = \1; # link product variants |
228 | 228 |
|
229 | 229 |
$ret = $self->connector->POST('api/product', to_json($update_p)); |
230 |
die "Create for Product " . $part->partnumber . " failed: " . $ret->responseContent() unless (204 == $ret->responseCode());
|
|
230 |
$self->_die_on_error($part, $ret) unless (204 == $ret->responseCode());
|
|
231 | 231 |
} |
232 | 232 |
|
233 | 233 |
# if there are images try to sync this with the shop_part |
... | ... | |
242 | 242 |
|
243 | 243 |
return 1; # no invalid response code -> success |
244 | 244 |
} |
245 |
|
|
246 |
sub _die_on_error { |
|
247 |
my ($self, $part, $ret) = @_; |
|
248 |
|
|
249 |
die t8('Part Description is too long for this Shopware version. It should have lower than 255 characters.') |
|
250 |
if $ret->responseContent() =~ m/Diese Zeichenkette ist zu lang. Sie sollte.*255 Zeichen/ |
|
251 |
&& $ret->responseContent() =~ m/description/; |
|
252 |
die t8('Part Metatag Title is too long for this Shopware version. It should have lower than 255 characters.') |
|
253 |
if $ret->responseContent() =~ m/Diese Zeichenkette ist zu lang. Sie sollte.*255 Zeichen/ |
|
254 |
&& $ret->responseContent() =~ m/metaTitle/; |
|
255 |
die t8('Part Metatag Description is too long for this Shopware version. It should have lower than 255 characters.') |
|
256 |
if $ret->responseContent() =~ m/Diese Zeichenkette ist zu lang. Sie sollte.*255 Zeichen/ |
|
257 |
&& $ret->responseContent() =~ m/metaDescription/; |
|
258 |
die t8("Action for part #1 failed: #2", $part->partnumber, $ret->responseContent()); |
|
259 |
}; |
|
260 |
|
|
245 | 261 |
sub sync_all_categories { |
246 | 262 |
my ($self, %params) = @_; |
247 | 263 |
|
locale/de/all | ||
---|---|---|
174 | 174 |
'Accrual' => 'Soll-Versteuerung', |
175 | 175 |
'Accrual accounting' => 'Soll-Versteuerung', |
176 | 176 |
'Action' => 'Aktion', |
177 |
'Action for part #1 failed: #2' => 'Aktion für Artikel #1 ist fehlgeschlagen: #2', |
|
177 | 178 |
'Actions' => 'Aktionen', |
178 | 179 |
'Active' => 'Aktiv', |
179 | 180 |
'Active shops:' => 'Webshops aktiv', |
... | ... | |
2809 | 2810 |
'Part Description' => 'Artikelbeschreibung', |
2810 | 2811 |
'Part Description is too long for this Shopware version. It should have lower than 255 characters.' => 'Artikelbeschreibung enthält mehr als 255 Zeichen. Shopware in dieser Version kann nur Artikelbeschreibungen mit weniger als 255 Zeichen verarbeiten.', |
2811 | 2812 |
'Part Description missing!' => 'Artikelbezeichnung fehlt!', |
2813 |
'Part Metatag Description is too long for this Shopware version. It should have lower than 255 characters.' => 'Metatag Beschreibung enthält mehr als 255 Zeichen. Shopware in dieser Version kann nur Beschreibungen mit weniger als 255 Zeichen verarbeiten.', |
|
2814 |
'Part Metatag Title is too long for this Shopware version. It should have lower than 255 characters.' => 'Metatag Titel enthält mehr als 255 Zeichen. Shopware in dieser Version kann nur Titel mit weniger als 255 Zeichen verarbeiten.', |
|
2812 | 2815 |
'Part Notes' => 'Bemerkungen', |
2813 | 2816 |
'Part Number' => 'Artikelnummer', |
2814 | 2817 |
'Part Number missing!' => 'Artikelnummer fehlt!', |
locale/en/all | ||
---|---|---|
174 | 174 |
'Accrual' => '', |
175 | 175 |
'Accrual accounting' => '', |
176 | 176 |
'Action' => '', |
177 |
'Action for part #1 failed: #2' => '', |
|
177 | 178 |
'Actions' => '', |
178 | 179 |
'Active' => '', |
179 | 180 |
'Active shops:' => '', |
... | ... | |
2808 | 2809 |
'Part Description' => '', |
2809 | 2810 |
'Part Description is too long for this Shopware version. It should have lower than 255 characters.' => '', |
2810 | 2811 |
'Part Description missing!' => '', |
2812 |
'Part Metatag Description is too long for this Shopware version. It should have lower than 255 characters.' => '', |
|
2813 |
'Part Metatag Title is too long for this Shopware version. It should have lower than 255 characters.' => '', |
|
2811 | 2814 |
'Part Notes' => '', |
2812 | 2815 |
'Part Number' => '', |
2813 | 2816 |
'Part Number missing!' => '', |
Auch abrufbar als: Unified diff
Shopware6: Matatags (Titel, Beschreibung, Keywords) in Shop übernehmen