I am writing a module called Commerce Product Add-on that puts products as add-ons on the Add to Cart forms of other products. It works for the most part.
Part of what it does is add another view mode for product entities. This view mode is used for this context.
We call this to add the displayed product to the form, rendering the resulting array.
entity_view('commerce_product', array($product_add_on->product_id => $product_add_on),
'commerce_pado', $language->language, TRUE);
However, for people without the View Product permissions, like anonymous users it throws an error.
Notice: Undefined index: path in template_preprocess_entity() (line 1020 of /sites/all/modules/entity/entity.module).
So path is not being set. If I set the page parameter to FALSE, it still happens. Although it needs to be TRUE, so it doesn't render the product title.
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1934382.entity_uri_path_check.patch | 954 bytes | rszrama |
Comments
Comment #1
orbistertius CreditAttribution: orbistertius commentedI got the same error and asumed that the system is working but with the error.
so I changed the mentioned line intro:
All in all there are problems with commerce and entity in some areas and since a lot of time. #1392654 for example.
Guess this is quiet similar.
Regards,
Comment #2
orbistertius CreditAttribution: orbistertius commentedYou posted the same error in commerce as well.
Here is the other solution mucho more for commerce.
Comment #3
thim CreditAttribution: thim commentedfor me this did the trick: http://drupal.org/node/1275902#comment-7196730
Comment #4
fagoSee #1275902: Allow entity URI callbacks to indicate that the entity has no URI, and make the User module use that for anonymous users.
Comment #5
rszrama CreditAttribution: rszrama commentedHey fago, I don't suppose we could consider adding this simple workaround to the core ambiguity re: NULL entity URIs? The docblock for entity_uri() indicates that it should return NULL if an entity has no URI, but in practice it only returns NULL if an entity does not have a valid uri callback. I know you've commented on the core issue, but core issues being what they are, in the meantime might we add this non-invasive isset() check to the Entity API itself?
Comment #6
joshmillerI see this support request a LOT and having this cleaned up would be very beneficial for the whole Commerce Community.
Comment #7
pcambra+1 to apply this workaround as "commerce community" :) this warning makes commerce recurring tests to fail.
Comment #8
pasive CreditAttribution: pasive commented+1 to apply this workaround for Drupal commerce. I think non-invasive isset() should resolve the problem.
@rszrama and others, this seems a recurring problem and relates quite a few issues together. Can, by common efforts, we resolve it at least for Entity/Drupal Commerce side as it really breaks tests and creates many UI issues on running projects.
P.S. non intrusive isset patch tough works well.
Comment #10
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe 5 year old patch in #5 to entity.theme.inc does not apply to the latest entity 7.x-1.x-dev and (if still relevant) needs reroll.
Comment #11
shubham.prakash CreditAttribution: shubham.prakash at OpenSense Labs commentedThis issue has been fixed and no longer valid.
Comment #12
shubham.prakash CreditAttribution: shubham.prakash at OpenSense Labs commented