Esempio n. 1
0
 public function load(array $options = array())
 {
     // $options['debug'] = true;
     if ($this->filters) {
         add_filter('shopp_taxonomy_load_options', array($this, 'facetsql'));
     }
     // Include loading overrides (generally from the Theme API)
     if (!empty($this->loading) && is_array($this->loading)) {
         $options = array_merge($options, $this->loading);
     }
     return parent::load($options);
 }
Esempio n. 2
0
/**
 * Get a list of product objects for the given term and taxonomy
 *
 * @api
 * @since 1.2
 *
 * @param int $term (required) The term id
 * @param string $taxonomy The taxonomy name
 * @param array $options loading options
 * @return array Product objects
 **/
function shopp_term_products($term = false, $taxonomy = 'shopp_category', $options = array())
{
    $defaults = array('limit' => 1000, 'debug' => false);
    $options = wp_parse_args($options, $defaults);
    if (!taxonomy_exists($taxonomy) || !in_array($taxonomy, get_object_taxonomies(ShoppProduct::$posttype))) {
        shopp_debug(__FUNCTION__ . " failed: Invalid Shopp taxonomy {$taxonomy}.");
        return false;
    }
    if (!($term = term_exists($term, $taxonomy))) {
        shopp_debug(__FUNCTION__ . " failed: {$term} not a valid Shopp {$taxonomy} term.");
        return false;
    }
    $Tax = new ProductTaxonomy();
    $Tax->id = $term['term_id'];
    $Tax->term_taxonomy_id = $term['term_taxonomy_id'];
    $Tax->taxonomy = $taxonomy;
    $Tax->load($options);
    return !empty($Tax->products) ? $Tax->products : array();
}