예제 #1
0
 /**
  * main action
  */
 public function mainAction()
 {
     if ($this->GET['to']) {
         header("HTTP/1.1 301 Moved Permanently");
         onxshopGoTo($this->GET['to']);
     } else {
         if (is_numeric($this->GET['product_id'])) {
             header("HTTP/1.1 301 Moved Permanently");
             require_once 'models/common/common_node.php';
             $Node = new common_node();
             $product_homepage = $Node->getProductNodeHomepage($this->GET['product_id']);
             if (is_array($product_homepage)) {
                 onxshopGoTo("/page/{$product_homepage['id']}");
             } else {
                 msg("Product no longer available");
                 onxshopGoTo("/");
             }
         } else {
             if (is_numeric($this->GET['recipe_id'])) {
                 header("HTTP/1.1 301 Moved Permanently");
                 require_once 'models/common/common_node.php';
                 $Node = new common_node();
                 $recipe_homepage = $Node->getRecipeNodeHomepage($this->GET['recipe_id']);
                 if (is_array($recipe_homepage)) {
                     onxshopGoTo("/page/{$recipe_homepage['id']}");
                 } else {
                     msg("Recipe no longer available");
                     onxshopGoTo("/");
                 }
             } else {
                 if (is_numeric($this->GET['store_id'])) {
                     header("HTTP/1.1 301 Moved Permanently");
                     require_once 'models/ecommerce/ecommerce_store.php';
                     $Store = new ecommerce_store();
                     $store_homepage = $Store->getStoreHomepage($this->GET['store_id']);
                     if (is_array($store_homepage)) {
                         onxshopGoTo("/page/{$store_homepage['id']}");
                     } else {
                         msg("Store no longer available");
                         onxshopGoTo("/");
                     }
                 }
             }
         }
     }
     return true;
 }
예제 #2
0
 /**
  * main action
  */
 public function mainAction()
 {
     /**
      * initialize
      */
     require_once 'models/ecommerce/ecommerce_product.php';
     require_once 'models/common/common_node.php';
     $Node = new common_node();
     $Product = new ecommerce_product();
     /**
      * get node detail
      */
     $node_data = $Node->nodeDetail($this->GET['id']);
     $product_id = $node_data['content'];
     /**
      * Check if this is a product homepage
      */
     $product_node_homepage = $Node->getProductNodeHomepage($product_id);
     if ($node_data['id'] != $product_node_homepage['id']) {
         //forward to homepage
         $link = $Node->getSeoURL($product_node_homepage['id']);
         header("HTTP/1.1 301 Moved Permanently");
         header("Location: http://{$_SERVER['SERVER_NAME']}{$link}");
         exit;
     }
     /**
      * get simple product detail (just for basic product attributes)
      */
     $simple_product_detail = $Product->detail($product_id);
     /**
      * get taxonomy_class
      */
     $related_taxonomy = $Product->getRelatedTaxonomy($product_id);
     $simple_product_detail['taxonomy_class'] = $this->createTaxonomyClass($related_taxonomy);
     /**
      * save product taxonomy_class to registry
      */
     $this->saveBodyCssClass($simple_product_detail['taxonomy_class']);
     /**
      * assign simple product data to template
      */
     $this->tpl->assign("PRODUCT", $simple_product_detail);
     /**
      * varieties
      */
     //$Variety_list = new Onxshop_Request("component/ecommerce/variety_list_ajax~product_id={$product_id}~");
     //$this->tpl->assign('VARIETY_LIST', $Variety_list->getContent());
     /**
      * taxonomy
      */
     $_Onxshop_Request = new Onxshop_Request("component/taxonomy~relation=product:id={$product_id}:hide_root=1~");
     $this->tpl->assign('TAXONOMY', $_Onxshop_Request->getContent());
     /**
      * other product attributes
      */
     $_Onxshop_Request = new Onxshop_Request("component/ecommerce/product_other_data~id={$product_id}~");
     $this->tpl->assign('OTHER_DATA', $_Onxshop_Request->getContent());
     /**
      * product reviews
      */
     $_Onxshop_Request = new Onxshop_Request("component/ecommerce/product_review~node_id={$product_id}:allow_anonymouse_submit=0~");
     $this->tpl->assign('PRODUCT_REVIEW', $_Onxshop_Request->getContent());
     /**
      * standard page actions
      */
     $this->processContainers();
     $this->processPage();
     if (strlen($simple_product_detail['name_aka']) > 0) {
         $this->tpl->parse('content.name_aka');
     }
     /**
      * everything went well
      */
     return true;
 }