You are here

function commerce_wishlist_hash_load in Commerce Wishlist 7.3

Return a wish list for a given hash.

Parameters

string $hash: The hash to load.

Return value

bool|mixed FALSE if no wish list was found, otherwise the commerce order object.

1 call to commerce_wishlist_hash_load()
commerce_wishlist_add_wishlist_url in ./commerce_wishlist.module
Create and store a shareable URL for a given wish list.

File

./commerce_wishlist.module, line 1175
Provides a wish list for use in Drupal Commerce.

Code

function commerce_wishlist_hash_load($hash) {
  $wishlist_id = db_select('commerce_wishlist_share', 'cws')
    ->fields('cws', array(
    'order_id',
  ))
    ->condition('url_hash', $hash)
    ->execute()
    ->fetchField();
  if (!empty($wishlist_id)) {
    return commerce_order_load($wishlist_id);
  }
  return FALSE;
}