You are here

function uc_coupon_load in Ubercart Discount Coupons 5

Same name and namespace in other branches
  1. 6 uc_coupon.module \uc_coupon_load()
  2. 7.3 uc_coupon.module \uc_coupon_load()
  3. 7.2 uc_coupon.entity.inc \uc_coupon_load()

Load a coupon into the form for editing

Parameters

$cid: Unique Coupin ID.

Return value

$coupon Returns a coupon object.

6 calls to uc_coupon_load()
uc_coupon_add_form in ./uc_coupon.module
Form builder for product attributes.
uc_coupon_codes_csv in ./uc_coupon.module
Generate a list of bulk coupon codes.
uc_coupon_delete_confirm in ./uc_coupon.module
Delete coupon confirm form
uc_coupon_delete_confirm_submit in ./uc_coupon.module
uc_coupon_purchase_feature_form_submit in uc_coupon_purchase/uc_coupon_purchase.module

... See full list

File

./uc_coupon.module, line 732
Provides discount coupons for Ubercart.

Code

function uc_coupon_load($cid) {
  $coupon = db_fetch_object(db_query("SELECT * FROM {uc_coupons} WHERE cid = %d", $cid));
  if (!$coupon) {
    drupal_not_found();
    return;
  }
  if ($coupon->data) {
    $coupon->data = unserialize($coupon->data);
  }
  return $coupon;
}