【问题标题】:How to upload multiple pictures to Volusion through API如何通过 API 将多张图片上传到 Volusion
【发布时间】:2015-01-14 21:25:22
【问题描述】:

这是我的 Volusion 项目插入方法,它依赖于 Rails 的 HTTParty gem。它适用于发布没有照片的项目,以及使用<PhotoURL_Large><PhotoURL_Small> XML 标签发布带有单张照片的项目。

def self.post_volusion_item(hide_product, product_code, product_name, product_description, availability, custom_field1, custom_field2, enable_options_inv_control, free_shipping_item, height, length, width, metatag_description, metatag_title, photo_alt_text, photo_xml, product_category, product_price, product_weight, metatag_keywords)
  encrypted_password = ENV['VOLUSION_PASSWORD']
  post_url = "https://WEBSITE-HERE/net/WebService.aspx?Login=LOGIN-HERE&EncryptedPassword=#{encrypted_password}&Import=Insert"
  body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><Volusion_API><Products><HideProduct>#{hide_product}</HideProduct><ProductCode>#{product_code}</ProductCode><ProductName>#{product_name}</ProductName><ProductDescription>#{product_description}</ProductDescription><Availability>#{availability}</Availability><CustomField1>#{custom_field1}</CustomField1><CustomField2>#{custom_field2}</CustomField2><EnableOptions_InventoryControl>#{enable_options_inv_control}</EnableOptions_InventoryControl><FreeShippingItem>#{free_shipping_item}</FreeShippingItem><Height>#{height}</Height><Length>#{length}</Length><Width>#{width}</Width><METATAG_Description>#{metatag_description}</METATAG_Description><METATAG_Title>#{metatag_title}</METATAG_Title><Photo_AltText>#{photo_alt_text}</Photo_AltText><PhotoURL_Large>#{photo_url_large}</PhotoURL_Large><PhotoURL_Small>#{photo_url_small}</PhotoURL_Small><ProductCategory>#{product_category}</ProductCategory><ProductPrice>#{product_price}</ProductPrice><ProductWeight>#{product_weight}</ProductWeight><METATAG_Keywords>#{metatag_keywords}</METATAG_Keywords></Products></Volusion_API>"

  post(post_url, body: body)
end

我找不到任何文档,其中给出了该项目中包含多张照片的示例。我试过复制电话。示例:&lt;PhotoURL_Large&gt;img1&lt;/PhotoURL_Large&gt;&lt;PhotoURL_Small&gt;img1&lt;/PhotoURL_Small&gt;&lt;PhotoURL_Large&gt;img2&lt;/PhotoURL_Large&gt;&lt;PhotoURL_Small&gt;img2&lt;/PhotoURL_Small&gt;

这导致没有图片上传。

我意识到 PhotoURL 与项目照片的 url 无关,而仅与 Volusion 的添加项目表单中的数据相关。

有人可以为我指出正确的方向来访问 volusion 项目的真实照片网址吗?

【问题讨论】:

    标签: ruby-on-rails xml httparty volusion


    【解决方案1】:

    在 Volusion 中,PhotoURL_Small 和 PhotoURL_Large 是替代图像 URL,它们可以指向内部或外部位置。 Volusion 只为每个产品代码提供一个,产品将使用该代码代替任何加载的图像。因此,如果您为该产品填充上述两个字段中的任何一个,它将使用该 URL 代替通过图像管理器上传的任何图像或通过 FTP 直接上传的任何图像。软件中没有提供额外的 PhotoURL_Small 和 PhotoURL_Large 图像。

    这是对图像文件结构的一个很好的解释。

    Image structure

    【讨论】:

    • 感谢您的解释和文档链接。您是否同意从自定义应用程序上传包含多张照片的项目的唯一解决方案是使用 API 调用发布项目,然后将具有正确文件名的照片通过 FTP 传输到 vspfiles/photos?
    • 您无需向 Volusion 发布任何内容。您只需要上传带有正确产品代码前缀和后缀的图像,如我之前链接到的文档中所示。如果图像文件正确命名,您的产品将自动显示。这适用于多个备用图像和样本图像以及文档中显示的所有其他图像。
    猜你喜欢
    • 2011-02-21
    • 1970-01-01
    • 1970-01-01
    • 2014-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-27
    • 2020-09-20
    相关资源
    最近更新 更多