shopp_set_meta ( $id, $context, $name, $value, $type, $valuetype ) @param int $id (required on creation/update) id of an existing meta entry, or with context the parent object of a new meta entry @param string $context (required on update) the parent object type of the meta entry (example product, price, and more) @param string $name (required on update) the name of the meta entry, more specific than type @param mixed $value (optional default: false) the value stored to the meta entry @param string $type (optional default: meta) the type or classification of the meta data @param string $valuetype (optional default: 'value') 'numeral' or 'value', if the value is numeric, 'numeric' will store in numeric field. @return bool true on successful save or update, fail on failure
create or update a new meta record
Meta data can be used to store a key/value pair and associate that data with a specific object. When storing a value for an existing meta record, by the meta record id, leave the context field false.
This would like like:
shopp_set_meta ( $id, false, $name, $value);
Otherwise, you must specify at a minimum the object id (the meta record is associated with), its context (see common contexts below), the name of the meta record, and the value. The default meta type is meta.
- category – associated with a product taxonomy object
- customer – associated with a Shopp customer object
- image – associated with a Shopp image
- price – associated with a Shopp product single/variant/addon object
- product – associated with a Shopp product object
- shopp – general context, usually a setting type
- meta – the default meta entry type
- image – the meta record is of type image. Product image meta records, for instance are of context product and type image.
- spec – the meta record is of type spec. Product details/specs are meta records of context product and type product
- setting – the meta record is of type setting. Shopp settings are of context shopp and type setting
// add a meta data entry for product 1 shopp_set_meta(1, 'product', 'my-product-meta', 'Hello World!'); $myMeta = shopp_meta(1, 'product', 'my-product-meta'); echo $myMeta; // outputs "Hello World!"