2011-11-14 5 views

답변

0

좋아,

나는 그것을하는 방법을 발견했다. 기존 쿠폰을 복사하여 변경합니다.

$coupon = commerce_coupon_load_by_code("facebook_coupon"); 

    unset($coupon->coupon_id); 
    unset($coupon->created); 
    unset($coupon->changed); 
    unset($coupon->data); 
    unset($coupon->commerce_coupon_code); 

    // Save 
    commerce_coupon_save($coupon); 

    // rules_invoke_event('facebook_coupon', $coupon); 
    echo $coupon->commerce_coupon_code['und'][0]['value']; 
+0

이 올바른 방법입니다 : http://api.drupalcommerce.org/api/Drupal%20Commerce/sites%21all%21modules%21commerce_coupon%21commerce_coupon.module/function/commerce_coupon_create/DC – werfu