Quantcast
Channel: Programmierung - Shopware Community Forum
Viewing all articles
Browse latest Browse all 2871

Adding and updating bulk products with API

$
0
0

Hi there,

I have 3500+ articles which i need to add / update, preferably with the API.
I'm encountering issues when adding too many products and I'm wondering if I'm using the correct methods.

1. updating one product at a time
I fetch all products from the source. For each product i'm trying to fetch a product in shopware and use post / put for the single product.

$existingArticle = $shopware->get('articles/'.$article['id'].'?useNumberAsId=true');

// post if no article in dbase
if (!$existingArticle) {
    $newArticle = $shopware->post('articles', $article);
    $article_id = $newArticle['data']['id'];
}
// put if article in dbase
else {
    $article_id = $existingArticle['data']['id'];
    $shopware->put('articles/'.$article_id, $article);
}

Because I have the id's of the existing or new products, I can also add the translation of the title, descriptionLong

$shopware->put('translations/'.$article_id, $data);

2. updating batch products
I put all products in a batch

$response= $shopware->put('articles', $aArticles);

Now i don't receive any id's back so there's no way to update the translations right?

------------

Beside the translation issue i encounter performance issues. I'm not even close near the 3500 articles but nothing gets updated (no timeout reached though).

Any help is much appreciated.


Viewing all articles
Browse latest Browse all 2871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>