You are here

function uc_wishlist_cart_item in UC Wish List 6

Implements Ubercart hook_cart_item

When an item is loaded in the shopping cart, this adds a note to the title to show from which wish list this item came. This will not display in the cart (since those titles come from hook_cart_display), but will show on the checkout screen and be recorded in the order.

File

./uc_wishlist.module, line 376
Allows users to create public shopping/wish lists.

Code

function uc_wishlist_cart_item($op, &$item) {
  switch ($op) {
    case 'load':
      if ($item->data && $item->data['wid'] && $item->data['wpid']) {
        $wishlist = uc_wishlist_load($item->data['wid']);
        if ($wishlist && !empty($wishlist->title)) {
          $item->title .= t(' [from !wishlist]', array(
            '!wishlist' => filter_xss($wishlist->title, array()),
          ));
        }
      }
      break;
  }
}