Esempio n. 1
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * get product detail
      */
     require_once 'models/ecommerce/ecommerce_product.php';
     $Product = new ecommerce_product();
     $product = $Product->productDetail($this->GET['product_id']);
     /**
      * if product_node_id is empty, than find default
      */
     if (is_numeric($this->GET['product_node_id'])) {
         $product_node_id = $this->GET['product_node_id'];
     } else {
         $product_node_detail = $Product->findProductInNode($this->GET['product_id']);
         $product_node_id = $product_node_detail['id'];
     }
     /**
      * process only published
      */
     if ($product['publish'] == 1) {
         $this->tpl->assign('PRODUCT', $product);
         /**
          * process images
          */
         $this->processImages($product);
         /**
          * varieties
          */
         $Variety_list = new Onxshop_Request("component/ecommerce/variety_list~product_id={$this->GET['product_id']}~");
         $this->tpl->assign('VARIETY_LIST', $Variety_list->getContent());
         /**
          * highlight stars (TODO: rating)
          */
         if ($product['priority'] > 99) {
             $c = $product['priority'] / 100;
             for ($i = 0; $i < $c; $i++) {
                 $this->tpl->parse("content.highlight.star");
             }
             $this->tpl->assign('HIGHLIGHT_TEXT', "&nbsp;&nbsp;&nbsp; {$i} stars rating");
             $this->tpl->parse("content.highlight");
         }
     }
     return true;
 }
Esempio n. 2
0
 protected function getProductInfo($product_variety_id)
 {
     // cache_local product info
     $key = "product_variety_id_{$product_variety_id}";
     if (isset($this->cache_local[$key])) {
         return $this->cache_local[$key];
     }
     require_once 'models/ecommerce/ecommerce_product.php';
     $Product = new ecommerce_product();
     $variety = $Product->getProductVarietyDetail($product_variety_id);
     $product = $Product->productDetail($variety['product_id']);
     $homepage = $Product->getProductHomepage($variety['product_id']);
     $product['url'] = translateURL('page/' . $homepage['id']);
     $Image = new Onxshop_Request("component/image&relation=product&role=main&width=120&node_id={$product['id']}&limit=0,1");
     $product['variety'] = $variety;
     $product['image'] = $Image->getContent();
     $this->cache_local[$key] = $product;
     return $product;
 }