shopp_meta_exists()

determine if one or more meta records exist based on some combination of context, and/or type, and/or name of the metadata.

shopp_meta_exists ( $name = false, $context = false, $type = 'meta' )

@param string $name (optional) name of the meta entry
@param string $context (optional) object context of the meta entry
@param string $type (optional default: meta) type of the meta entry
@return bool true if one or more meta entries exist

Description

determine if one or more meta records exist based on some combination of context, and/or type, and/or name of the metadata.

Examples

// check to see if any meta entry named meta_name exists for context product
echo ( shopp_meta_exists( 'meta_name', 'product') ? "meta_name exists" : "meta_name doesn't exist");

// outputs "meta_name doesn't exist"

// create a meta entry for product 1, named 'meta_name' with the value 'My Value'
shopp_set_meta( 1, 'product', 'meta_name', 'My Value' );
echo ( shopp_meta_exists( 'meta_name', 'product') ? "meta_name exists" : "meta_name doesn't exist");

// outputs "meta_name exists"

// delete an meta entries for product 1 with the name 'meta_name'
shopp_rmv_meta ( 1, 'product', 'meta_name' );
echo ( shopp_meta_exists( 'meta_name', 'product') ? "meta_name exists" : "meta_name doesn't exist");

// outputs "meta_name doesn't exist"

See Also

You must be logged in to post a comment.

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

Skip to toolbar