Esempio n. 1
0
 /**
  * Returns the ID of the category used for ticket assignments. If the ticket category does not exist
  * then it will be created,
  * @return bool|int
  */
 protected function get_ticket_category()
 {
     $available = shopp_product_categories(array('index' => 'name'));
     // Do we need to create the category?
     if (empty($available) || !isset($available[$this->category_name])) {
         $description = apply_filters('shopptickets_ticket_category_description', '');
         $parent = apply_filters('shopptickets_ticket_category_parent', false);
         $id = shopp_add_product_category($this->category_name, $description, $parent);
     } else {
         $id = $available[$this->category_name]->id;
     }
     return $id;
 }
Esempio n. 2
0
/**
 * Get array of category objects that are children of specified category
 *
 * @api
 * @since 1.2
 *
 * @param int $category id of the category you wish to get subcategories for
 * @return array ProductCategory objects
 **/
function shopp_subcategories($category = 0, $args = array())
{
    $defaults = array('get' => '', 'child_of' => $category);
    $args = wp_parse_args($args, $defaults);
    return shopp_product_categories($args);
}