i have created list of component fields in a Drupal 7 module, copied the exported Rules code and then pasted it into our custom module
But it is not working. Any ideas how to get it to work?
This is my exported Rule:
$rule = '{ "rules_faircent_rules" : {
"LABEL" : "Faircent Rules",
"PLUGIN" : "rule set",
"OWNER" : "rules",
"TAGS" : [ "Faircent Rules" ],
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : {
"fc_home_city" : { "label" : "Home city ", "type" : "integer" },
"fc_pin" : { "label" : "Pin Code", "type" : "integer" },
"fc_loan" : { "label" : "Loan Type", "type" : "integer" }
},
"RULES" : [
{ "RULE" : {
"PROVIDE" : { "result" : { "result1" : "Calculation result", "result" : "Calculation result" } },
"IF" : [
{ "data_is" : { "data" : [ "fc-home-city" ], "value" : "10" } },
{ "data_is" : { "data" : [ "fc-pin" ], "value" : "5" } },
{ "data_is" : { "data" : [ "fc-loan" ], "value" : "12" } }
],
"DO" : [
{ "data_set" : { "data" : [ "fc-loan" ], "value" : "35" } },
{ "data_set" : { "data" : [ "fc-home-city" ], "value" : "15" } },
{ "data_set" : { "data" : [ "fc-pin" ], "value" : "25" } },
{ "data_calc" : {
"USING" : { "input_1" : [ "fc-home-city" ], "op" : "+", "input_2" : [ "fc-pin" ] },
"PROVIDE" : { "result" : { "result1" : "Calculation result" } }
}
},
{ "data_calc" : {
"USING" : { "input_1" : [ "result1" ], "op" : "+", "input_2" : [ "fc-loan" ] },
"PROVIDE" : { "result" : { "result" : "Calculation result" } }
}
}
],
"LABEL" : "Calculate over all "
}
}
]
} }';
$configs['commerce_checkout_order_email'] = rules_import($rule);
echo '<pre>';
print_r($configs['commerce_checkout_order_email'] );
Above code is not working for me. What will be exact solution?