Skip to content

Commit

Permalink
FIX: shopware6 connector: Bilder Upload für Shopware >= v6.6 Beheben
Browse files Browse the repository at this point in the history
  • Loading branch information
rebootl committed Oct 17, 2024
1 parent de68b5b commit 2dccaf7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion SL/ShopConnector/Shopware6.pm
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,17 @@ sub sync_all_images {

# 2.1 no image with this title, create metadata for media and upload image
if (!$current_image_id) {
# get media folder id
$ret = $self->connector->GET('api/media-folder');
$response_code = $ret->responseCode();
die "Request failed, response code was: $response_code\n" . $ret->responseContent() unless $response_code == 200;
my $media_folder_id;
try {
$media_folder_id = from_json($ret->responseContent())->{data}->[0]->{id};
} catch { die "Malformed JSON Data: $_ " . $ret->responseContent(); };

# not yet uploaded, create media entry
$ret = $self->connector->POST("/api/media?_response=true");
$ret = $self->connector->POST("/api/media?_response=true", to_json({"mediaFolderId" => $media_folder_id}));
$response_code = $ret->responseCode();
die "Request failed, response code was: $response_code\n" . $ret->responseContent() unless $response_code == 200;
try {
Expand Down

0 comments on commit 2dccaf7

Please sign in to comment.