shopp_product_add_terms()

add or set taxonomical terms to a product.

shopp_product_add_terms ( $product, $terms, $taxonomy, $behavior )

@param int $product (required) the product id to add/set the terms to
@param array $terms (optional default:empty) list of terms to add/set
@param string $taxonomy (optional default:shopp_category) name of the taxonomy to use
@param string $behavior (optional default:append) append to add the terms, else the terms will override what is currently set for the taxonomy
@return bool true on success, false on failure

Description

Add or set taxonomical terms to a product

Example

// Given a taxonomy called shopp_brand exists, 
// see shopp_register_taxonomy() for more information

// Create a new shopp_brand term
$term = shopp_add_product_term("Domestic Brands", 'shopp_brand');

// Create a new shopp_brand term, with the previous as the parent
$term1 = shopp_add_product_term("St. John's Bay", 'shopp_brand', $term);

// Add these shopp_brand terms to product 130
shopp_product_add_terms(130, array($term,$term1), 'shopp_brand');

See Also

You must be logged in to post a comment.

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

Skip to toolbar