shopp_order_exists()

determine if an order exists.

shopp_order_exists ( $id, $by )

@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

Description

determine if an order exists.

Example

Lookup by order id

// check to see if order 10 exists
if ( $Purchase = shopp_order_exists(10) ) {
    // Load Purchase into global context
    ShoppPurchase($Purchase);

    // locate and load receipt.php template
    // locate_shopp_template ($template_names, $load = false, $require_once = true )
    locate_shopp_template ('receipt.php', true, false );
}

Lookup by transaction id

// check to see if order with transaction id QO4N2GHCDZBY32DFU exists
if ( $Purchase = shopp_order_exists('QO4N2GHCDZBY32DFU', 'trans') ) {
    // Load Purchase into global context
    ShoppPurchase($Purchase);

    // locate and load receipt.php template
    // locate_shopp_template ($template_names, $load = false, $require_once = true )
    locate_shopp_template ('receipt.php', true, false );
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar