Hi, I''m new to Ruby and Rails and trying to use it to work on a project for my website. I have a Shopify store, which I can access my products.xml feed through the API, Shopify feed sample attached. I have another feed from the wholesaler I use that has the latest stock levels. Whole feed sample attached. The common link between the two is the SKU code, as I added all of the products with the same code. The attribute for the stock level isn''t the same. On the wholesale feed it''s <stock> with Shopify using <inventory-quantity> I''m trying to work out how to take the wholesale feed, and combine it into my product feed, which I can then regularly apply to my Shopify store to keep it updated with the latest stock levels. I''ve been reading a lot, testing Nokogiri and the builder, but I''m not sure if I''m going about this the right way. Currently I think the way forward is to parse both feeds into the same MySQL database and then build a new XML file from that to update Shopify. However is there a way that I can have the wholesale XML feed check it''s SKU code against my Shopify XML, update the attribute field for stock level and append it to the correct product? My skill level is low, so I''m prepared for this to take awhile, but hoping someone can steer me in the right direction so I''m doing it correctly (keeping in mind that I''m sure there are multiple ways to do this!). Thanks, Paul Attachments: http://www.ruby-forum.com/attachment/5657/wholesalefeed.txt http://www.ruby-forum.com/attachment/5658/shopifyfeed.txt -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Paul Osborne wrote in post #972462:> I have a Shopify store, which I can access my products.xml feed through > the API, Shopify feed sample attached. > > I have another feed from the wholesaler I use that has the latest stock > levels. Whole feed sample attached. > > The common link between the two is the SKU code, as I added all of the > products with the same code. The attribute for the stock level isn''t the > same. On the wholesale feed it''s <stock> with Shopify using > <inventory-quantity> > > I''m trying to work out how to take the wholesale feed, and combine it > into my product feed, which I can then regularly apply to my Shopify > store to keep it updated with the latest stock levels.From taking a quick glance at the Shopify API I''d do something like the following: 1. Create a cross-reference table storing item ids from Shopify and SKUs that you''ll use to match between Shopify and you wholesaler. 2. Include in that cross-reference the latest inventory quantity, and a flag indicating whether or not the value needs updating in Shopify. +-----------------+--------------------------+--------+ | id | shopify_id | sku | quantity | update | +-----------------+--------------------------+--------+ | 1 | 25 | IPOD2008RED | 10 | false | | 2 | 234 | IPOD2008BLACK | 15 | true | +-----------------+--------------------------+--------+ 3. Parse the product feed from Shopify to initialize the cross-reference with the current inventory quantity levels. 4. Periodically fetch and parse the wholesaler feed to update the cross-reference. While update set the update flag for only quantity values that have changed since the last update. 5. Find all cross-reference records flagged for update, and use the Shopify API to update only the quantities that have changed. PUT /admin/products/#{id}.xml --------------------------- <?xml version="1.0" encoding="UTF-8"?> <product> <inventory-quantity type="integer">10</inventory-quantity> <id type="integer">632910392</id> </product> -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Robert. Your post helped me move forward with this. I''ve made good progress and have parsed both XML files into one table to make it simple, I''m now working on getting that data to my Shopify store. Thoroughly impressed with Ruby, and especially ActiveRecord so far. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi Paul, I read your post this morning as I''m setting out to achieve exactly the same objective - updating Shopify with inventory levels from a remote XML (wholesale) feed. I''ve got a ROR Shopify app up and running so am set with the authentication side. Would be really keen to hear how you got on with your project and whether you''d be able to offer any advice. Many thanks, David -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.