Index: ec_anon/ec_anon.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ecommerce/ec_anon/ec_anon.module,v
retrieving revision 1.13.2.29
diff -u -p -r1.13.2.29 ec_anon.module
--- ec_anon/ec_anon.module	29 May 2010 12:59:19 -0000	1.13.2.29
+++ ec_anon/ec_anon.module	11 Jul 2010 09:41:01 -0000
@@ -393,33 +393,45 @@ function ec_anon_ec_ptypes_alter(&$ptype
 }
 
 /**
- * Implementation of hook_link().
- */
-function ec_anon_link($type, $object, $teaser = FALSE) {
-  global $user;
-  
-  $$type =& $object;
-  
+* Implementation of hook_link().
+*/
+function ec_anon_link($type, $node, $teaser = FALSE) {
   if ($type == 'node') {
     if (variable_get('ec_product_cart_addition_by_link', TRUE) &&
       (($teaser && variable_get('ec_product_cart_on_teaser', 1)) || !$teaser)) {
-      $l = array();
-      
-      if (!ec_anon_product_allowed_in_cart($node, $user->uid, FALSE)) {
-        if ($user->uid) {
-          $l['ec_anon_reg_not_allowed'] = array(
-            'title' => t('Product can only be purchased by anonymous customers'),
-          );
-        }
-        else {
-          $l['ec_anon_anon_not_allowed'] = array(
-            'title' => t('Product can only be purchased by registered customers. Please !login or !register to purchase', array('!login' => l(t('login'), 'user/login', array('query' => drupal_get_destination())), '!register' => l(t('register'), 'user/register', array('query' => drupal_get_destination())))),
-            'html' => TRUE,
-          );
-        }
-        
+        $l = ec_anon_build_link($node);
         return $l;
+    }
+  }
+}
+
+/**
+* Build link for ec_anon
+*/
+function ec_anon_build_link($node) {
+  global $user;
+
+  $l = array();
+  if (isset($node->ptype)) {
+    if (!ec_anon_product_allowed_in_cart($node, $user->uid, FALSE)) {
+      if ($user->uid) {
+        $l['ec_anon_reg_not_allowed'] = array(
+          'title' => t('Product can only be purchased by anonymous customers'),
+        );
+      }
+      else {
+        $l['ec_anon_anon_not_allowed'] = array(
+          'title' => t('Product can only be purchased by registered customers. Please !login or !register to purchase',
+            array(
+              '!login' => l(t('login'), 'user/login', array('query' => drupal_get_destination())),
+              '!register' => l(t('register'), 'user/register', array('query' => drupal_get_destination()))
+            )
+          ),
+          'html' => TRUE,
+        );
       }
     }
   }
+
+  return $l;
 }
