Hi,
I'm receiving the following errors when clicking the "Products" tab on a product display node:
Notice: Undefined index: nl in commerce_pdm_display_node_products_form() (line 106 of /Volumes/workspace/sandbox/drupal/commerce_kickstart/sites/all/modules/commerce_product_display_manager/commerce_pdm.module).
Warning: Invalid argument supplied for foreach() in commerce_pdm_display_node_products_form() (line 106 of /Volumes/workspace/sandbox/drupal/commerce_kickstart/sites/all/modules/commerce_product_display_manager/commerce_pdm.module).
Setup to reproduce:
Product entities without language assigned to them (und) that are being referenced by a product display node that does have a language assigned to it.
Screenshot of PDM setup to make it more clear: http://grab.by/ay8I
This actually results in *all* products being shown on the "Products" tab, as can be seen here: http://grab.by/ay8J
I had a quick look at the code to try to fix this myself, but I can't currently focus on it :) Might have a look at it later if noone picks it up.
On a totally unrelated note: perhaps commerce_pdm_display_node_products_form() should be in a dedicated .inc file, to avoid this page-specific code to be loaded at the time...
Sven
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | pdm_lang_fix-1220286-9.patch | 645 bytes | denes.szabo |
Comments
Comment #1
Stalski commented1/ the notice I can't reproduce and I have the same set-up
Strange I don't see this notice.
I must say that part is indeed something strange with that language check there. I'll investigate it.
- Edit - I don't see notices, but I do see my products twice , doubling the list. Guess issues are related, but don't see how yet.
2/ the form I will move to another file
This is already pushed.
Comment #2
greysun commentedOccuring on alpha3 and dev version...
Comment #3
Stalski commentedWe'll look into this asap. I have some other contribs that need to be released first and then my attention will go to the commerce project again.
Comment #4
amfis commentedFound the problem:
1. product reference field does not utilize correct language
2. need to check for correct language for current field not node prior iterating
Example:
- reference: $node->product_reference[und][product_id]
- language: $node->language = en
Might this issue be 'References' or 'i18n' module related.
Steps to reproduce:
- enable content translation
- enable i18n module
- create new content type and assign product reference field
- create a new product and assign referenced item to it
- use devel to see what's inside node
Quick fix: commerce_pdm.module (108 line)
Comment #5
amfis commentedAnd yeas.. at line 320 (or so) you need another same fix, plus, there is a typo in variable name $node_language.
Comment #6
Babalu commentedsubscribing. same error here. only when i view the product list at a node
Comment #7
stef.andries commentedBump.
I have the same issue, but the quick patch works nicely.
Any idea on a timing for a permanent fix ?
Thanks for the nice work so far !
Stef
Comment #8
funana commentedSame issue here. Could you provide a patch for this?
Comment #9
denes.szabo commentedI attached my fix for this issue.
As I see, we should never use this type of array access: $node->{$reference_field_name}['und'], because of what if I have other language than 'und' (which actually should be LANGUAGE_NONE constant).
My fix uses field_get_items() to solve this problem.
Comment #10
denes.szabo commentedSorry, I forgot set the status…
Comment #11
itamair commentedIt still doesn't work for me. May be is my fault, but actually I don't think so.
I have a content type that is Magazine, that will be the Product Display Type.
When I create one, from scratch its language is specific (it, in my case).
When I try to attach a Product with the Product Display Manager UI to such a yet existing magazine, it doesn't work as it seems to expect und language content ... so no product is referenced to that display.
The Product Display Manager works well when I attach the product to a new Magazine (new node created on the fly). But in this case the new magazine is created with an 'und' language parameter, bypassing the locale settings of my site.
I think it is really a matter of language management, that #9 patch didn't fix for me ...
Comment #12
stan turyn commentedPatch #9 fixed it for me.
Comment #13
finex commentedConfirmed: patch #9 works fine
Comment #14
jax commentedWorks.
Comment #15
atlea commentedAnother vote for #9.
Comment #16
brunorios1 commented#9 works.
Comment #17
pityu73 commented#9 It works, thank you.
Comment #18
itamair commentedyes, #9 works for me too.
I had just a problem with the Display Manager, that seems won't work properly (just gives any result …) when I have more than one product type defined and referenced to some of my content types (product display).
I just opened another issue about this, here: Display Manager doesn't work with more then one Product Types
Comment #19
funana commented#9 does the job.
Comment #20
Anonymous (not verified) commentedAny chance we could get this committed @Stalski?
Cheers
Comment #21
dimitriseng commented#9 works for me as well, would be great to get this commited... Thanks!
Comment #22
jawi commented#9 solved problems for me!
Patch tested and working fine.
Comment #23
bogeyman commentedHi, there is a module named Commerce Auto Product Display which does similar thing like this module. You might want to use it because this module is no longer maintained.
Comment #24
netsensei commentedPatch in #9 fixes this issue. Committed this to 7.x-1.x-dev. Thanks for contributing!