Discussions

From content types to product types.

Hello,

I have just installed Commerce in view of adding e-commerce functionality to a site that currently presents products that were sold over mail order.

The site has been developed in Drupal 7 and the client is so happy he wants to set up a boutique... only hitch :

Do we have to transfer all the Content types that we created to present the products into Commerce Product types or is there a way of adding product "fields" to my content types...

I'm goign through the documentation right now and experimenting with Commerce.. but a point in the right direction to info that would answer my question would be very much appreciated.

PS : as you may have gathered this is the first time I do an e-commerce site.

Posted: Apr 3, 2011

Comments

apprentia on April 4, 2011

OK.. looks like I'm answering myself and as I progress I'll try to add info here.. if I'm getting this terribly wrong and polluting the forum please point this out to me and I'll desist.

One way of doing what I want to do is this

1 : create a product type that corresponds to my content type. In the product type add the fields that are relevant to the commercial aspect of my product (SKU, price, etc,etc..)

2 : create a product for each of the contents items that already exist.

3 : add a "product reference" field to my content type.

4 : go to the contents and add in the product reference which corresponds to the content.

This now leaves me with a lot of questions about what content is relevant in the "product" entity and which content is relevant in the "node" entity... and is it possible to limit access to certain nodes based on the aquisition or not of the product that they reference.

Scott J on April 4, 2011

1. You may need many different product types, or you may need only one. The deciding factor is if different options, or 'attributes' are required for your products.

2. Yes. Note that you may have more products than content items (nodes) if different colours or sizes require different prices, as they may be referenced in a one-to-many fashion from the node.

3. Yes.

4. Yes. Again note that more than one product may be referenced.

To work out which entity to attach fields to, just keep the one-to-many idea in mind: if you only have one image per product, then add an image field to the content type, but if you have many images representing different colours or styles per product, then add the image field to the product entity. Any options/choice fields such as size or style should also be added to the product type entity.

apprentia on April 6, 2011

Thanks for your answer.

With this project we are fairly lucky in that we are selling books and downloadable magazine type articles in pdf format. So with regards to point 2 we're basically on a one to one relationship.

With regards to points 3 and 4 : we are developing this for a user who is already used to entering his contents in the preset content types for the books and articles. We are looking to make it possible for him to carry on doing just the same and to have the corresponding product created by using RULES ... thus his experience will only change in that he will have a few extra fields in his content type (sku, price etc..)

If, and when we get this to work I will post the explanation here.. however I'm still wondering whether this will be usefull to people... the option of just heavy handedly migrating all the contents to products might be more time saving in the longrun...