function _uc_stripe_fancy_name in Ubercart Stripe 7
Same name and namespace in other branches
- 6 uc_stripe.module \_uc_stripe_fancy_name()
Given the nid of the item, return its fancy name
(meaning, for a subscription, show in the shopping cart as: "Item Name ($29.00/month starting in 10 days)" instead of: "Item Name" which could be misleading because it could have no immediate price.
2 calls to _uc_stripe_fancy_name()
- uc_stripe_cart_item in ./
uc_stripe.module - Implements hook_cart_item().
- uc_stripe_form_uc_cart_view_form_alter in ./
uc_stripe.module - Implements hook_form_FORM_ID_alter().
File
- ./
uc_stripe.module, line 672 - A module used for processing payments with Stripe.
Code
function _uc_stripe_fancy_name($nid) {
$pfid = db_result(db_query("SELECT pfid FROM {uc_product_features} WHERE nid = %d", $nid));
if ($pfid) {
$recurring = db_result(db_query("SELECT * FROM {uc_recurring_product} WHERE pfid = %d", $pfid));
if ($recurring) {
$result = db_query("SELECT * FROM {uc_recurring_product} WHERE pfid = %d", $pfid);
$recurring = db_fetch_object($result);
// If this product is recurring, we want to add the info to
// its title display.
$node = node_load($nid);
$product = uc_product_load($node);
$interval = drupal_substr($recurring->regular_interval, 2, -1);
$fee = number_format($recurring->fee_amount, 2);
$title = t("{$node->title} (\${$fee}/{$interval} starting in {$recurring->initial_charge})");
return $title;
}
}
return FALSE;
}