Pass nodes in array on page into a views argument?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jdln's picture

I have an array on my page that lists some node ID's. If I attach a view to this page, can I return those nodes in a view by using custom PHP code in an argument to ‘find’ this array?

I dont know a huge amount of PHP but using contemplate ive found the code that in a template file prints the node IDs.

<?php
 
foreach ($node->products as $myp_roducts) {
    print
$myp_roducts->nid;
  }
?>

Im trying to show other fields for these nodes. Some fields are in the array so i can print them with theming, but some fields that I need are not.

The reason I need to do this is im using a product kit in ubercart. A product kit contains multiple products, and i want to show their fields (price, weight, image, etc) on the product kit page.

The 'contained' products are not linked with a node reference so I cant use a node reference relationship, but im essentially trying to achieve the same thing.

In summary, I have an array on my page that lists the node IDs. Can I somehow show other fields for these nodes on this page?

Ive been trawling the ubercart forums for weeks trying to solve this. Their are a lot of threads but no solutions. If someone can help me with this ill happily write a how too guide for other ubercart users.

Thanks

Comments

Anyone?

jdln's picture

Anyone?

Views Developers

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week