示例#1
0
/**
 * shopp_order_exists - determine if an order exists with the specified id, or transaction id.
 *
 * @api
 * @since 1.2
 *
 * @param int $id the order id, or the transaction id
 * @param string $by (optional default:id) lookup by 'id', or 'trans'
 * @return Purchase|bool Purchase object returned if the order exists, else returns false
 **/
function shopp_order_exists($id = false, $by = 'id')
{
    $Purchase = new ShoppPurchase();
    if ($by == 'trans') {
        $Purchase->load($id, 'txnid');
    } else {
        $Purchase->load($id);
    }
    if (!$Purchase->id) {
        return false;
    }
    return $Purchase;
}