From ffc0e41bcb7e31d2c86c1035c4f3942ee9d7227b Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Wed, 5 Feb 2025 10:02:29 +0100 Subject: [PATCH] Improvements and Standardization of Shopware6 Article-Shopexport Improvements Shopware6 Article-Shopexport --- www/pages/shopimporter_shopware6.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/www/pages/shopimporter_shopware6.php b/www/pages/shopimporter_shopware6.php index 83b898f5..7f47e41f 100644 --- a/www/pages/shopimporter_shopware6.php +++ b/www/pages/shopimporter_shopware6.php @@ -963,7 +963,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase public function ImportSendList() { $articleList = $this->CatchRemoteCommand('data'); - $articleList = array_slice($articleList, 0, 10); + $articleList = array_slice($articleList, 0, 50); $return = []; foreach ($articleList as $article) { @@ -1534,7 +1534,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase ]; $this->shopwareRequest('POST', '_action/sync?_response=true', $mediaAssociationData); - $url = $this->ShopUrl . '_action/media/' . $mediaId . '/upload?extension=' . $extension . '&fileName=' . $filename; + $url = $this->ShopUrl . '_action/media/' . $mediaId . '/upload?extension=' . $extension . '&fileName=' . urlencode($filename); $ch = curl_init(); $setHeaders = [ 'Content-Type:image/' . $extension, @@ -1546,7 +1546,10 @@ class Shopimporter_Shopware6 extends ShopimporterBase curl_setopt($ch, CURLOPT_HTTPHEADER, $setHeaders); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_exec($ch); + $response = curl_exec($ch); + if (curl_errno($ch) > 0 || curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 400) { + $this->Shopware6Log("Curl error", ['error' => curl_error($ch), 'response' => $response, 'url' => $url]); + } $internalMediaIds[] = $mediaId; }