Skip to content

Avoid issues with missing variations.#13

Open
grahl wants to merge 1 commit into
gridonic:8.x-1.xfrom
grahl:bug/exception-missing-variation
Open

Avoid issues with missing variations.#13
grahl wants to merge 1 commit into
gridonic:8.x-1.xfrom
grahl:bug/exception-missing-variation

Conversation

@grahl

@grahl grahl commented Nov 14, 2018

Copy link
Copy Markdown
Contributor

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.

@WengerK

WengerK commented Nov 14, 2018

Copy link
Copy Markdown
Collaborator

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 ?

@wanze

wanze commented Nov 15, 2018

Copy link
Copy Markdown
Contributor

@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:

https://github.com/gridonic/commerce_google_tag_manager/blob/8.x-1.x/commerce_google_tag_manager.module#L39

I would also add the check for a missing reference a higher level - not entering the method buildProductFromProductVariation at all.

@grahl

grahl commented Nov 15, 2018

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants