Example #1
0
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model = tmsModel::getModel();
     $app = JFactory::getApplication();
     $model_product = tmsModel::getModel('product');
     $input = $app->input;
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
     $tsmart_product_id = $app->input->get('tsmart_product_id', 0, 'int');
     $this->product = $model_product->getItem($tsmart_product_id);
     $config = JFactory::getConfig();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
         $this->list_group_size_by_tour_id = vmprice::get_list_group_size_by_tour_id($tsmart_product_id);
         if ($this->product->tour_methor == 'tour_group') {
             $this->list_tour_price_by_tour_price_id = vmprice::get_list_tour_price_by_tour_price_id($tsmart_product_id);
         } else {
             $this->tour_private_price_by_tour_price_id = vmprice::get_list_tour_price_by_tour_price_id_for_price($tsmart_product_id);
         }
         $task = vRequest::getCmd('task', 'add');
         if ($task != 'add' && !empty($cid) && !empty($cid[0])) {
             $cid = (int) $cid[0];
         } else {
             $cid = 0;
         }
         $model->setId($cid);
         $this->price = $model->getPrice();
         $model_product = tmsModel::getModel('product');
         $this->list_tour = $model_product->getProductListing();
         $this->SetViewTitle('', $this->departure->departure_name);
         $this->addStandardEditViewCommands();
     } else {
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
         $tour_id = $input->get('tsmart_product_id', 0, 'int');
         $this->tsmart_product_id = $tour_id;
         $this->product = $model_product->getItem($tsmart_product_id);
         $this->price = $model->getPrice();
         /*            //get markup
                     $this->list_mark_up=vmprice::get_list_mark_up_by_tour_price_id($tsmart_price_id);
                     $this->list_mark_up=JArrayHelper::pivot($this->list_mark_up,'type');
                     //end get markup*/
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
         $this->list_group_size_by_tour_id = vmprice::get_list_group_size_by_tour_id($tour_id);
         if (!count($this->list_group_size_by_tour_id)) {
             throw new Exception('there are no group size setup');
             return false;
         }
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommandsPrice();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vm_service_class.php';
         $this->list_service_class_by_tour_id = tsm_service_class::get_list_service_class_by_tour_id($tour_id);
         $this->prices = $model->getPricesListByTourid($tour_id);
         //$this->prices=JArrayHelper::pivot($this->prices,'service_class_name');
     }
     parent::display($tpl);
 }
Example #2
0
 public function get_list_price()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $price_id = $input->get('price_id', 0, 'int');
     $price_type = $input->get('price_type', '', 'string');
     $model_price = tmsModel::getModel('price');
     $model_price->setId($price_id);
     $price = $model_price->getPrice();
     $return_item = new stdClass();
     $return_item->price = $price;
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
     $tour_id = $input->get('tsmart_product_id', 0, 'int');
     $this->tsmart_product_id = $tour_id;
     $model_product = tmsModel::getModel('product');
     $product = $model_product->getItem($this->tsmart_product_id);
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
     if ($price_type != tsmGroupSize::FLAT_PRICE) {
         $return_item->list_tour_price_by_tour_price_id = vmprice::get_list_tour_price_by_tour_price_id($price_id);
     } else {
         $return_item->tour_private_price_by_tour_price_id = vmprice::get_list_tour_price_by_tour_price_id_for_price($price_id);
     }
     //get markup
     $return_item->list_mark_up = vmprice::get_list_mark_up_by_tour_price_id($price_id);
     $return_item->list_mark_up = JArrayHelper::pivot($return_item->list_mark_up, 'type');
     //end get markup
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
     $return_item->list_group_size_by_tour_id = vmprice::get_list_group_size_by_tour_id($tour_id);
     echo json_encode($return_item);
     die;
 }