Magento – How to Use Product SOAP API with CDN Image URLs

imagemagento-1.6productsoapurl

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.

Best Answer

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.

Related Topic