예제 #1
0
 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);
 }
예제 #2
0
 * @package     External Login
 * @subpackage  Component
 * @copyright   Copyright (C) 2008-2014 Christophe Demko, Ioannis Barounis, Alexandre Gandois. All rights reserved.
 * @author      Christophe Demko
 * @author      Ioannis Barounis
 * @author      Alexandre Gandois
 * @link        http://www.chdemko.com
 * @license     http://www.gnu.org/licenses/gpl-2.0.html
 */
// No direct access to this file
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$user = JFactory::getUser();
$ordering = $this->state->get('list.ordering') == 'a.ordering';
$plugins = JArrayHelper::pivot(ExternalloginHelper::getPlugins(), 'value');
if (!count($this->items)) {
    ?>
	<tr class="row<?php 
    echo $i % 2;
    ?>
">
		<td colspan="6" class="center">
			<?php 
    echo JText::_('COM_EXTERNALLOGIN_NO_RECORDS');
    ?>
		</td>
	</tr>
	<?php 
} else {
    foreach ($this->items as $i => $item) {
예제 #3
0
 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;
 }
	/**
	 * Tests the JArrayHelper::pivot method.
	 *
	 * @param   array   $source    The source array.
	 * @param   string  $key       Where the elements of the source array are objects or arrays, the key to pivot on.
	 * @param   array   $expected  The expected result.
	 *
	 * @return  void
	 *
	 * @dataProvider getTestPivotData
	 * @covers  JArrayHelper::pivot
	 * @since   11.3
	 */
	public function testPivot($source, $key, $expected)
	{
		$this->assertThat(
			JArrayHelper::pivot($source, $key),
			$this->equalTo($expected)
		);
	}
 /**
  * @since         1.1.0
  * @deprecated    1.2.0
  * @use           FieldsandfiltersFieldsSite::getFieldsLayoutsByItemID()
  **/
 public static function getFieldsByItemIDWithTemplate($option = null, $itemID = null, $fieldsID = null, $getAllextensions = true, $params = false, $ordering = 'ordering')
 {
     $object = self::getFieldsByItemID($option, $itemID, $fieldsID, $getAllextensions);
     $templateFields = new JObject();
     $fields = $object->fields->getProperties();
     if (empty($fields)) {
         return $templateFields;
     }
     $fields = new JObject(JArrayHelper::pivot($fields, 'field_type'));
     JPluginHelper::importPlugin('fieldsandfilterstypes');
     FieldsandfiltersFactory::getDispatcher()->trigger('getFieldsandfiltersFieldsHTML', array($templateFields, $fields, $object->element, $params, $ordering));
     return $templateFields;
 }
 /**
  * @since       1.1.0
  */
 protected function _onFieldsandfiltersContent($location, &$row, &$params, $page, $context)
 {
     if (!($extensionContent = FieldsandfiltersFactory::getExtensions()->getExtensionsByName($this->_name)->get($this->_name))) {
         return;
     }
     // Load Fields Helper
     $fieldsHelper = FieldsandfiltersFactory::getFields();
     $extensionsParams = new JObject(array('module.off' => true, 'plugin.value' => $this->params->get('use_static_fields')));
     // Load Extensions Helper
     if ($isStaticFields = FieldsandfiltersExtensionsHelper::getParams('use_static_fields', $extensionsParams, true)) {
         // Load Plugin Types Helper
         $staticMode = FieldsandfiltersModes::getMode(FieldsandfiltersModes::MODE_STATIC);
         if ($fieldsStatic = $fieldsHelper->getFieldsByModeIDPivot('location', $extensionContent->content_type_id, $staticMode, 1, 2)->get($location)) {
             $fieldsStatic = is_array($fieldsStatic) ? $fieldsStatic : array($fieldsStatic);
         } else {
             $isStaticFields = false;
         }
     }
     // Load elements Helper
     if (!($element = FieldsandfiltersFactory::getElements()->getElementsByItemIDPivot('item_id', $extensionContent->content_type_id, $row->id, $row->state, 3)->get($row->id)) && !$isStaticFields) {
         return;
     }
     if ($element) {
         $fieldsID = array_merge(array_keys($element->connections->getProperties(true)), array_keys($element->data->getProperties(true)));
         if (empty($fieldsID) && !$isStaticFields) {
             return;
         }
         if (!($fields = $fieldsHelper->getFieldsByIDPivot('location', $extensionContent->content_type_id, $fieldsID, 1, 1)->get($location)) && !$isStaticFields) {
             return;
         }
     } else {
         $fields = false;
     }
     if ($fields && $isStaticFields) {
         $fields = is_array($fields) ? $fields : array($fields);
         $fields = array_merge($fields, $fieldsStatic);
     } else {
         if ($fields) {
             $fields = is_array($fields) ? $fields : array($fields);
         } else {
             if ($isStaticFields) {
                 $fields = $fieldsStatic;
             }
         }
     }
     $fields = new JObject(JArrayHelper::pivot((array) $fields, 'type'));
     $layoutFields = new JObject();
     JPluginHelper::importPlugin('fieldsandfilterstypes');
     // Trigger the onFieldsandfiltersPrepareFormField event.
     JFactory::getApplication()->triggerEvent('getFieldsandfiltersFieldsHTML', array($layoutFields, $fields, $element, $context));
     $layoutFields = $layoutFields->getProperties(true);
     if (empty($layoutFields)) {
         return;
     }
     ksort($layoutFields);
     return implode("\n", $layoutFields);
 }
예제 #7
0
 /**
  * We want to allow html so we need to overwrite some request data
  *
  * @author Max Milbers
  */
 public function ajax_check_database()
 {
     $db = JFactory::getDbo();
     $prefix = 'me1u8_tsmart';
     $app = JFactory::getApplication();
     $input = $app->input;
     $json_database_path_file = 'administrator/components/com_tsmart/views/utility/tmpl/json_database/json_database.txt';
     $json_database = JFile::read(JPATH_ROOT . '/' . $json_database_path_file);
     $json_database = json_decode($json_database);
     $list_table = array();
     foreach ($json_database as $table => $rows) {
         $list_table[] = $table;
     }
     $list_table = self::synchronous_table($list_table, $prefix);
     $list_table_exists = $db->setQuery("SHOW TABLES")->loadColumn();
     foreach ($json_database as $table => $rows) {
         foreach ($rows as $key => $row) {
             $size = $row->size;
             $sql = $row->sql;
             switch ($sql) {
                 case 'INTEGER':
                 case 'FLOAT':
                     $sql = 'int';
                     $size = $size ? $size : 11;
                     $rows[$key]->size = $size;
                     $rows[$key]->sql = $sql;
                     break;
                 case 'MEDIUMTEXT':
                     $rows[$key]->size = $size;
                     break;
                 case 'VARCHAR':
                     $size = $size ? $size : 200;
                     $rows[$key]->size = $size;
                     break;
             }
         }
         $list_row = JArrayHelper::pivot($rows, 'row_name');
         $list_row = array_change_key_case($list_row, CASE_LOWER);
         if (in_array($table, $list_table_exists)) {
             $sql = "SHOW INDEX FROM `{$table}`";
             $list_index = $db->setQuery($sql)->loadObjectList();
             $exists_primary_key = false;
             $exists_index_key = false;
             $list_primary_key = array();
             foreach ($list_index as $index) {
                 if ($index->Key_name == 'PRIMARY') {
                     $exists_primary_key = true;
                     $list_primary_key[] = $index->Column_name;
                 }
                 if ($index->Cardinality == 18) {
                     $exists_index_key = true;
                 }
             }
             if ($exists_primary_key && !$exists_index_key) {
                 $first_primary_key = reset($list_primary_key);
                 $sql = "ALTER TABLE `{$table}` ADD INDEX(`{$first_primary_key}`)";
                 $ok = $db->setQuery($sql)->execute();
                 if (!$ok) {
                     throw new Exception($db->getErrorMsg(), 505);
                 }
             }
             if ($exists_primary_key) {
                 if (count($list_primary_key) > 1) {
                 }
                 $sql = "ALTER TABLE `{$table}` DROP PRIMARY KEY";
                 $ok = $db->setQuery($sql)->execute();
                 if (!$ok) {
                     throw new Exception($db->getErrorMsg(), 505);
                 }
             }
             $fields = $db->getTableColumns($table);
             $fields = array_change_key_case($fields, CASE_LOWER);
             foreach ($list_row as $field => $item) {
                 if ($fields[$field]) {
                     $current_type_field = $fields[$field];
                     $item_row = $item;
                     $ai = $item_row->ai;
                     $nll = $item_row->nll;
                     $nll = $nll ? ' NULL ' : ' NOT NULL ';
                     if ($ai) {
                         $nll = ' NOT NULL ';
                     }
                     $size = $item_row->size;
                     $str_sql = $item_row->sql;
                     $size = $size ? "({$size})" : '';
                     $sql = "ALTER TABLE `{$table}` CHANGE  `{$field}` `{$field}` {$str_sql}{$size} {$nll} ";
                     $db->redirectPage(false);
                     $result = $db->setQuery($sql)->execute();
                     if (!$result) {
                         //echo $db->getErrorMsg();
                         //die;
                         //vmError($db->getErrorMsg());
                     }
                     $is_primary = $item_row->is_primary;
                     if ($ai & $is_primary) {
                         $sql = "SELECT `{$field}`, COUNT(*) AS  total FROM `{$table}` GROUP BY `{$field}` HAVING total > 1;";
                         $list_item_having = $db->setQuery($sql)->loadObjectList();
                         if (!count($list_item_having)) {
                             $sql = "ALTER TABLE `{$table}` ADD PRIMARY KEY(`{$field}`);";
                             $result = $db->setQuery($sql)->execute();
                             if (!$result) {
                                 throw new Exception($db->getErrorMsg(), 505);
                             }
                             $sql = "ALTER TABLE `{$table}` CHANGE `{$field}` `{$field}` {$str_sql}{$size} NOT NULL AUTO_INCREMENT;";
                             $result = $db->setQuery($sql)->execute();
                             if (!$result) {
                                 throw new Exception($db->getErrorMsg(), 505);
                             }
                         }
                     } elseif (!$ai & $is_primary) {
                         $sql = "SELECT `{$field}`, COUNT(*) AS  total FROM `{$table}` GROUP BY `{$field}` HAVING total > 1;";
                         $list_item_having = $db->setQuery($sql)->loadObjectList();
                         if (!count($list_item_having)) {
                             $sql = "ALTER TABLE `{$table}` ADD PRIMARY KEY(`{$field}`);";
                             $result = $db->setQuery($sql)->execute();
                             if (!$result) {
                                 throw new Exception($db->getErrorMsg(), 505);
                             }
                         }
                     }
                 } else {
                     $item_row = $item;
                     $ai = $item_row->ai;
                     $nll = $item_row->nll;
                     $nll = $nll ? ' NULL ' : ' NOT NULL ';
                     $size = $item_row->size;
                     $str_sql = $item_row->sql;
                     $size = $size ? "({$size})" : '';
                     $sql = "ALTER TABLE `{$table}` ADD  `{$field}` {$str_sql}{$size} {$nll}";
                     $result = $db->setQuery($sql)->execute();
                     if (!$result) {
                         throw new Exception($db->getErrorMsg(), 505);
                     }
                     $is_primary = $item_row->is_primary;
                     if ($ai & $is_primary) {
                         $db->redirectPage(false);
                         $sql = "SET @count = 0;UPDATE `{$table}` SET `{$table}`.`{$field}` = @count:= @count + 1;";
                         $result = $db->setQuery($sql)->execute();
                         if (!$result) {
                             //throw new Exception($db->getErrorMsg(), 505);
                         }
                         $sql = "ALTER TABLE `{$table}` ADD PRIMARY KEY(`{$field}`);";
                         $result = $db->setQuery($sql)->execute();
                         if (!$result) {
                             throw new Exception($db->getErrorMsg(), 505);
                         }
                         $sql = "ALTER TABLE `{$table}` CHANGE `{$field}` `{$field}` {$str_sql}{$size} NOT NULL AUTO_INCREMENT;";
                         $result = $db->setQuery($sql)->execute();
                         if (!$result) {
                             throw new Exception($db->getErrorMsg(), 505);
                         }
                     } elseif (!$ai & $is_primary) {
                         $db->redirectPage(false);
                         $sql = "SET @count = 0;UPDATE `{$table}` SET `{$table}`.`{$field}` = @count:= @count + 1;";
                         $result = $db->setQuery($sql)->execute();
                         if (!$result) {
                             //throw new Exception($db->getErrorMsg(), 505);
                         }
                     }
                 }
             }
             foreach ($fields as $field => $type) {
                 if (!$list_row[$field]) {
                     $sql = " ALTER TABLE `{$table}` DROP `{$field}`";
                     $result = $db->setQuery($sql)->execute();
                     if (!$result) {
                         throw new Exception($db->getErrorMsg(), 505);
                     }
                 }
             }
             $i = 0;
             $prev_item = null;
             foreach ($list_row as $field => $item) {
                 $size = $item->size;
                 $sql = $item_row->sql;
                 $size = $size ? "({$size})" : '';
                 if ($i == 0) {
                     $sql = "ALTER TABLE {$table} CHANGE  `{$field}` `{$field}` {$sql}{$size}  FIRST";
                 } else {
                     $prev_row = $prev_item->row_name;
                     $sql = "ALTER TABLE {$table} CHANGE  `{$field}` `{$field}` {$sql}{$size} AFTER `{$prev_row}`";
                 }
                 $prev_item = $item;
                 $db->redirectPage(false);
                 $result = $db->setQuery($sql)->execute();
                 if (!$result) {
                     //throw new Exception($db->getErrorMsg(), 505);
                 }
                 $i++;
             }
         } else {
             $sql = array();
             $sql[] = "CREATE TABLE {$table}(";
             $sql1 = array();
             $list_primary_key = array();
             foreach ($rows as $key => $row) {
                 $ai = $row->ai;
                 $ai = $ai ? ' AUTO_INCREMENT ' : '';
                 $nll = $row->nll;
                 $nll = $nll ? ' NULL ' : ' NOT NULL ';
                 if ($ai) {
                     $nll = ' NOT NULL ';
                 }
                 $size = $row->size;
                 $str_sql = $row->sql;
                 $size = $size ? "({$size})" : '';
                 $is_primary = $row->is_primary;
                 if ($is_primary) {
                     $list_primary_key[] = "`{$row->row_name}`";
                 }
                 $sql1[] = "`{$row->row_name}` {$str_sql}{$size} {$nll} {$ai}";
             }
             if (!count($list_primary_key)) {
                 $first_row = reset($rows)->row_name;
                 $list_primary_key[] = "`{$first_row}`";
             }
             $list_primary_key = implode(",", $list_primary_key);
             $sql1[] = "PRIMARY KEY ({$list_primary_key})";
             $sql1 = implode(',', $sql1);
             $sql[] = $sql1;
             $sql[] = ")";
             $sql = implode(" ", $sql);
             $result = $db->setQuery($sql)->execute();
             if (!$result) {
                 throw new Exception($db->getErrorMsg(), 505);
             }
             $sql = "ALTER TABLE `{$table}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
             $result = $db->setQuery($sql)->execute();
             if (!$result) {
                 throw new Exception($db->getErrorMsg(), 505);
             }
         }
     }
     echo 1;
     die;
 }
예제 #8
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;
 }
예제 #9
0
 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);
 }