function commerce_wishlist_product_add_ajax in Commerce Wishlist 7.3
Page callback: Ajax product add.
1 string reference to 'commerce_wishlist_product_add_ajax'
- commerce_wishlist_menu in ./
commerce_wishlist.module - Implements hook_menu().
File
- ./
commerce_wishlist.module, line 831 - Provides a wish list for use in Drupal Commerce.
Code
function commerce_wishlist_product_add_ajax($product, $user) {
if (!commerce_wishlist_user_has_product_in_wishlist($product->product_id, $user->uid)) {
$display_path = '';
if ($_GET['destination'] != '') {
$display_path = $_GET['destination'];
}
commerce_wishlist_product_add($product, NULL, $user->uid, $display_path);
}
$link = theme('commerce_wishlist_added_to_wishlist_link', array(
'user_id' => $user->uid,
));
$commands = array(
ajax_command_replace('a#add-wishlist-' . $product->product_id, $link),
);
ajax_deliver(array(
'#type' => 'ajax',
'#commands' => $commands,
));
}