shopp_product_meta()

get a product meta entry by product id, type, and name.

shopp_product_meta ( $product = false, $name = false, $type = 'meta' )

@param int $product product id
@param string $name the name of the meta data
@param string $type (default: meta) the meta data type
@return array of stdClass Object meta values, with parent, type, name, and value properties

Description

get a product meta entry by product id, type, and name.

This function uses shopp_meta().

Example

// product specs for movie product, with id 22.
$producer = shopp_product_meta(22, 'Producer', 'spec');
$director = shopp_product_meta(22, 'Director', 'spec');
$genre = shopp_product_meta(22, 'Genre', 'spec');
$Product = new Product('My Product', 'name');

// test if "My Product" has a meta entry named meta1
if (shopp_product_has_meta($Product->id, 'meta1')) {

    // get the value of meta entry named 'meta1' for "My Product"
    $meta_entry1 = shopp_product_meta ( $Product->id, 'meta1');

}

See Also

You must be logged in to post a comment.

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

Skip to toolbar