I’m building a drupal commerce store using product displays that reference multiple product variations. But i need the product display to show all of its product variations with all attributes one after another, not hiding the attributes by AJAX. And each product variation should have its own add-to-cart-button. So it’s a simple, flat design where a customer can see every variation and every attribute at a glance.
I know this could be easily accomplished using views, but for certain reasons views is not an option for me. I need a real node of the productdisplay with its variations. What’s the best and most performant way to achieve this?
EDIT According to @nvahalic it’s a mess to solve my issue without Views. So maybe i have to reconsider my decision not to use Views. To clarify, the products will be displayed like this:
+------------------------------------+ | Title Product 1 | | ===================== | | General Text (for all variations) | | General Image (for all variations) | | | | Title Product Variation 1 | | ========================= | | Text | | Image | | *Add to Cart* | | | | Title Product Variation 2 | | ========================= | | Text | | Image | | *Add to Cart* | +------------------------------------+ +------------------------------------+ | Title Product 2 | | ===================== | | General Text (for all variations) | | General Image (for all variations) | | | | Title Product Variation 1 | | ========================= | | Text | | Image | | *Add to Cart* | | | | ... | | ... | +------------------------------------+
As far as i know when using views to build this structure, i will need something like the module Views Field View to achieve the nested structure consisting of fields belonging to the product display as well as fields belonging to the variants. Since the shop will have very long lists of products, i’m concerned about performance issues coming along with this kind of modules. Or maybe i got it wrong and such module isn’t necessary at all?
EDIT 2 Finally i solved the problem by using the EVA module: i created a view showing the attributes of all products as fields and added am add-to-cart field. This view i attached to my product display – it seems to me this approach is way more performant than using the Views Field View module …
EDIT 3 It is a huge mess: using nested views is not a good idea, because commerce-add-to-cart buttons can not be cached, so caching views does not work as it is discussed here https://www.drupal.org/node/1926888 From my point of view it was a very, very bad choice to use views for this task. Now I can not use views for caching and the module commerce entity cache is not usable neither because the view does not rely on entities.