コード例 #1
0
ファイル: product.php プロジェクト: cuongnd/etravelservice
 public function ajax_get_list_service_class_by_tour_id()
 {
     $input = JFactory::getApplication()->input;
     $tsmart_product_id = $input->getInt('tsmart_product_id');
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
     $list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($tsmart_product_id);
     echo json_encode($list_service_class);
     die;
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: cuongnd/etravelservice
 function display($tpl = null)
 {
     // Load the helper(s)
     $app = JFactory::getApplication();
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $task = $app->input->getString('task', '');
     $tsmart_product_id = $app->input->getInt('tsmart_product_id', 0);
     $model = tmsModel::getModel();
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
     $this->tsmart_product_id = $app->input->get('tsmart_product_id', 0, 'int');
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhotel.php';
     $this->list_hotel = tsmHotel::get_list_hotel();
     $this->list_hotel = JArrayHelper::pivot($this->list_hotel, 'tsmart_hotel_id');
     $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();
         $this->SetViewTitle('', $this->item->title);
         $this->addStandardEditViewCommandsPopup();
     } else {
         $this->item = $model->getItem();
         $this->SetViewTitle();
         $this->addStandardDefaultViewCommands();
         $this->addStandardDefaultViewLists($model, 0, 'ASC');
         $this->items = $model->getItemList(vRequest::getCmd('search', false));
         $this->pagination = $model->getPagination();
         if ($task == 'edit_item' || $task == 'add_new_item') {
             $app = JFactory::getApplication();
             $input = $app->input;
             $tsmart_itinerary_id = $input->getInt('tsmart_itinerary_id', 0);
             $tsmart_product_id = $input->getInt('tsmart_product_id', 0);
             $cid = vRequest::getInt('cid');
             $tsmart_accommodation_id = $cid[0];
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $this->list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmaccommodation.php';
             $this->list_hotel_selected_by_service_class_id_and_itinerary_id = tsmaccommodation::get_list_hotel_selected_by_service_class_id_and_itinerary_id_accommodation_id($this->list_service_class, $tsmart_itinerary_id, $tsmart_accommodation_id);
         }
     }
     parent::display($tpl);
 }
コード例 #3
0
ファイル: promotion.php プロジェクト: cuongnd/etravelservice
 public function get_list_promotion_price()
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $view =& $this->getView('promotion', 'html', 'tsmartView');
     $tsmart_promotion_price_id = $input->get('tsmart_promotion_price_id', 0, 'int');
     $model_promotion_price = tmsModel::getModel('promotion');
     $model_promotion_price->setId($tsmart_promotion_price_id);
     $promotion_price = $model_promotion_price->get_promotion_price();
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php';
     $product = vmpromotion::get_product_by_promotion_price_id($tsmart_promotion_price_id);
     $tsmart_product_id = $product->tsmart_product_id;
     $return_item = new stdClass();
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
     $list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($tsmart_product_id);
     $return_item->list_service_class = $list_service_class;
     $return_item->promotion_price = $promotion_price;
     $view->assignRef('promotion_price', $return_item->promotion_price);
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php';
     $model_product = tmsModel::getModel('product');
     $product = $model_product->getItem($tsmart_product_id);
     $return_item->tour = $product;
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmpromotion.php';
     $product = vmpromotion::get_product_by_promotion_price_id($tsmart_promotion_price_id);
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
     if ($product->price_type != tsmGroupSize::FLAT_PRICE) {
         $return_item->list_tour_promotion_price_by_tour_promotion_price_id = vmpromotion::get_list_tour_promotion_price_by_tour_promotion_price_id($tsmart_promotion_price_id);
         $view->assignRef('list_tour_promotion_price_by_tour_promotion_price_id', $return_item->list_tour_promotion_price_by_tour_promotion_price_id);
     } else {
         $return_item->tour_private_price_by_tour_promotion_price_id = vmpromotion::get_list_tour_promotion_price_by_tour_price_id_for_promotion_price($tsmart_promotion_price_id);
         $view->assignRef('tour_private_price_by_tour_promotion_price_id', $return_item->tour_private_price_by_tour_promotion_price_id);
     }
     //get markup
     $return_item->list_promotion_mark_up = vmpromotion::get_list_mark_up_by_tour_promotion_price_id($tsmart_promotion_price_id);
     $return_item->list_promotion_mark_up = is_array($return_item->list_promotion_mark_up) ? $return_item->list_promotion_mark_up : array($return_item->list_promotion_mark_up);
     $return_item->list_promotion_mark_up = JArrayHelper::pivot($return_item->list_promotion_mark_up, 'type');
     $view->assignRef('list_promotion_mark_up', $return_item->list_promotion_mark_up);
     //end get markup
     //get markup
     $return_item->list_promotion = vmpromotion::get_list_promotion_by_tour_promotion_price_id($tsmart_promotion_price_id);
     $return_item->list_promotion = is_array($return_item->list_promotion) ? $return_item->list_promotion : array($return_item->list_promotion);
     $return_item->list_promotion = JArrayHelper::pivot($return_item->list_promotion, 'type');
     $view->assignRef('list_promotion', $return_item->list_promotion);
     //end get markup
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
     $return_item->list_group_size_by_tour_id = vmpromotion::get_list_group_size_by_tour_id($tsmart_product_id);
     $view->assignRef('list_group_size_by_tour_id', $return_item->list_group_size_by_tour_id);
     ob_start();
     $input->set('tpl', 'price');
     $view->assignRef('product', $product);
     $view->display_price();
     $price_content = ob_get_contents();
     $return_item->price_content = $price_content;
     ob_end_clean();
     // get the callback function
     echo json_encode($return_item);
     die;
 }
コード例 #4
0
ファイル: view.html.php プロジェクト: cuongnd/etravelservice
 function display($tpl = null)
 {
     // Get the task
     $task = vRequest::getCmd('task', $this->getLayout());
     $this->assignRef('task', $task);
     // Load helpers
     if (!class_exists('CurrencyDisplay')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
     }
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     if (!class_exists('VmImage')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
     }
     $model = tmsModel::getModel();
     // Handle any publish/unpublish
     switch ($task) {
         case 'add':
         case 'edit':
             //this was in the controller for the edit tasks, we need this for the access by FE
             //$this->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'product'.DS.'tmpl');
             tsmConfig::loadJLang('com_tsmart_orders', TRUE);
             tsmConfig::loadJLang('com_tsmart_shoppers', TRUE);
             $model_country = tmsModel::getModel('country');
             $this->countries = $model_country->getItemList();
             $tsmart_product_id = vRequest::getInt('tsmart_product_id');
             if (is_array($tsmart_product_id) && count($tsmart_product_id) > 0) {
                 $tsmart_product_id = (int) $tsmart_product_id[0];
             } else {
                 $tsmart_product_id = (int) $tsmart_product_id;
             }
             $product = $model->getItem($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $product->tsmart_service_class_ids = tsmserviceclass::get_list_service_class_ids_by_tour_id($tsmart_product_id);
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
             $product->tsmart_group_size_ids = tsmGroupSize::get_list_group_size_ids_by_tour_id($tsmart_product_id);
             //$user = JFactory::getUser();
             $superVendor = vmAccess::isSuperVendor();
             if ($superVendor != 1 and $superVendor != $product->tsmart_vendor_id) {
                 vmdebug('Product view.html.php ' . $superVendor, $product->tsmart_vendor_id);
                 JFactory::getApplication()->redirect('index.php?option=com_tsmart&view=tsmart', tsmText::_('com_tsmart_ALERTNOTAUTHOR'), 'error');
             }
             if (!empty($product->product_parent_id)) {
                 $product_parent = $model->getProductSingle($product->product_parent_id, false);
             }
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $this->tour_service_class = tsmserviceclass::get_list_tour_service_class();
             $customfields = tmsModel::getModel('Customfields');
             $product->allIds[] = $product->tsmart_product_id;
             if (!empty($product->product_parent_id)) {
                 $product->allIds[] = $product->product_parent_id;
             }
             $product->customfields = $customfields->getCustomEmbeddedProductCustomFields($product->allIds);
             // Get the category tree
             if (isset($product->categories)) {
                 $this->category_tree = ShopFunctions::categoryListTree($product->categories);
             } else {
                 $this->category_tree = ShopFunctions::categoryListTree();
             }
             //Fallback for categories inherited by parent to correctly calculate the prices
             if (empty($product->categories) and !empty($product_parent->categories)) {
                 $product->categories = $product_parent->categories;
             }
             //Get the shoppergoup list - Cleanshooter Custom Shopper Visibility
             if (!isset($product->shoppergroups)) {
                 $product->shoppergroups = 0;
             }
             $this->shoppergroupList = ShopFunctions::renderShopperGroupList($product->shoppergroups);
             // Load the product price
             if (!class_exists('calculationHelper')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
             }
             //Do we need the children? If there is a C customfield, we dont want them
             $isCustomVariant = false;
             foreach ($product->customfields as $custom) {
                 if ($custom->field_type == 'C' and $custom->tsmart_product_id == $tsmart_product_id) {
                     $isCustomVariant = true;
                     break;
                 }
             }
             if (!class_exists('tsmartModelConfig')) {
                 require VMPATH_ADMIN . '/models/config.php';
             }
             $productLayouts = tsmartModelConfig::getLayoutList('productdetails');
             $this->productLayouts = $productLayouts;
             // Load Images
             $model->addImages($product);
             if (!class_exists('VmTemplate')) {
                 require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
             }
             $vmtemplate = VmTemplate::loadVmTemplateStyle();
             $this->imagePath = shopFunctions::getAvailabilityIconUrl($vmtemplate);
             // Load the vendors
             $vendor_model = tmsModel::getModel('vendor');
             $lists['vendors'] = '';
             if ($this->showVendors()) {
                 $lists['vendors'] = Shopfunctions::renderVendorList($product->tsmart_vendor_id);
             }
             // Load the currencies
             $currency_model = tmsModel::getModel('currency');
             $vendor_model->setId(vmAccess::isSuperVendor());
             $this->vendor = $vendor_model->getVendor();
             $currency = $currency_model->getItemList();
             $this->vendor_currency_symb = $currency->currency_symbol;
             $lists['manufacturers'] = shopFunctions::renderManufacturerList($product->tsmart_manufacturer_id, true);
             if (!empty($product->product_weight_uom)) {
                 $product_weight_uom = $product->product_weight_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_weight_uom = $product_parent->product_weight_uom;
                 } else {
                     $product_weight_uom = tsmConfig::get('weight_unit_default');
                 }
             }
             if (!empty($product->product_lwh_uom)) {
                 $product_lwh_uom = $product->product_lwh_uom;
             } else {
                 if (!empty($product_parent)) {
                     $product_lwh_uom = $product_parent->product_lwh_uom;
                 } else {
                     $product_lwh_uom = tsmConfig::get('lwh_unit_default');
                 }
             }
             if (!empty($product->product_unit)) {
                 $product_unit = $product->product_unit;
             } else {
                 if (!empty($product_parent)) {
                     $product_unit = $product_parent->product_unit;
                 } else {
                     $product_unit = tsmConfig::get('product_unit_default', 'KG');
                 }
             }
             $lists['product_weight_uom'] = ShopFunctions::renderWeightUnitList('product_weight_uom', $product_weight_uom);
             $lists['product_iso_uom'] = ShopFunctions::renderUnitIsoList('product_unit', $product_unit);
             $lists['product_lwh_uom'] = ShopFunctions::renderLWHUnitList('product_lwh_uom', $product_lwh_uom);
             if (empty($product->product_available_date)) {
                 $product->product_available_date = date("Y-m-d");
             }
             $waitinglistmodel = tmsModel::getModel('waitinglist');
             /* Load waiting list */
             if ($product->tsmart_product_id) {
                 //$waitinglist = $this->get('waitingusers', 'waitinglist');
                 $waitinglist = $waitinglistmodel->getWaitingusers($product->tsmart_product_id);
                 $this->assignRef('waitinglist', $waitinglist);
             }
             $orderstatusModel = tmsModel::getModel('orderstatus');
             $lists['OrderStatus'] = $orderstatusModel->renderOSList(array(), 'order_status', TRUE);
             // Add the tsmart_shoppergroup_ids
             $cid = JFactory::getUser()->id;
             $this->activeShoppergroups = shopfunctions::renderGuiList($cid, 'shoppergroups', 'shopper_group_name', 'category', 'vmuser_shoppergroups', 'tsmart_user_id');
             if (!empty($this->activeShoppergroups)) {
                 $shoppergroupModel = tmsModel::getModel('shoppergroup');
                 $this->activeShoppergroups = tsmText::_($shoppergroupModel->getDefault(0)->shopper_group_name);
             }
             // Load protocustom lists
             $customModel = tmsModel::getModel('custom');
             $this->fieldTypes = tsmartModelCustom::getCustomTypes();
             $customsList = $customModel->getCustomsList();
             $attribs = 'style= "width: 300px;"';
             $customlist = JHtml::_('select.genericlist', $customsList, 'customlist', $attribs, 'value', 'text', null, false, true);
             $this->assignRef('customsList', $customlist);
             if ($product->product_parent_id > 0) {
                 // Set up labels
                 $info_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_INFO_LBL');
                 $status_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_STATUS_LBL');
                 $dim_weight_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_DIM_WEIGHT_LBL');
                 $images_label = tsmText::_('com_tsmart_PRODUCT_FORM_ITEM_IMAGES_LBL');
                 $delete_message = tsmText::_('com_tsmart_PRODUCT_FORM_DELETE_ITEM_MSG');
             } else {
                 if ($task == 'add') {
                     $action = tsmText::_('com_tsmart_PRODUCT_FORM_NEW_PRODUCT_LBL');
                 } else {
                     $action = tsmText::_('com_tsmart_PRODUCT_FORM_UPDATE_ITEM_LBL');
                 }
                 $info_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_INFO_LBL');
                 $status_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_STATUS_LBL');
                 $dim_weight_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_DIM_WEIGHT_LBL');
                 $images_label = tsmText::_('com_tsmart_PRODUCT_FORM_PRODUCT_IMAGES_LBL');
                 $delete_message = tsmText::_('com_tsmart_PRODUCT_FORM_DELETE_PRODUCT_MSG');
             }
             //get countries
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
             $countries = tsmcountries::get_countries();
             $this->assignRef('countries', $countries);
             //end get countries
             //get cities
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmcities.php';
             $cities = tsmcities::get_cities();
             $this->assignRef('cities', $cities);
             //end get cities
             //get tour style
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourstyle.php';
             $list_tour_style = tsmtourstyle::get_list_tour_style();
             $this->assignRef('list_tour_style', $list_tour_style);
             //end get toursyle
             //get tour section
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtoursection.php';
             $list_tour_section = tsmtoursection::get_list_tour_section();
             $this->assignRef('list_tour_section', $list_tour_section);
             //end get toursyle
             //get tour physicalgrade
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmphysicalgrade.php';
             $list_physical_grade = vmphysicalgrade::get_physical_grade();
             $this->assignRef('list_physical_grade', $list_physical_grade);
             //end get physicalgrade
             //get tour_type
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmtourtype.php';
             $list_tour_type = tsmtourtype::get_list_tour_type();
             $this->assignRef('list_tour_type', $list_tour_type);
             //end get tour_type
             //get tour_type
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
             $list_tour_service_class = tsmserviceclass::get_list_tour_service_class();
             $product->list_tour_service_class_id = tsmserviceclass::get_list_service_class_ids_by_tour_id($product->tsmart_product_id);
             $this->assignRef('list_tour_service_class', $list_tour_service_class);
             //end get tour_type
             //get activities
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmactivities.php';
             $product->list_activity_id = tsmactivities::get_list_activity_id_by_tour_id($product->tsmart_product_id);
             $activities = tsmactivities::get_activities();
             $this->assignRef('activities', $activities);
             //end get activities
             //get list group size
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmgroupsize.php';
             $list_group_size = tsmGroupSize::get_list_group_size();
             $product->list_group_size_id = tsmGroupSize::get_list_group_size_ids_by_tour_id($product->tsmart_product_id);
             $this->assignRef('list_group_size', $list_group_size);
             //end get list group size
             //get list country
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmcountries.php';
             $product->list_tsmart_country_id = tsmcountries::get_list_tsmart_country_id_by_tour_id($product->tsmart_product_id);
             //end get list group size
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
             $this->list_price_type = vmprice::get_list_price_type();
             require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmproduct.php';
             $this->list_tour_method = vmproduct::get_list_tour_method();
             $this->assignRef('product', $product);
             $this->assignRef('product_parent', $product_parent);
             /* Assign label values */
             $this->assignRef('action', $action);
             $this->assignRef('info_label', $info_label);
             $this->assignRef('status_label', $status_label);
             $this->assignRef('dim_weight_label', $dim_weight_label);
             $this->assignRef('images_label', $images_label);
             $this->assignRef('delete_message', $delete_message);
             $this->assignRef('lists', $lists);
             // Toolbar
             if ($product->product_sku) {
                 $sku = ' (' . $product->product_sku . ')';
             } else {
                 $sku = "";
             }
             //if (!empty($product->canonCatLink)) $canonLink = '&tsmart_category_id=' . $product->canonCatLink; else $canonLink = '';
             if (!empty($product->tsmart_product_id)) {
                 if (!class_exists('shopFunctionsF')) {
                     require VMPATH_SITE . DS . 'helpers' . DS . 'shopfunctionsf.php';
                 }
                 $menuItemID = shopFunctionsF::getMenuItemId(JFactory::getLanguage()->getTag());
                 $canonLink = '';
                 if ($product->canonCatId) {
                     $canonLink = '&tsmart_category_id=' . $product->canonCatId;
                 }
                 $text = '<a href="' . juri::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $product->tsmart_product_id . $canonLink . '&Itemid=' . $menuItemID . '" target="_blank" >' . $product->product_name . $sku . '<span class="vm2-modallink"></span></a>';
                 if (JFactory::getApplication()->isSite()) {
                     $bar = JToolBar::getInstance('toolbar');
                     $bar->appendButton('Link', 'back', 'com_tsmart_LEAVE_TO_PRODUCT', juri::root() . 'index.php?option=com_tsmart&view=productdetails&tsmart_product_id=' . $product->tsmart_product_id . $canonLink . '&Itemid=' . $menuItemID);
                 }
             } else {
                 $text = $product->product_name . $sku;
             }
             $this->SetViewTitle('PRODUCT', $text);
             $this->addStandardEditViewCommandsNoValidate($product->tsmart_product_id);
             break;
         case 'massxref_cats':
         case 'massxref_cats_exe':
             $this->SetViewTitle('PRODUCT_MASSXREF');
             $showVendors = $this->showVendors();
             $this->assignRef('showVendors', $showVendors);
             $keyWord = '';
             $catmodel = tmsModel::getModel('category');
             $this->assignRef('catmodel', $catmodel);
             $this->addStandardDefaultViewCommandsNoValidate();
             $this->addStandardDefaultViewLists($catmodel, 'category_name');
             $session = JFactory::getSession();
             $reset = $session->get('reset_pag', false, 'vm');
             $limit = '';
             if ($reset) {
                 $limit = 0;
                 $session->set('reset_pag', false, 'vm');
             }
             $this->categories = $catmodel->getCategoryTree(0, 0, false, $this->lists['search'], $limit);
             $catpagination = $catmodel->getPagination();
             $this->assignRef('catpagination', $catpagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_cats_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_CAT_EXE'), false);
             break;
         case 'massxref_sgrps':
         case 'massxref_sgrps_exe':
             $sgrpmodel = tmsModel::getModel('shoppergroup');
             $this->addStandardDefaultViewLists($sgrpmodel);
             $shoppergroups = $sgrpmodel->getShopperGroups(false, true);
             $this->assignRef('shoppergroups', $shoppergroups);
             $sgrppagination = $sgrpmodel->getPagination();
             $this->assignRef('sgrppagination', $sgrppagination);
             $this->setLayout('massxref');
             JToolBarHelper::custom('massxref_sgrps_exe', 'new', 'new', tsmText::_('com_tsmart_PRODUCT_XREF_SGRPS_EXE'), false);
             break;
         default:
             if ($product_parent_id = vRequest::getInt('product_parent_id', false)) {
                 $product_parent = $model->getProductSingle($product_parent_id, false);
                 if ($product_parent) {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $link_to_parent = JHtml::_('link', JRoute::_('index.php?view=product&task=edit&tsmart_product_id=' . $product_parent->tsmart_product_id . '&option=com_tsmart'), $product_parent->product_name, array('title' => tsmText::_('com_tsmart_EDIT_PARENT') . ' ' . $product_parent->product_name));
                     $msg = tsmText::_('com_tsmart_PRODUCT_OF') . " " . $link_to_parent;
                 } else {
                     $title = 'PRODUCT_CHILDREN_LIST';
                     $msg = 'Parent with product_parent_id ' . $product_parent_id . ' not found';
                 }
             } else {
                 $title = 'PRODUCT';
                 $msg = "";
             }
             $this->SetViewTitle($title, $msg);
             $this->addStandardDefaultViewLists($model, 'created_on');
             if ($cI = vRequest::getInt('tsmart_category_id', false)) {
                 $app = JFactory::getApplication();
                 //$old_state = $app->getUserState('tsmart_category_id');
                 $old_state = $app->getUserState('tsmart_category_id');
                 if (empty($old_state) or $old_state != $cI) {
                     vRequest::setVar('com_tsmart.product.filter_order', 'pc.ordering');
                     $model->filter_order = 'pc.ordering';
                     $old_state = $app->setUserState('tsmart_category_id', $cI);
                 }
             }
             //Get the list of products
             $productlist = $model->getItemList();
             //The pagination must now always set AFTER the model load the listing
             $this->pagination = $model->getPagination();
             //Get the category tree
             $categoryId = $model->tsmart_category_id;
             //OSP switched to filter in model, was vRequest::getInt('tsmart_category_id');
             $category_tree = ShopFunctions::categoryListTree(array($categoryId));
             $this->assignRef('category_tree', $category_tree);
             //load service class
             //Load the product price
             if (!class_exists('calculationHelper')) {
                 require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
             }
             $vendor_model = tmsModel::getModel('vendor');
             $productreviews = tmsModel::getModel('ratings');
             $this->mfTable = $model->getTable('manufacturers');
             $this->catTable = $model->getTable('categories');
             $this->lists['vendors'] = '';
             if ($this->showVendors()) {
                 $this->lists['vendors'] = Shopfunctions::renderVendorList(vmAccess::getVendorId());
             }
             foreach ($productlist as $tsmart_product_id => $product) {
                 $product->mediaitems = count($product->tsmart_media_id);
                 $product->reviews = $productreviews->countReviewsForProduct($product->tsmart_product_id);
                 $vendor_model->setId($product->tsmart_vendor_id);
                 $vendor = $vendor_model->getVendor();
                 $currencyDisplay = CurrencyDisplay::getInstance($vendor->vendor_currency, $vendor->tsmart_vendor_id);
                 if (!empty($product->allPrices[$product->selectedPrice]['product_price']) && !empty($product->allPrices[$product->selectedPrice]['product_currency'])) {
                     $product->product_price_display = $currencyDisplay->priceDisplay($product->allPrices[$product->selectedPrice]['product_price'], (int) $product->allPrices[$product->selectedPrice]['product_currency'], 1, true);
                 } else {
                     if (!empty($product->allPrices) and count($product->allPrices) > 1) {
                         $product->product_price_display = tsmText::_('com_tsmart_MULTIPLE_PRICES');
                     } else {
                         $product->product_price_display = tsmText::_('com_tsmart_NO_PRICE_SET');
                     }
                 }
                 // Write the first 5 categories in the list
                 $product->categoriesList = '';
                 if (!empty($product->categories[0])) {
                     $product->categoriesList = shopfunctions::renderGuiList($product->categories, 'categories', 'category_name', 'category');
                 }
                 // Write the first 5 manufacturers in the list
                 $product->manuList = '';
                 if (!empty($product->tsmart_manufacturer_id[0])) {
                     $product->manuList = shopfunctions::renderGuiList($product->tsmart_manufacturer_id, 'manufacturers', 'mf_name', 'manufacturer');
                 }
             }
             $mf_model = tmsModel::getModel('manufacturer');
             $manufacturers = $mf_model->getManufacturerDropdown();
             $this->assignRef('manufacturers', $manufacturers);
             /* add Search filter in lists*/
             /* Search type */
             $options = array('' => tsmText::_('com_tsmart_LIST_EMPTY_OPTION'), 'parent' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_PARENT_PRODUCT'), 'product' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRODUCT'), 'price' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_PRICE'), 'withoutprice' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_TYPE_WITHOUTPRICE'));
             $this->lists['search_type'] = VmHTML::selectList('search_type', vRequest::getVar('search_type'), $options);
             /* Search order */
             $options = array('bf' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_BEFORE'), 'af' => tsmText::_('com_tsmart_PRODUCT_LIST_SEARCH_BY_DATE_AFTER'));
             $this->lists['search_order'] = VmHTML::selectList('search_order', vRequest::getVar('search_order'), $options);
             // Toolbar
             /*if (vmAccess::manager('product.edit')) {
                   JToolBarHelper::custom('massxref_cats', 'new', 'new', vmText::_('com_tsmart_PRODUCT_XREF_CAT'), true);
                   JToolBarHelper::custom('massxref_sgrps', 'new', 'new', vmText::_('com_tsmart_PRODUCT_XREF_SGRPS'), true);
               }
               if (vmAccess::manager('product.create')) {
                   JToolBarHelper::custom('createchild', 'new', 'new', vmText::_('com_tsmart_PRODUCT_CHILD'), true);
                   JToolBarHelper::custom('cloneproduct', 'copy', 'copy', vmText::_('com_tsmart_PRODUCT_CLONE'), true);
               }*/
             // JToolBarHelper::custom('addrating', 'default', '', vmText::_('com_tsmart_ADD_RATING'), true);
             $view = vRequest::getCmd('view', vRequest::getCmd('controller', 'tsmart'));
             JToolBarHelper::divider();
             if (vmAccess::manager($view . '.edit.state')) {
                 JToolBarHelper::publishList();
                 JToolBarHelper::unpublishList();
             }
             if (vmAccess::manager($view . '.delete')) {
                 JToolBarHelper::spacer('10');
                 JToolBarHelper::deleteList();
             }
             $this->assignRef('productlist', $productlist);
             $this->assignRef('tsmart_category_id', $categoryId);
             $this->assignRef('model', $model);
             break;
     }
     parent::display($tpl);
 }
コード例 #5
0
ファイル: html.php プロジェクト: cuongnd/etravelservice
    public static function select_service_class($list_service_class = array(), $name, $default = '0', $attrib = "onchange='submit();'", $zero = true, $chosenDropDowns = true, $tranlsate = true)
    {
        $doc = JFactory::getDocument();
        $doc->addScript(JUri::root() . '/media/system/js/jquery.utility.js');
        $doc->addScript(JUri::root() . '/media/system/js/select2-master/dist/js/select2.full.js');
        $doc->addStyleSheet(JUri::root() . '/media/system/js/select2-master/dist/css/select2.css');
        $doc->addScript(JUri::root() . 'administrator/components/com_tsmart/assets/js/controller/select_service_class/html_select_language.js');
        $doc->addLessStyleSheet(JUri::root() . '/administrator/components/com_tsmart/assets/js/controller/select_service_class/html_select_service_class.less');
        $input = JFactory::getApplication()->input;
        if (empty($list_service_class)) {
            require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
            $list_service_class = tsmserviceclass::get_list_service_class();
        }
        $id_element = 'html_select_service_class_' . $name;
        ob_start();
        ?>
        <script type="text/javascript">
            jQuery(document).ready(function ($) {
                $('#<?php 
        echo $id_element;
        ?>
').html_select_service_class({
                    list_tour:<?php 
        echo json_encode($list_service_class);
        ?>
,
                    select_name: "<?php 
        echo $name;
        ?>
",
                    tsmart_language_id:<?php 
        echo $default ? $default : 0;
        ?>
                });
            });
        </script>
        <?php 
        $script_content = ob_get_clean();
        $script_content = TSMUtility::remove_string_javascript($script_content);
        $doc->addScriptDeclaration($script_content);
        ob_start();
        ?>
        <div id="<?php 
        echo $id_element;
        ?>
">
            <select disable_chosen="true" id="<?php 
        echo $name;
        ?>
" name="<?php 
        echo $name;
        ?>
">
                <option value=""><?php 
        echo JText::_('please select Service class');
        ?>
</option>
                <?php 
        foreach ($list_service_class as $service_class) {
            ?>
                    <option <?php 
            echo $service_class->tsmart_service_class_id == $default ? ' selected ' : '';
            ?>
                        value="<?php 
            echo $service_class->tsmart_service_class_id;
            ?>
"><?php 
            echo $service_class->service_class_name;
            ?>
</option>
                <?php 
        }
        ?>
            </select>
        </div>
        <?php 
        $html = ob_get_clean();
        return $html;
    }
コード例 #6
0
ファイル: default.php プロジェクト: cuongnd/etravelservice
?>
                </tr>
                </thead>
                <?php 
$k = 0;
for ($i = 0, $n = count($this->items); $i < $n; $i++) {
    $row = $this->items[$i];
    $checked = JHtml::_('grid.id', $i, $row->tsmart_tour_type_id);
    $published = $this->gridPublished($row, $i);
    $editlink = JROUTE::_('index.php?option=com_tsmart&view=accommodation&task=' . ($row->tsmart_accommodation_id ? 'add_new_item' : 'edit_item') . '&cid[]=' . $row->tsmart_accommodation_id . '&tsmart_product_id=' . $row->tsmart_product_id . '&tsmart_itinerary_id=' . $row->tsmart_itinerary_id);
    $edit = $this->gridEdit($row, $i, 'tsmart_tour_type_id', $editlink);
    $delete = $this->grid_delete_in_line($row, $i, 'tsmart_tour_type_id');
    $tsmart_accommodation_id = $row->tsmart_accommodation_id;
    $tsmart_itinerary_id = $row->tsmart_itinerary_id;
    require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
    $list_service_class = tsmserviceclass::get_list_service_class_by_tour_id($this->tsmart_product_id);
    require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmhotel.php';
    require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/vmaccommodation.php';
    $list_hotel_selected_by_service_class_id_and_itinerary_id = tsmaccommodation::get_list_hotel_selected_by_service_class_id_and_itinerary_id_accommodation_id($list_service_class, $tsmart_itinerary_id, $tsmart_accommodation_id);
    $rowspan = 0;
    foreach ($list_hotel_selected_by_service_class_id_and_itinerary_id as $service_class) {
        $rowspan += count($service_class->list_hotel) + 1;
    }
    $rowspan = $rowspan + 1;
    ?>

                    <tr class="row<?php 
    echo $k;
    ?>
">
                        <td class="admin-checkbox" rowspan="<?php 
コード例 #7
0
ファイル: view.html.php プロジェクト: cuongnd/etravelservice
 function display($tpl = null)
 {
     // Load the helper(s)
     if (!class_exists('VmHTML')) {
         require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
     }
     $model_promotion_price = tmsModel::getModel();
     $app = JFactory::getApplication();
     $input = $app->input;
     $config = JFactory::getConfig();
     require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmserviceclass.php';
     $this->list_service_class = tsmserviceclass::get_list_service_class();
     $layoutName = vRequest::getCmd('layout', 'default');
     if ($layoutName == 'edit') {
         $tsmart_product_id = $input->get('tsmart_product_id', 0, 'int');
         $this->tsmart_product_id = $tsmart_product_id;
         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);
         $cid = vRequest::getInt('cid');
         $model_product = tmsModel::getModel('product');
         $this->product = $model_product->getProduct($this->tsmart_product_id, false, false, false);
         if ($this->product->tour_methor == 'tour_group') {
             $this->list_tour_price_by_tour_price_id = vmprice::get_list_tour_price_by_tour_price_id($cid[0]);
         } else {
             $this->tour_private_price_by_tour_price_id = vmprice::get_list_tour_price_by_tour_price_id_for_price($cid[0]);
         }
         $task = vRequest::getCmd('task', 'add');
         if ($task != 'add' && !empty($cid) && !empty($cid[0])) {
             $cid = (int) $cid[0];
         } else {
             $cid = 0;
         }
         $model_promotion_price->setId($cid);
         $this->price = $model_promotion_price->get_promotion_price();
         $model_product = tmsModel::getModel('product');
         $this->list_tour = $model_product->getProductListing();
         $this->SetViewTitle('', $this->promotion->promotion_name);
         $this->addStandardEditViewCommands();
     } else {
         require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/tsmprice.php';
         $tsmart_product_id = $input->get('tsmart_product_id', 0, 'int');
         $this->tsmart_product_id = $tsmart_product_id;
         $model_product = tmsModel::getModel('product');
         $this->list_tour = $model_product->getItems();
         $this->product = $model_product->getItem($this->tsmart_product_id);
         $tsmart_price_id = $input->get('tsmart_price_id', 0, 'int');
         $model_promotion_price->setId($tsmart_price_id);
         $this->price = $model_promotion_price->get_promotion_price();
         //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($tsmart_product_id);
         $this->SetViewTitle();
         $this->addStandardDefaultViewLists($model_promotion_price, 0, 'ASC');
         $this->addStandardDefaultViewCommandspromotion();
         $model_tourclass = tmsModel::getModel('tourclass');
         $this->list_service_class_by_tour_id = $model_tourclass->getItems();
         $this->promotion_prices = $model_promotion_price->get_list_promotion_price($tsmart_product_id);
         //$this->prices=JArrayHelper::pivot($this->prices,'service_class_name');
     }
     parent::display($tpl);
 }