I am developing an Ecommerce site and I am using Drupal-commerce module for it. I have an issue regarding loading the contents of a product which is: How can I programmatically get the contents of all the products in a particular product type?

2 Answers 2


This can be done with an EntityFieldQuery:

  $query = new EntityFieldQuery();
  $result = $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'product')
  $nodes = node_load_multiple(array_keys($result['node']));

This code will help you.

$banner_query = db_select('node','n');
$banner_query->innerJoin('field_data_field_weight','w','w.entity_id = n.nid');  // join with another table
$banner_res = $banner_query->execute();

while($banner_fetch = $banner_res->fetchObject()){
    $banner_load = node_load($banner_fetch->nid);
    echo "<pre>"; print_r($banner_load)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.