vienthuong/shopware-php-sdk

Images are wrongly assigned to a random payment service after upload with MediaService

Closed this issue · 1 comments

After I upload a new media (image) for a product with the method uploadMediaFromUrl with a newly generated media ID, filename, extension and URL this media is connected to a payment service. I did not start to sync a payload with ProductMedia, that step would come next, but (after a few tests) does not have anything to do with this problem.

So I just upload an image through the API and it gets connected to a payment service in Shopware 6.

It's a random payment service though, every time another one...

Code:

    $context      = new Context($config['shop_url'], $this->accessToken);
    $mediaService = new MediaService();
    $mediaService->setContext($context);
    $mediaRepo    = RepositoryFactory::create(MediaDefinition::ENTITY_NAME);
    $mediaId      = $mediaRepo->searchIds(new Criteria(), $context)->firstId();
    $mediaService->uploadMediaFromUrl($mediaId, $url, $ext, $filename);

    // This works afterwards , but doesn't have anything to do with the problem, after updating ProductMedia the media is also (ans correctly) connected to the product
    //$this->upsertProductMedia($productId, $mediaId, $mediaFolderId, $coverId, $alt, $title, $position);

Finally, thank you for this SDK, I don't just want to criticise something ;)

Sorry for the late response, I checked the script in examples/media-service.php and cannot reproduce your mentioned issue, from the script, I don't see anything could be related to a payment service so I'm not sure if the SDK's issue, feel free to reopen it if you can reproduce it with a more specific steps