public function ajax_get_coupon() { $input = JFactory::getApplication()->input; $coupon_code = $input->getString('coupon_code', ''); $coupon_model = tmsModel::getModel('coupon'); require_once JPATH_ROOT . '/administrator/components/com_virtuemart/helpers/vmcoupon.php'; $coupon = tsmcoupon::get_coupon_by_coupon_code($coupon_code); echo json_encode($coupon); die; }
public function get_detail_hotel() { $input = JFactory::getApplication()->input; $tsmart_hotel_id = $input->getInt('tsmart_hotel_id', 0); $db = JFactory::getDbo(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcoupon.php'; $hotel = tsmcoupon::get_detail_hotel_by_hotel_id($tsmart_hotel_id); echo json_encode($hotel); die; }
function display($tpl = null) { // Load the helper(s) if (!class_exists('VmHTML')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php'; } $model = tmsModel::getModel(); $input = JFactory::getApplication()->input; $task = $input->get('task'); $config = JFactory::getConfig(); $layoutName = vRequest::getCmd('layout', 'default'); if ($layoutName == 'edit') { $cid = vRequest::getInt('cid'); $task = vRequest::getCmd('task', 'add'); if ($task != 'add' && !empty($cid) && !empty($cid[0])) { $cid = (int) $cid[0]; } else { $cid = 0; } $model->setId($cid); $this->item = $model->getItem(); //get list tour require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcoupon.php'; $this->item->list_tour_id = tsmcoupon::get_list_tour_id_by_hotel_addon_id($this->item->tsmart_hotel_addon_id); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php'; $list_tour = vmproduct::get_list_product(); $this->assignRef('list_tour', $list_tour); //end get list tour $this->SetViewTitle('', $this->item->title); $this->addStandardEditViewCommandsPopup(); } else { $this->SetViewTitle(); JToolBarHelper::publishList(); JToolBarHelper::unpublishList(); JToolBarHelper::editList(); JToolBarHelper::addNew('add_new_item'); JToolBarHelper::deleteList(); $this->addStandardDefaultViewLists($model, 0, 'ASC'); $this->items = $model->getItemList(); $this->pagination = $model->getPagination(); $this->state = $model->getState(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcities.php'; $this->list_cityarea = tsmcities::get_city_state_country(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcoupon.php'; $this->list_hotel_addon_type = tsmcoupon::get_list_hotel_addon_type(); $this->list_hotel_payment_type = tsmcoupon::get_list_hotel_payment_type(); $this->list_hotel_addon_service_class = tsmcoupon::get_list_hotel_addon_service_class(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhotel.php'; require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php'; $list_tour = vmproduct::get_list_product(); $this->assignRef('list_tour', $list_tour); $this->list_hotel = tsmHotel::get_list_hotel(); if ($task == 'edit_item' || $task == 'add_new_item') { $cid = vRequest::getInt('cid'); $task = vRequest::getCmd('task', 'add'); if ($task != 'add' && !empty($cid) && !empty($cid[0])) { $cid = (int) $cid[0]; } else { $cid = 0; } $model->setId($cid); $this->item = $model->getItem(); require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcoupon.php'; $this->hotel = tsmcoupon::get_detail_hotel_by_hotel_id($this->item->tsmart_hotel_id); $this->tour_id_seletecd = tsmcoupon::get_list_tour_id_by_hotel_addon_id($this->item->tsmart_hotel_addon_id); //get list tour $this->item->list_tour_id = tsmcoupon::get_list_tour_id_by_hotel_addon_id($this->item->tsmart_hotel_addon_id); //end get list tour } } parent::display($tpl); }