Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何通过API将多张图片上传到Volusion_Ruby On Rails_Xml_Httparty_Volusion - Fatal编程技术网

Ruby on rails 如何通过API将多张图片上传到Volusion

Ruby on rails 如何通过API将多张图片上传到Volusion,ruby-on-rails,xml,httparty,volusion,Ruby On Rails,Xml,Httparty,Volusion,这是我的Volusion项插入方法,它依赖于httpartygemforrails。它可以用于发布没有照片的项目,也可以使用和XML标记发布带有单个照片的项目 def self.post_volusion_item(hide_product, product_code, product_name, product_description, availability, custom_field1, custom_field2, enable_options_inv_control, free_sh

这是我的Volusion项插入方法,它依赖于httpartygemforrails。它可以用于发布没有照片的项目,也可以使用和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
我找不到任何文档,其中包含多张照片的示例。我试过重复这些电话。示例:img1img1img2img2

这导致没有图像上传

我意识到PhotoURL与项目照片的URL无关,而只与Volusion的add item表单中的数据相关


有人能告诉我访问volusion项目的真实照片URL的正确方向吗?

在volusion中,照片URL小和照片URL大是交替的图像URL,可以指向内部或外部位置。Volusion仅为每个产品代码提供其中一个代码,产品将使用该代码代替任何加载的图像。因此,如果您为该产品填充上述两个字段中的任何一个,它将使用该URL代替通过image manager上传的任何图像或通过FTP直接上传的任何图像。软件中没有提供额外的PhotoURL_小图像和PhotoURL_大图像

下面是对图像文件结构的极好解释


感谢您的解释和文档链接。那么,您是否同意从自定义应用程序上载包含多张照片的项目的唯一解决方案是使用API调用发布该项目,然后将具有正确文件名的照片FTP到vspfiles/photos?您不需要向Volusion发布任何内容。您只需上传带有正确产品代码前缀和后缀的图像,如我之前链接到的文档所示。如果图像文件的名称正确,您的产品将自动显示。这适用于多个备选图像和样例图像以及文档中显示的所有其他图像。