如何将图像添加到集合中以使用ruby api gem进行购物

时间:2014-04-05 03:07:43

标签: ruby shopify

我试过了 coll = ShopifyAPI :: SmartCollection.find(id) coll.image = {" src" =>" ..."} 以及其他方法 - 似乎什么都没有用

1 个答案:

答案 0 :(得分:1)

Shopify API docs提供了如何更新SmartCollection图像的示例:

collection = ShopifyAPI::SmartCollection.find(id)
collection.image = { attachment: "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\n" }
collection.save

attachment应为base64编码。

还应该可以指定Shopify应下载图像的src

collection = ShopifyAPI::SmartCollection.find(id)
collection.image = { src: "http://example.com/rails_logo.gif" }
collection.save