Open grahl opened 6 years ago
Instead of altering buildProductFromProductVariation
, can we prevent to call this method when no product variation exists ? Before ?
Which was the parent calling buildProductFromProductVariation
? Was is the stacktrace ?
@grahl
Do you know when the exception occurs? I guess it happened when viewing a commerce_product
entity without a default variation? In this case, the check should go here:
I would also add the check for a missing reference a higher level - not entering the method buildProductFromProductVariation
at all.
Hi @wanze
I noticed this on a product detail page with an invalid variation, not quite sure if the the field there was the "add to cart" formatter or the entity renderer.
I only did a cursory check where Both methods calling buildProductFromProductVariation() was being called and since both instances didn't look like a great place to check it I went further down. Though I understand your criticism.
Time permitting I'll try to recreate this and send the stacktrace.
Hello
I have a case where some product data can become inconsistent due to long running import jobs from the ERP. This can lead to a missing product variation. This function causes a fatal error in that case and the following change catches it.