I use the last version of commerce and drupal 8.7.
On all views with product fields, I can't edit product fields (except the title) because of an ajax error :

admin/structure/views/ajax/handler/produit_une/block_1/field/field_prod_img↵StatusText: parsererror↵ResponseText : ↵Notice: Undefined index: entity_type in /public_html/modules/contrib/commerce/modules/price/commerce_price.module on line 51

I tried to remove all module exepted commerce module. I removed all the orders, products, prices, there's nothing in all the commerce tables but the error is still there, no error message on the website....

CommentFileSizeAuthor
#3 3096157-3-fix-price-notice.patch1.12 KBbojanz

Comments

zorax created an issue. See original summary.

bojanz’s picture

Title: Ajax problem with commerce price and views » Notice: Undefined index: entity_type in commerce_price.module on line 51
Version: 8.x-2.15 » 8.x-2.x-dev
Issue tags: -views ajax price entity

Let's give this issue a descriptive title.

The problem is coming from commerce_price_form_views_ui_config_item_form_alter().

$handler->options['entity_type'] is unset, so we should at least wrap it in an empty check. Looking into this.

EDIT: I have found that for a few cases (such as the product title field), $handler->options['entity_type'] is unset, but $handler->definition['entity_type'] is set. No clue why. So, let's switch to the other version, but still wrap it in an empty check.

bojanz’s picture

Status: Active » Needs review
StatusFileSize
new1.12 KB

Also switching from "entity field" to "field_name" so that I don't have to guess if there's an underscore or not.

Can you try this patch?

  • bojanz committed b0a0486 on 8.x-2.x
    Issue #3096157 by bojanz: Notice: Undefined index: entity_type in...
bojanz’s picture

Status: Needs review » Fixed

Started running into this bug myself, on a state_machine state field, so proceeding with a commit.

Status: Fixed » Closed (fixed)

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