Discussions

Getting Product Details on payment method

On 'Select available payment methods for an order' i want to get the product field. My Product name is event and it has a field 'number of participants' but i am not able to get it in rules. I want to put check on this field plz help?

Tags: 
Posted: Mar 11, 2013

Comments

alinouman92 on March 13, 2013

I have written this code in rule(it was select available payment method) condition may be it helps some one

<?php
$line_items
= $commerce_order->commerce_line_items['und'];
foreach(
$line_items as $lid) {
 
$line_item = commerce_line_item_load($lid['line_item_id']);
  
$pid = $line_item->data['context']['product_ids'][0];
 
$product commerce_product_load($pid);
  
$field_part = $product->field_minimum_participants['und'][0]['value'];

 if(
$field_part == 1) {

    return
TRUE

  }
}
return
FALSE;
?>