I'm getting following messages when displaying service links rendered in a node template, but only on the return page AFTER a Service Link "Send To Friend" request has been submitted:

Notice: Undefined property: stdClass::$service_links_rendered in include() (line 7 of /home/raretear/public_html/sites/all/themes/raretearepublic/templates/node--product.tpl.php).

In line 7 I have tried all manner of print statements, all produce the same result.

<?php print render($content['service_links']); ?><br>
<?php print $node->service_links_rendered; ?><br>
<?php print $service_links_rendered; ?>

According to this page: http://drupal.org/node/949406, service_links_rendered is a variable that should be available in node templates.

The page and service links render fine initially, it's only AFTER Service Links returns to the page after submitting a "Send to Friend" request through Service Links that the Notice shows up.

What do I need to change my print statement to in order for this message to not show up?

Thanks in advance.

Comments

TheCrow’s picture

Category: bug » support

using
print (isset($node->service_links_rendered) ? $node->service_links_rendered : '');
or
print (isset($service_links_rendered ? $service_links_rendered : '');
should go well, just clean the cache after apply it.

TheCrow’s picture

Status: Active » Closed (works as designed)
botris’s picture

Priority: Major » Normal
Status: Closed (works as designed) » Active

To display the links in my node.tpl.php I use:
print $node->service_links_rendered;
This works fine for the visitor, but if I clean my cache I get the same error:

Notice: Undefined property: stdClass::$service_links_rendered in include() (line 97 of /Applications/MAMP/htdocs/website/sites/all/themes/mytheme/templates/nodes/node--product.tpl.php)

TheCrow’s picture

what about #1 ?

botris’s picture

Tried that but can't get it working with the render() function.

TheCrow’s picture

can you post the code here?

botris’s picture

In node--product.tpl.php:

print $node->service_links_rendered;
Works for visitor but gives error:
Notice: Undefined property: stdClass::$service_links_rendered in include() (line 97 of /Applications/MAMP/htdocs/website/sites/all/themes/mytheme/templates/nodes/node--product.tpl.php)

print render($node['service_links_rendered']);
Does not work at all, nor does:
print render($node['service_links']);

TheCrow’s picture

  print (isset($node->service_links_rendered) ? implode(" ", $node->service_links_rendered) : ''); 

remember to enable SErvice Links also for you nodes "Product"

digital fire’s picture

I tried all of the above and nothing has worked. I also have service enabled for my products.

I should also mentioned that I was never able to get the service links working by calling it via its own var. I was only able to get them to show up by populating the links for the node.

digital fire’s picture

Also, I read in another thread that adding the preprocessing in template.php isnt necessary anymore.

Is this correct?

I added it to theme's template filing using my product node type 'just in case' although from what I read this isn't required anymore.

digital fire’s picture

Another issue, I'm running into a cross browser compatibility problem when calling the $content["links"] (Since I can't call each service link individually). The problem was with Safari & Opera, works fine with Firefox and IE. I'm running some tests today to see if it has to do with my site running on 7.12 so I will post updates.

CORRECTION: Just figured out the cross browser issue. My permission weren't set up properly. =/

TheCrow’s picture

Component: Code » Documentation
Status: Active » Closed (fixed)