Closed (duplicate)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Product
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Feb 2012 at 15:52 UTC
Updated:
19 Feb 2013 at 20:33 UTC
Hello,
I just installed Commerce Kickstart, and I found we have two entities product and product display. I personally disagree with this setup and I believe it is an unnecessary duplication... For example the field permissions module can easily shield internal entity fields from customers who may only be interested in the image and price.
Is it ok to delete product display entity and just keep product?
Comments
Comment #1
rszrama commentedYes, you can delete it. You opted to include example store content, and that included the product display node type. However, you should definitely do some reading to understand the abstraction here. I recommend:
http://drupalwatchdog.com/1/1/building-commerce-product-display
http://drupal.org/node/1199602#comment-5365636
That said, you're free to devise any strategy for displaying products that you want. At Commerce Guys, we've used nodes, Views, Panels, and Search API in different combinations to display products, with several of our sites not using node based product displays at all.
Comment #2
giorgio79 commentedThanks Ryan, I read both. Nothing personal follows here, just my rant (maybe I sound like a grumpy old man)
Your intro does not go into great detail why two entities for a product (one for display, one for internals...). This is all the explanation: "The name of this content type intentionally reinforces that this is purely a point of display for a product, not the product definition itself"...
I can easily install field group, and create a group for customer display, eg description and image, and another field group for internals...
http://drupal.org/node/1199602#comment-5365636
This other one seems like more of a pep talk :) "Drupal Commerce leads you to greater freedom in structuring and managing the products you want to sell. It is a more sophisticate and power solution in selling contents from your Drupal site, with the great advantage that it let's you keep separate at the right level the power of Drupal in creating and managing free contents "
I cannot do much with such poetry ;)
I will stick with my one product entity, since I believe two is an overkill.
Comment #3
rszrama commentedRight, the point of the second link is that the developer basically started thinking it was "overengineering" to separate products from the product displays but then basically re-implemented the exact same architecture hacked onto Ubercart. When he realized this, he returned to Drupal Commerce. : )
I've written a lot elsewhere on the division, obviously didn't have the space in that one magazine article to go into it. Here's the blurb I use in my training document:
But as I said above, if you don't need product display nodes, Drupal Commerce is designed so you don't have to. It's completely legitimate and recommended to not use that paradigm if you don't need it. : )
Comment #4
giorgio79 commentedHmmm, using only product entities without product displays may be more difficult if not impossible after all.
For example:
Comment #5
bojanz commentedIf you don't want product display nodes, why are you looking for products in node listings (admin/content)? Makes no sense.
As for the views handler, you can extend it to do what you want (or use regular Views options to wrap data in an arbitrary link). Right now products are not exposed directly (there's no product/%commerce_product URL), so there's no option of linking to them.
Comment #6
giorgio79 commentedIt was my understanding Commerce goes the Drupal way, meaning it uses whatever Drupal has. I would consider a product just like a regular content type that would appear in admin/content. I think it makes perfect sense that a Drupal admin would think of a product as a content type.
It is not just the views handler, I also noticed I cannot set paths for products, only product displays. It seems like I would need to extend Commerce to do something Drupal content types do out of the box, if I only want to use a product entities.
I simply do not agree with having two Drupal entities for one real world entity.
I am not the only one unhappy with this approach, here is an example:
http://stackoverflow.com/questions/3062032/ubercart-vs-drupal-commerce-v...
"I tried Drupal Commerce since the beginning and found it very complicated, due to its core structural approach that needs to manage product entity & product dispaly/node: it is mad to have to reply twice any product entry, and they seem to get crazy to find an authomatic way to easy and authomatize (with rules ... ?) that workflow, that will stop any shop administrator ..."
I can whine here day and night, I guess the decision has been made so either I digest it or look at Ubercart which was closer to having one product entity for a real world product.
Comment #7
bojanz commentedYou are misunderstanding the Drupal way :) admin/content is a listing of nodes. No other entity types are shown. Products are not content, just like users are not content. That's Drupal 6 thinking.
And I'm not sure how this is even relevant, since Commerce ships with a Products listing view (that can be extended with VBO, added to other paths, or whatever).
Yes. You disliked the assumptions Commerce made with nodes, now you dislike the fact that there are no assumptions. The amount of code needed to actually use products directly is small, but not non-existing. And that's of course only if you don't have multiple product variations (such as t-shirt sizes).
I'm not going to go over this old debate with you again. The fact is that there needs to be a separation between a product and its variations. Call it however you want. It's the same problem in Commerce, Ubercart, Magento, and no silver bullet, only various architectural and interface solutions.
I realize that there are UX problems with separate add forms, which is why we're preparing a module to solve that: http://drupal.org/sandbox/rszrama/1181848 for cases where people don't want to care about the separation.
Correct. Have a nice day.
Comment #8
giorgio79 commentedGreat points, thanks Bojanz :)
That module looks like what I will be needing.
Comment #9
bojanz commentedI also see you pointed to the stackoverflow site, and replied to itamair's comment. You should read his followup:
http://drupal.org/node/1199602#comment-5365636
Comment #10
giorgio79 commentedWow, I did not know that is the same guy. Hopefully I will be having my epiphany as well :)
Will keep on digging.
Comment #11
giorgio79 commentedHey,
Just found this video by Randy:
http://www.commerceguys.com/resources/articles/237
This video has a great demo, especially the first 4 minutes which shows the use of product display and product entities. It would have been nice to see this first.
If I were you I would put this right on the project page of Commerce :)
This gives a much better understanding than anything I read so far.
One thought though of where I coming from...If I would build a shopping cart module, I would do the following:
1. On a content type (whoops D6 thinking :P) I would have a section called "Product", where I can enable a content type as a product. Select an integer field as a price, if there is none require it. Also, use the nid as SKU or require a separate field if necessary. Currency can come from module settings etc.
2. Have a Cart like Commerce or Ubercart...
So really, this is the only thing I would do differently. Make the product an entity addon, not an entity in itself. The rest is looking good so far...
PS: OG had an interesting case where they deprecated the group entity because of bad site builder experience : #1342632: Deprecate OG group entity
PS2: whoops, during my latest research rampage I also found this: http://www.drupalcommerce.org/node/293
Comment #12
giorgio79 commentedHey Bojanz,
Been doing some more reading.
One more point
"You are misunderstanding the Drupal way :) admin/content is a listing of nodes. No other entity types are shown. Products are not content, just like users are not content. That's Drupal 6 thinking."As I understand nodes / content types are entities as well in D7, and I guess they are the powerhouse entities integrated with everything else. It seems the entity concept will be ripe only for D8, as other entities are just catching up via entity api.
I was just reading this thread for Ubercart as well as there was this struggle with Product entity and product class as well, and webchick summed it up the best:
#525612: Allow any node type to become a product
Comment #13
rszrama commentedThe difference is in Ubercart products were already nodes, but we had invented another term (product class) to refer to an existing concept (node type). The problem was the confusing duplication in terminology, whereas with Drupal Commerce we've already committed to a different architecture entirely. : )
Comment #14
giorgio79 commentedThanks Ryan, much appreciated.
Perhaps in the next release you could consider making product display nodes optional, and make sure product entity is usable by itself.
Instead of having a product display node here is a great alternative solution. Just found it and it looks great:
http://mearra.com/blogs/juha-niemi/drupal-7-custom-node-view-modes
Comment #15
rszrama commentedIt already is usable by itself if you build a View or Panel to use it. : )
In fact, I think there's a patch in the queue to allow Panels to accommodate multiple-value Add to Cart forms; don't quote me on that, though! : P
Comment #16
giorgio79 commentedThanks Ryan, trust me I tried. :)
Currently the product entity urls are hardcoded to /admin/store or sg like that. I cannot change this in pathauto. In views there is also no option to link to content, and plain users cannot be sent to /admin paths so with Commerce you need a product display node. I think I stopped at this point using the module but try it yourself and you'll see. :) http://drupal.org/project/basic_cart looks promising with much less assumptions, but hoping Commerce will make product entity usable in itself with custom paths etc etc. This way you can save a lot of effort as well not having ot create modules like inline product form :)
Comment #17
rszrama commentedWell, I see what you're saying, but it's still not necessary to have a separate product entity. Using both Panels and Views you can craft URLs that include product IDs (or even use product titles and translate them into IDs) and then render the entity to the page with whatever other information you need. There is no path in the module itself, but it's easy enough to create on your own.
For example, I whipped this up in a couple minutes:
The only coder thing I did in there was add custom PHP validation to ensure that valid product IDs are given in the URL. Without that, I just was seeing a blank page... I suppose the alternative would've just been to add some empty results behavior.
To link in to these pages, you can just make a separate View listing all the products out and linking to their individual pages. Additionally you could use the Search API module to index these custom pages and link to them from search results... plenty of things you can do here.
Comment #18
giorgio79 commentedMuch appreciated Ryan, will poke around a bit. I forgot about Panels magic :)
Comment #19
okokokok commentedI think it would make a lot of sense to have a module that will provide a solution to this product vs product display dichotomy. I would suspect that most simple e-commerce websites don't need the extra confusion that this takes with it. I'm basically just doing one Commerce site now and I don't have enough experience nor time to build a module that might solve this. But still... I really feel that if Drupal Commerce wants to succeed it needs to resolve this. I'm running into silly issues for which I've seen the solution but even then it's far from straightforward to come up with it (and I consider myself pretty experience with Drupal).
I can definitely not recommend dealing with the Product Display / Product split (and thus Drupal Commerce) to any store that wants to set up an e-commerce site, with pain in my heart I would send them straight to Magento...
(I must add that I've tried Ubercart in D6 and I wasn't very happy with that either.)
Comment #20
rszrama commentedIt exists: http://drupal.org/project/inline_entity_form
Comment #21
donquixote commentedI am trying the inline_entity_form now.
It looks ok (except #1598296-4: Add a simplified widget for fields that accept only one entity of a specific type)
Still, I am having mixed feelings about the separation.
-----------------------
I think it would not hurt at all to have product implemented as a first-class entity type with its own "product/%", "product/%/view" and "product/%/edit" paths, url aliases, etc, similar to node/% and user/%, and then have the "product display" thing on top of that.
We could even say that, by default, all the product/% stuff can be restricted to privileged users, and url aliases for product entity need to be enabled via a separate sub-module. This way, product display would remain the default way to view and buy products.
The site builder could then choose between product display and 1:1 product entity pages. The decision could even be done separately per product entity bundle.
Some contrib author might even come up with an alternative to product display, all based on commerce_product.
The panels example in #17 shows that we are not so far away from that, and we can get there without breaking anything.
------------------
In fact I am in the process of creating a module "productpage" which does just that, using hook_menu() and friends. I had some difficulty to make the ds layout work, and I am a little worried about future namespace collisions (e.g., I needed to name my theme function "theme_commerce_product")
One thing I just noticed is that the cart field is only implemented for product display (as a formatter for product_reference field), and I have to hand-code a shopping cart field for product/%.
Comment #22
donquixote commentedOne question I have:
Can it happen that one product shows up in different product displays? Is this supported, or will this create issues? Could there be a reason why someone would want this?
Comment #23
bojanz commentedhttp://drupal.org/sandbox/davereid/1643530
Comment #24
giorgio79 commentedThis seems to be the proper way in D7 http://mearra.com/blogs/juha-niemi/drupal-7-custom-node-view-modes making product display and all these work around hacks for product display and product entities unnecessary
Comment #25
donquixote commented@bojanz (#23) / Dave: This is cool!
I commented in its own queue, #1664148: Some feedback. Does it work with Display suite?.
@Giorgio (#24):
I like view modes and use them all day. I just don't know how they can solve the problem that product displays attempt to solve.
It can be used to render the product reference as an embedded entity with its own view mode. But then you can't easily intermix product fields with product display fields.
If we use paths like product/%, then we will mostly just use the 'full' view mode (this is what the davereid sandbox thing does), or something equivalent.
Otherwise, we could use custom view modes
- if we have other paths such as product/%/about, or
- if we want to switch view mode dynamically based on some product attribute, or
- if we want to embed the product on other pages. this could be a "product display" or anything else.
Comment #26
donquixote commentedBtw, some more thoughts over here,
#1187316-13: Line Item concept. It is there only because of the use case described in the issue.
Comment #27
giorgio79 commentedHello,
Just wanted to mention that I have revisited Commerce, and I am now managing to create Products without display nodes as Ryan explained in his first comment. The key elements "Views, Panels, and Search API"
Search API Views for displaying product entities (as simple Views is not yet fully compatible with entities),
Panels is for creating displays for product entities. (currently evaluating, may need panelizer)
Finally, I can keep all my fields in one basket and keep focus without node displays. :)
One needs all of these to get by, and it takes some time to grasp them, but once you do, it is a whole different world of awesomeness. Thanks everyone :)
Comment #28
summit commentedHi,
Did you start by kickstart 2 and then went back to commerce?
Could you tell Erich exact steps you did?
Do you still use backoffice for instance?
Thanks a lot in advance!
Greetings, Martijn
Comment #28.0
summit commentedtzpo