Is there any way to generate Drupal commerce coupon code bulky?
I found commerce_coupon_batch module but it require Commerce_coupon_ui
module that there is not exist in sub module of commerce_coupon version 7.x-2.0-beta1
.
I don't try anything yet, How can I generate coupon code bulky?
I look at db and found there is a table for coupon ,commerce_coupon
is just sufficient to add record to this table programmatically?
I try below code to create one coupon , but nothing added to coupon list in admin/commerce/coupons :
$No=$form_state["values"]["code_NO"];
$type_id=$form_state["values"]["type"];
$record['type']='discount_coupon';
$record['code']=commerce_coupon_generate_coupon_code($type_id);
$record['commerce_discount_reference']['und']['0']['target_id'] =$type_id;
$record['commerce_coupon_conditions']['und'][0]=Array('condition_name'=>'commerce_coupon_usage_evaluate_usage',
'condition_settings' =>Array( 'max_usage'=> 1),
'remove_condition'=> 'Remove',);
ym(entity_get_controller('commerce_coupon')->create($record));