2

I'm using Drupal 7 with commerce. Is there a way to generate an order from a csv or similar? the idea is that users could upload a csv (sku and quantity for now) with the items they want and the system generate an order with that.

i'm trying with feeds and the entity processor but i can't import the line items and create de order in the some process (they have to be related with an order). If this is the way, it's not clear to me how to do that.

  • Good question! I don't think such a module exists to do that. Doing it would not be hard though and it maybe a good idea for a contib module. Use feeds for the csv processing. – Brady Sep 1 '15 at 14:55
  • Please, be more concrete. Paste your csv file structure and example. I think it should be possible, but first we need to take a look at your data structure. – ar7max Sep 1 '15 at 15:43
  • Ok, just the basic info for now: product id (sku probably) and quantity. – Nacho Sep 1 '15 at 17:23
  • I should try to implement this solution. Existing modules does not provide this functionality. At least you need: hook_feeds_before_import and create new order manually to retrieve its id. Use this id and current user (as owner) during import (mb some hooks can help). – ar7max Sep 1 '15 at 18:54
  • This might actually be an interesting feature request for the Commerce Feeds module that allows you to import products and product displays. – Wim Mostrey Jan 17 '17 at 21:08
0

Im not sure how to make csv directly to order, but this should work:

  • create a node type, called "csv order"
  • use Feeds module to fetch the data from csv to this node type
  • install module hook_post_action
  • write a custom module, which after saving node "csv order" would take data from this node, and create commerce order with line items
  • remove the csv order node if neccesary

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.