function _uc_coupon_purchase_load_recipient_attribute in Ubercart Discount Coupons 7.3
Helper function to load the attribute which we use for gift certificate recipients.
@reset TRUE to flush the cache.
Return value
The loaded attribute object, or FALSE if not found.
3 calls to _uc_coupon_purchase_load_recipient_attribute()
- uc_coupon_purchase_add_to_cart_form_validate in uc_coupon_purchase/
uc_coupon_purchase.module - Extra validation callback for uc_product_add_to_cart_form.
- uc_coupon_purchase_coupon_settings_form_submit in uc_coupon_purchase/
uc_coupon_purchase.module - Submit handler for uc_coupon_settings_form.
- _uc_coupon_purchase_create_recipient_attribute in uc_coupon_purchase/
uc_coupon_purchase.module - Helper function to create the product attribute specifying gift certificate recipients. Will only create the attribute if it does not already exist.
File
- uc_coupon_purchase/
uc_coupon_purchase.module, line 469
Code
function _uc_coupon_purchase_load_recipient_attribute($reset = FALSE) {
static $attribute = NULL;
if (!module_exists('uc_attribute')) {
return FALSE;
}
elseif (is_null($attribute) || $reset) {
$aid = db_query('SELECT aid FROM {uc_attributes} WHERE name = :name', array(
':name' => UC_COUPON_PURCHASE_RECIPIENT_ATTRIBUTE,
))
->fetchField(0);
$attribute = $aid ? uc_attribute_load($aid) : FALSE;
}
return $attribute;
}