From 8669453bef356227e040073b1c9ad2e6ec889b9b Mon Sep 17 00:00:00 2001
From: Ted Cooper <elc@784944.no-reply.drupal.org>
Date: Thu, 20 Sep 2012 08:49:40 +1000
Subject: [PATCH] Issue #1517084 by fmitchell,ELC: Do not limit attribute display to line item types hard coded to product. Instead print those with products available to print.

---
 commerce_product_attributes.module |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/commerce_product_attributes.module b/commerce_product_attributes.module
index 4a3d275..b329f78 100644
--- a/commerce_product_attributes.module
+++ b/commerce_product_attributes.module
@@ -52,20 +52,17 @@ function commerce_product_attributes_views_api() {
  */
 function commerce_product_attributes_attribute_field(&$element, &$line_item) {
   
-  if ($line_item->type != 'product') {
-    return;
-  }
-
   // Add displayed attributes on product page also in shopping cart:
   $line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
-  $product = $line_item_wrapper->commerce_product->value();
-  $product->bundle = 'product';
+  if (isset($line_item_wrapper->commerce_product)) {
+    $product = $line_item_wrapper->commerce_product->value();
   
-  field_attach_prepare_view('commerce_product', array($product->product_id => $product), 'attribute_view');
-  $output = field_attach_view('commerce_product', $product, 'attribute_view');
-  $element['attributes'][] = array(
-    '#markup' => '<div class="commerce-product-attributes-wrapper">' . drupal_render($output) . '</div>',
-  );
+    field_attach_prepare_view('commerce_product', array($product->product_id => $product), 'attribute_view');
+    $output = field_attach_view('commerce_product', $product, 'attribute_view');
+    $element['attributes'][] = array(
+      '#markup' => '<div class="commerce-product-attributes-wrapper">' . drupal_render($output) . '</div>',
+    );
+  }
 }
 
 
-- 
1.7.1

