You are here

function uc_wishlist_order_wishlist in UC Wish List 7

Checking if order has wishlist product or not.

1 call to uc_wishlist_order_wishlist()
uc_wishlist_condition_product_wishlist in ./uc_wishlist.rules.inc
Checks that the order has wishlist product.

File

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

Code

function uc_wishlist_order_wishlist($order) {

  // If there is no product in order, return false.
  if (!is_array($order->products) || empty($order->products)) {
    return FALSE;
  }
  foreach ($order->products as $product) {
    $result = db_query("SELECT * FROM {uc_wishlist_products} WHERE nid = :nid AND data = :data", array(
      ':nid' => $product->nid,
      ':data' => serialize($product->data),
    ));
    $item = $result
      ->fetchObject();

    // If there is wishlist product, return true.
    if (!empty($item)) {
      return TRUE;
    }
  }
  return FALSE;
}