function uc_recurring_get_fees in UC Recurring Payments and Subscriptions 6.2
Same name and namespace in other branches
- 7.2 uc_recurring.module \uc_recurring_get_fees()
Get an array of recurring fees associated with any product on an order.
Parameters
$order: The order object in question.
$reset: TRUE if the fees cache should be reset.
Return value
An array of recurring fee objects containing all their data from the DB.
8 calls to uc_recurring_get_fees()
- ucRecurringAPITestCase::testRecurringAdminFunctions in ./
uc_recurring.test - Test administrator functions.
- ucRecurringTestCase::getSingleRecurringFeeFromOrder in ./
uc_recurring.test - Get a single recurring fee from the order ID.
- uc_recurring_admin in ./
uc_recurring.admin.inc - Displays a table for the administration of recurring fees.
- uc_recurring_hosted_paypal_ipn in modules/
uc_recurring_hosted/ uc_recurring_hosted.paypal_ipn.inc - Handle IPN callbacks for PayPal recurring payments
- uc_recurring_order in ./
uc_recurring.module - Implementation of hook_order().
File
- ./
uc_recurring.module, line 871 - Allows you to add a recurring fee to a product/SKU to handle subscription type services.
Code
function uc_recurring_get_fees($order, $reset = FALSE) {
static $fees = array();
if ($reset || empty($fees[$order->order_id])) {
if (!empty($order->products)) {
$products = array();
foreach ($order->products as $value) {
$products[$value->order_product_id] = $value->order_product_id;
}
$result = db_query("SELECT ru.*, u.name FROM {uc_recurring_users} ru LEFT JOIN {users} u ON u.uid=ru.uid WHERE order_product_id IN (" . db_placeholders($products) . ")", $products);
while ($fee = db_fetch_object($result)) {
$fee->data = unserialize($fee->data);
$fees[$order->order_id][] = $fee;
}
}
}
return !empty($fees[$order->order_id]) ? $fees[$order->order_id] : array();
}