I tried to reference a product in a node of type article, I modified the display of the product in the node to show the add to cart form, and when I try to consult the node I had this error:

Fatal error: Call to a member function referencedEntities() on null in /Applications/MAMP/htdocs/mysite/web/modules/contrib/commerce/modules/product/src/Form/AddToCartForm.php on line 95

Comments

Paulset created an issue. See original summary.

Paulset’s picture

Issue summary: View changes
bojanz’s picture

Why would a node reference a product with an add to cart form? There shouldn't be a need for that.
Furthermore, the add to cart form should be on the variation reference field, did you select it for the product? That's probably the cause of the crash.

Paulset’s picture

I believe that I don't understand the new functioning of the creation of product.

There is no more product display, isn't it ? But where do we manage the display of products?

Otherwise, is it possible to create a product without variation? I tried to create a product by filling fields SKU and price without creating a variation, and of course I have an error...

Thanks in advance for the clarifications

Paulset’s picture

Ok, for the people whom it interest, the display of products takes place in commerce/config/product-types

On the other hand, I did not find 1/how to create a product without variation (the only purchasable entity is a product variation), and 2/how to personalize differently the displays of a product for teaser, complete contents etc.

If somebody could direct me

Other question: 3/ is it planned to add the same options (display, publication...) for the product types as for the content types?

bojanz’s picture

Category: Bug report » Support request
Status: Active » Fixed

Fixed the actual bug in https://github.com/drupalcommerce/commerce/commit/75fa8cc655cdefb19ef1ab...
The add to cart form formatter is now only selectable on the variations field.

A product must always have at least 1 variation, it's never optional, that's where the sku and the price are.
The plan is to improve the form post-alpha2 so that it embeds the variation form without any buttons if there are no attributes (indicating there's always only 1 variation).

Other question: 3/ is it planned to add the same options (display, publication...) for the product types as for the content types?

The publication settings are complete, you can set the Published default on the product type.
Products don't have the other two fields (sticky on top of fields, promote to the front page), since they are legacy and can easily be replicated with custom fields + views.

The "Display author and date information" display setting should be added: #2652704: Port display_submitted to product types.

Paulset’s picture

Thanks Bojanz.

I had seen that there was an other problem with add to cart form in views, I do not know if you saw it : I tried to add as field "add to cart form" for a list of products, and I had an error of type " the site met a problem...". Problem solved by removing the field "add to cart form"

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.