0

I am working with a handful of stores which need to operate on the same catalog. Some stores can be implemented with as additional websites in the primary store's Magento installation, but others require their own servers and database instance.

The stores which require their own database must keep various data in sync for each product SKU. Additionally some of these stores are Magento version 1.6, some 1.7 and some 1.9.

So I set out to accomplish this with the SOAP API (version 1) and have had decent success until working with image media.

All images are hosted on a CDN account and need to reflect this when a database is synchronized with the master. It seems there is no way to set an absoute image URL with the Core SOAP API.

How can I accomplish this while cooperating with the SOAP API and maintain compatibility with Magento versions 1.6 - 1.9 ? I am not able to change any core files, but I can include the framework into my scripts and go from there.

  • Step 1: How are you using Magento and a CDN without the API? – Alan Storm May 27 '14 at 4:35
  • @AlanStorm I'm basically just using the backend setting at System >> Configuration >> Web >> Base Media URL and pointing the CDN to our /media directory on the origin server. – Garet Claborn May 27 '14 at 21:07
  • 1
    Apologies if I'm missing something obvious here — but if sounds like the CDN consumes the images automatically from Magento — so shouldn't updating the image via SOAP in Magento be enough to see the change reflected in the CDN? (asking in a trying to understand the problem sort of way) – Alan Storm May 28 '14 at 1:12
  • @AlanStorm No problem; I may be phrasing this poorly due to lack of Magento experience. I am using SOAP to import the product catalog from one store into completely separate installations on separate servers. It seems their is no way to inform the other installations of the absolute media URLs. Especially, the SOAP API seems to require me to upload each image after base64 encoding them, but we do not want to actually store images on the other servers, only the URLs. Does this make sense? Thanks for any feedback! – Garet Claborn May 28 '14 at 5:34
2

The best and probably the most cleanest solution would be to set up one or more new product attributes for your absolute media URLs and update them together with the other product data. This would require to adapt the product image output in the shops, but would be the easiest to transfer the URLs and you don't need to touch the catalog_product_attribute_media.create/update functions at all.

An alternative (but very hackish) idea could be to transfer the absolute media URL as part of the image name or image label (and send, if required, always a base64 decoded 1x1 pixel). I would not recommend going with this option.

See also: Magento API on catalog_product_attribute_media.create.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.