Beispiel #1
0
 /**
  * hook before parsing
  */
 public function parseContentTagsBeforeHook()
 {
     parent::parseContentTagsBeforeHook();
     /**
      * pass GET.recipe_id into template
      */
     $Node = new common_node();
     $node_data = $Node->nodeDetail($this->GET['id']);
     $this->GET['recipe_id'] = $node_data['content'];
     /**
      * pass GET.taxonomy_ids into template
      */
     $Recipe_Taxonomy = new ecommerce_recipe_taxonomy();
     $taxonomy_ids = (array) $Recipe_Taxonomy->getRelationsToRecipe($this->GET['recipe_id']);
     $this->GET['taxonomy_tree_id'] = implode(",", $taxonomy_ids);
     /**
      * rating & reviews
      */
     require_once 'models/ecommerce/ecommerce_recipe_review.php';
     $Review = new ecommerce_recipe_review();
     $review_data = $Review->getRating($this->GET['recipe_id']);
     if ($review_data['count'] > 0) {
         $rating = round($review_data['rating']);
         $_Onxshop_Request = new Onxshop_Request("component/rating_stars~rating={$rating}~");
         $this->tpl->assign('RATING_STARS', $_Onxshop_Request->getContent());
         if ($review_data['count'] == 1) {
             $this->tpl->assign('REVIEWS', 'Review');
         } else {
             $this->tpl->assign('REVIEWS', 'Reviews');
         }
         $this->tpl->assign('REVIEW', $review_data);
         $this->tpl->parse('content.reviews');
     }
 }
 /**
  * get data
  */
 public function getData()
 {
     /**
      * initialize
      */
     require_once 'models/ecommerce/ecommerce_recipe_taxonomy.php';
     $RecipeTaxonomy = new ecommerce_recipe_taxonomy();
     /**
      * get recipe categories
      */
     $data_original = $RecipeTaxonomy->getUsedTaxonomyLabels();
     $data = array();
     /**
      * format
      */
     foreach ($data_original as $item_original) {
         if ($item = $this->formatItem($item_original)) {
             $data[] = $item;
         }
     }
     return $data;
 }
Beispiel #3
0
 /**
  * get taxonomy relation
  */
 static function getTaxonomyForRecipe($recipe_id)
 {
     if (!is_numeric($recipe_id)) {
         return false;
     }
     require_once 'models/ecommerce/ecommerce_recipe_taxonomy.php';
     $Taxonomy = new ecommerce_recipe_taxonomy();
     $relations = $Taxonomy->getRelationsToRecipe($recipe_id);
     return $relations;
 }