这是我的Volusion item插入方法,它依赖于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我找不到任何文档,给出了一个项目中的多个照片的例子。我试过复制通话记录。示例:<PhotoURL_Large>img1</PhotoURL_Large><PhotoURL_Small>img1</PhotoURL_Small><PhotoURL_Large>img2</PhotoURL_Large><PhotoURL_Small>img2</PhotoURL_Small>
这导致没有图像上传。
我意识到PhotoURL与项目照片的urls无关,而只是与Volusion的add item表单中的数据相关。
有人能告诉我访问volusion项目的真实照片urls的正确方向吗?
发布于 2015-01-15 19:50:36
在Volusion中,PhotoURL_Small和PhotoURL_Large是可以指向内部或外部位置的备用图像URL。Volusion仅为每个产品代码提供每个产品代码中的一个,产品将使用这些代码来代替任何加载的图像。因此,如果您填充了该产品的上述两个字段中的任何一个,它将使用该URL代替通过图像管理器上传的任何图像或通过FTP直接上传的任何图像。软件中未提供额外的PhotoURL_Small和PhotoURL_Large映像。
下面是对图像文件结构的一个很好的解释。
Image structure
https://stackoverflow.com/questions/27952739
复制相似问题