Example #1
0
 /**
  * main action
  */
 public function mainAction()
 {
     require_once 'models/ecommerce/ecommerce_product_taxonomy.php';
     $ProductTaxonomy = new ecommerce_product_taxonomy();
     $node_id = $this->GET['id'];
     require_once 'models/common/common_taxonomy.php';
     $Taxonomy = new common_taxonomy();
     //listing
     if (is_numeric($node_id)) {
         $current = $ProductTaxonomy->getRelationsToNode($node_id);
         if (is_array($current)) {
             foreach ($current as $c_id) {
                 $taxonomy_data = $Taxonomy->taxonomyItemDetail($c_id);
                 $option = $taxonomy_data['label'];
                 $this->tpl->assign("OPTION", $taxonomy_data['label']);
                 //check if it is a Product Options
                 if ($taxonomy_data['parent'] == $ProductTaxonomy->conf['options_id']) {
                     $taxonomy_list = $Taxonomy->getChildren($taxonomy_data['id']);
                     foreach ($taxonomy_list as $item) {
                         if ($item['label']['publish'] == 1) {
                             $this->tpl->assign("ITEM", $item);
                             $this->tpl->parse("content.option.item");
                         }
                     }
                     $this->tpl->parse("content.option");
                 }
             }
         }
     }
     return true;
 }
Example #2
0
 /**
  * get taxonomy relation
  */
 function getTaxonomyForProduct($product_id)
 {
     if (!is_numeric($product_id)) {
         return false;
     }
     require_once 'models/ecommerce/ecommerce_product_taxonomy.php';
     $Taxonomy = new ecommerce_product_taxonomy();
     $relations = $Taxonomy->getRelationsToProduct($product_id);
     return $relations;
 }
 /**
  * extentProductIdListByTaxonomy
  */
 function extentProductIdListByTaxonomy($taxonomy_ids, &$product_id_list)
 {
     if (is_array($taxonomy_ids) && count($taxonomy_ids) > 0) {
         $Taxonomy = new ecommerce_product_taxonomy();
         $ids = implode(",", $taxonomy_ids);
         $products = $Taxonomy->listing("taxonomy_tree_id IN ({$ids})");
         foreach ($products as $product) {
             if (!in_array($product['node_id'], $product_id_list)) {
                 $product_id_list[] = $product['node_id'];
             }
         }
     }
 }