Discussions

Own entity as product entity

Hi,

If i understand the Drupal Commerce architecture correctly, I am supposed to create a product "entity" to define the product, followed by a product "node" which will allow me to visualize the product entity.

Currently I'm working on a system that will import data from a seperate data source, and I was planning to make a custom entity for those items with the Entity API.

However the objects coming from the external data source also need to be sold, so I'd need the Drupal Commerce setup tied in with it.

Would that force me to have a setup like:
Custom Entity > Product Entity > Product Node?
In that case it would be kind of painful to have 3 variations of each data item...

Or should I look into trying to get my data directly into the Product Entity?
If I take that road I can't make my import system generic, as I'd like to reuse it for systems without Drupal Commerce (where there would just be a Custom Entity.

Is my architectural view flawed somewhere? How would I go about achieving this?

Posted: Mar 28, 2011

Comments

Ryan Ryan Szrama on March 28, 2011

Hmm, it strikes me that it shouldn't be hard for you to create an adjustable target entity. It could be you can just use the Migrate module or Feeds module to import your data... I know we've done a quickie import into Commerce Products from a CSV using Feeds + Commerce Feeds. Do you have control over how you export the source data?

svendecabooter on April 4, 2011

Thanks for the insight Ryan.
I'm going to investigate Commerce Feeds.

The source data is coming from a SOAP webservice, but i'm planning to write a wrapper Drupal module for that anyway, so i'll have to check if that wrapper module can also serve as a Feeds source (instead of raw XML for example).

clevster28 on January 17, 2013

Did you ever get this up and running? I too am working on an implementation of Commerce that will need to access products from a SOAP web service and I was curious how you implemented it.

Thank you in advance.

Ravi.J on May 20, 2013

Migrate module comes with an example of using XML as source. With some minor tweeks to the example module you should be able to import from XML being returned from your SOAP service into custom entities.