Revision 1a08d2aa
Von Jan Büren vor fast 3 Jahren hinzugefügt
SL/ShopConnector/Shopware6.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use Carp; |
8 | 8 |
use Encode qw(encode); |
9 |
use List::Util qw(first); |
|
9 | 10 |
use REST::Client; |
10 | 11 |
use Try::Tiny; |
11 | 12 |
|
... | ... | |
142 | 143 |
? $part->notes |
143 | 144 |
: $shop_part->shop_description; |
144 | 145 |
|
146 |
# locales simple check for english |
|
147 |
my $english = SL::DB::Manager::Language->get_first(query => [ description => { ilike => 'Englisch' }, |
|
148 |
or => [ template_code => { ilike => 'en' } ], |
|
149 |
]); |
|
150 |
if (ref $english eq 'SL::DB::Language') { |
|
151 |
# add english translation for product |
|
152 |
# TODO (or not): No Translations for shop_part->shop_description available |
|
153 |
my $translation = first { $english->id == $_->language_id } @{ $part->translations }; |
|
154 |
$update_p->{translations}->{'en-GB'}->{name} = $translation->{translation}; |
|
155 |
$update_p->{translations}->{'en-GB'}->{description} = $translation->{longdescription}; |
|
156 |
} |
|
145 | 157 |
|
146 | 158 |
$update_p->{stock} = $::form->round_amount($part->onhand, 0) if ($todo =~ m/(stock|all)/); |
147 | 159 |
# JSON::true JSON::false |
... | ... | |
893 | 905 |
|
894 | 906 |
=item C<update_part> |
895 | 907 |
|
908 |
Updates all metadata for a shop part. See base class for a general description. |
|
909 |
Specific Implementation notes: |
|
910 |
=over 4 |
|
911 |
|
|
912 |
=item * Calls sync_all_images with set_cover = 1 and delete_orphaned = 1 |
|
913 |
|
|
914 |
=item * Checks if longdescription should be taken from part or shop_part |
|
915 |
|
|
916 |
=item * Checks if a language with the name 'Englisch' or template_code 'en' |
|
917 |
is available and sets the shopware6 'en-GB' locales for the product |
|
918 |
|
|
919 |
=back |
|
920 |
|
|
896 | 921 |
=item C<sync_all_images (set_cover: 0|1, delete_orphaned: 0|1)> |
897 | 922 |
|
898 | 923 |
The connecting key for shopware to kivi images is the image name. |
Auch abrufbar als: Unified diff
Shopware6: Zumindestens englische Übersetzungen für Produkte übernehmen
S.a. POD