I have set up custom view modes for a couple product types. It seems like the product type only 'remembers' the custom display mode after the product type "manage default display" form is submitted, but if the cache is subsequently cleared I start seeing the errors below.
Currently in the Use custom display settings for the following view modes I have selected:
Commerce Line item: Display
Content: Full content
After clearing the cache, when managing the custom product type view modes this error is displayed (repeated 3 times):
Notice: Undefined index: in field_ui_display_overview_form() (line 1114 of /home/tlinc/public_html/modules/field_ui/field_ui.admin.inc).
When viewing the product display node for this product type, this error is displayed (repeated 9 times):
Notice: Undefined index: in field_extra_fields_get_display() (line 693 of /home/tlinc/public_html/modules/field/field.module).
If I clear the cache, edit the Default product type display mode and click Submit, then I can switch to the custom product type display modes without the error, and the product display nodes display without error, until the cache is cleared again -- then the errors appear again.
So it seems like the product type 'knows' about the display mode when I first submit the product type Default display mode, but 'forgets' it after the cache is cleared.
Comments
Comment #1
rszrama commentedYou sure this is related to Commerce itself? We don't do anything to the entity structure or the UI that should interfere with your settings like this. Perhaps it's some other contrib module you're using to create these view modes?
Comment #2
derekw commentedAh yes, I see I left out an important detail of the error messages... they occur with the commerce-defined view modes:
Notice: Undefined index: node_full in field_ui_display_overview_form() (line 1114 of /home/tlinc/public_html/modules/field_ui/field_ui.admin.inc).
Notice: Undefined index: node_full in field_extra_fields_get_display() (line 693 of /home/tlinc/public_html/modules/field/field.module).
Digging around in the commerce code I find that the "node_*" product type view modes are defined by commerce in the commerce_product_reference.module, and those view modes are the only ones I'm seeing these errors associated with.
Can you think why the commerce-defined view modes would not be loaded after all caches are flushed?
I'm running the latest dev of Entity FWIW.
Comment #3
rszrama commentedNot sure. If you backtrack to a stable release of Entity API, does it have any effect? And you don't have any other modules interacting with view modes, like Display Suite?
Comment #4
derekw commentedTurns out the problem was with Web Service client, and removing the unused code by this patch did the trick.
Moving Commerce Product Reference back up in the $implementations array (commenting out commerce_product_reference_module_implements_alter code that puts it last) also worked.
Comment #5
derekw commentedComment #6
benlawraus commentedFYI I saw this
Notice: Undefined index: node_full in field_extra_fields_get_display() (line 693...
after installing the phone.module which gave me a phone field.
When I deleted the field from all content types (not just products), the error no longer appeared. BTW the phone module was still enabled, just not used in any content types.
Comment #7
rszrama commentedSounds like a separate issue to me, and without the full notice message I can't confirm. Note above that this particular issue was opened due to an incompatibility in a third party module (not Commerce).
Comment #8
drupalshrek commentedThis isn't anything particularly related to Drupal Commerce (as I am getting the error and I don't run Drupal Commerce).
Looking at the code (I've marked line 693):
I do use various view modes, so maybe it's something I've define wrongly.
I can maybe help debug it if I get some hints as to what to look for.
Comment #9
drupalshrek commentedI had a look but couldn't track the problem down. Nonetheless, I did create a workaround which avoids the watchdog log from getting full up with annoying errors.
Since the error being logged in the watchdog report is simply that the variable does not have a value, the following changes to the code simply just don't do anything if the variable does not have a value.
In function field_get_display() make the change below:
In function field_extra_fields_get_display() make the change below:
Comment #10
gdesmarais commentedI hit this issue when I was using a view to emulate search results. I had the view display set to fields, and one of the the fields was the rendered content. The problem was that I had previously selected the display for that content type to be Search results. When I disabled the Search module for the sake of efficiency, I also removed the display type of Search result.
Re-enabling the search module put the display type back and got rid of the error.
Comment #11
kamenrs commentedI also had this notice, after disabling Search module.
Notice: Undefined index: search_result in field_extra_fields_get_display() (line 693 of ... field.module)
Enabling back the Search module solved the issue.
Thanks to gdesmarais.
Comment #12
zach harkey commentedThank you @gdesmarais
Your explanation in comment #10 helped me figure out why I was getting this error. In my situation, I was getting
because I had configured a view where one of the fields was rendered content. I had initially chosen node_product_list.
Later I ended up disabling most of the Commerce Kickstart modules for the sake of sanity and control. Evidently they of those modules was providing that node_product_list view mode. Once I changed the view mode to teaser the errors went away.
Comment #13
interdruper commented#10 gave the hint. It is not a bug, but the consequence of the use of the 'Search index' and/or 'Search result' view modes somewhere (in a view, in a search page...) *AFTER* disabling the core Search module.
Closing the issue then.