I am not sure whether this should go here or under Drupal Commerce. The error/notice originates form within the Inline Conditions module folder, but a Drupal Commerce hook. Either way, this is the notice I get:

Notice: Trying to get property of non-object in commerce_product_has_specified_terms_build() (line 200 of /Applications/MAMP/htdocs/undertwenty/sites/all/modules/inline_conditions/modules/commerce_product.inline_conditions.inc).

Don't know if this is causing any problems, but did not see a fix anywhere.

Can provide more info if needed. Thanks!

Comments

onduhray’s picture

May or may not be related to this: https://drupal.org/node/1780646

jkuma’s picture

Status: Active » Needs review
StatusFileSize
new656 bytes

Hi g33kdot,

Can you provide me more information please. Especially taxonomy term type fields attached on your product types. Also, maybe one of your taxonomy term list doesn't have any vocabulary term. That's why, may you test the patch attached ?

onduhray’s picture

Note: I should have tried the patch -first-, but alas, I wrote everything below first. The patch worked like a charm, the notice is gone. Hopefully the notes below might be useful for something.

========================================================================
If it's important I am using the Drupal Commerce Kickstart distribution with the sample store installed. Most fields are default at this point, except for the Radioactivity module and whats listed below.

I have only add one new Taxonomy term called "Sales Events". It contains one term at the moment called "20% Off".

Each product variation [not content type] contains roughly 3 taxonomy term fields, depending on type of product. "Color", "Size", "Capacity" and "Sales Events", of which there is only one non-default field ["sales events"] that is on all product variations. This is in order to apply discount pricing rules.

I recently upgraded the Drupal Commerce Discount module to alpha3, as the version in Kickstart V2 was outdated. In order to upgrade it required me to install Inline Conditions.

The "notice" appears every I view any of the products directly or in any View created, both ones I've made and the defaults. It seems to give the error for each product in the view (if there are two products in the view, the notice at the top has two bullets, with the same notice).

This is the section of the .inc file that is giving the notice:

foreach ($term_fields as $term_field) {
      // If the wrapped field is an instance of EntityListWrapper class, that
      // means that field contains multiple values.
      if ($wrapper->commerce_product->$term_field instanceof EntityListWrapper) {
        foreach ($wrapper->commerce_product->$term_field as $wrapper_term) {
          if (($key = array_search($wrapper_term->getIdentifier(), $terms_name)) !== FALSE) {
            unset($terms_name[$key]);
          }
        }
      }
      else {
        $term = $wrapper->commerce_product->$term_field->value();
       <strong> if (($key = array_search($term->tid, $terms_name)) !== FALSE) {</strong>
          unset($terms_name[$key]);
        }
      }
    }
  }

Line 200 is in bold. Each product variation in my store has the "Sales Events" taxonomy field, but only a few variations actually have a term applied. I cannot tell if this is simply looking at the Taxonomy terms themselves, or their application to each product. I have also looked through each Taxonomy vocab and everyone has at least one term added.

jkuma’s picture

Status: Needs review » Reviewed & tested by the community

Hi g33kdot, I'm glad to hear that the patch is working for you. I'll commit it soon and I'm planning to tag an alpha1 version for inline_conditions.
Thanks for your comments !

jkuma’s picture

Status: Reviewed & tested by the community » Fixed

Committed in 7.x-1.x-dev branch.

Status: Fixed » Closed (fixed)

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