function course_uc_uc_add_to_cart in Course 7.2
Same name and namespace in other branches
- 8.3 modules/course_uc/course_uc.module \course_uc_uc_add_to_cart()
- 8.2 modules/course_uc/course_uc.module \course_uc_uc_add_to_cart()
- 7 modules/course_uc/course_uc.module \course_uc_uc_add_to_cart()
- 3.x modules/course_uc/course_uc.module \course_uc_uc_add_to_cart()
Implements hook_add_to_cart().
File
- modules/
course_uc/ course_uc.module, line 234
Code
function course_uc_uc_add_to_cart($nid, $qty, $data) {
if (variable_get('course_uc_restrict_qty', 1)) {
global $user;
$node = node_load($nid);
if (course_node_is_course($node)) {
if (course_uc_check_purchased($user->uid, $nid, $data)) {
return array(
array(
'success' => FALSE,
'message' => t('You have already purchased this course.'),
'silent' => FALSE,
),
);
}
if (course_uc_check_cart($nid, $user->uid, $data)) {
return array(
array(
'success' => FALSE,
'message' => t('This course is already in your !cart.', array(
'!cart' => l('shopping cart', 'cart'),
)),
'silent' => FALSE,
),
);
}
}
}
}