| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2c.hellogtx.com/application/modules/detail/controllers/ |
Upload File : |
<?php
class Detail_IndexController extends Catabatic_ValidateCustomer {
public $baseUrl = '';
public $AgencyId;
protected $objMdl;
protected $objHelperGeneral;
protected $tablename;
public $_session;
const USER_NAMESPACE = 'PSESS';
public $_storage;
public $_storage2;
public $packageSession;
public $packageSearchData;
public $packageTypeStatic = 2;
public $callusnumber;
public $siteName;
public $gtxBtoBsite;
public $AgentSysId;
public $LeadURL;
public $modulename;
public $stylecss;
public function init() {
$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
$BootStrap = $aConfig['bootstrap'];
$this->view->stylecss = $this->stylecss = $BootStrap['stylecss'];
$this->siteName = $BootStrap['siteName'];
$this->view->IsShowPricePlus = $this->IsShowPricePlus = $BootStrap['IsShowPricePlus'];
$this->baseUrl = $BootStrap['siteUrl'];
$this->gtxBtoBsite = $BootStrap['gtxBtoBsite'];
$this->view->gtxagencysysid = $this->AgencyId = $BootStrap['gtxagencysysid'];
$this->AgentSysId = $BootStrap['gtxagentsysid'];
$this->LeadURL = $BootStrap['siteUrl'] . 'gtxwebservices/index/query';
$object = Zend_Controller_Front::getInstance();
// -------
$this->modulename = $object->getRequest()->getModuleName();
define('CONST_PACKAGE_TRAVELER_MAX_ROOM', $BootStrap['CONST_PACKAGE_TRAVELER_MAX_ROOM']);
define('CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM', $BootStrap['CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM']);
define('CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM', $BootStrap['CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM']);
define('CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM', $BootStrap['CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM']);
// -------
$this->callusnumber = $BootStrap['callusnumber'];
$this->tollfreenumber = $BootStrap['tollfreenumber'];
$this->adminEmail = $BootStrap['adminEmail'];
$this->objMdl = new Admin_Model_CRUD();
$this->tablename = "tb_tbb2c_packages_master";
$this->objHelperGeneral = $this->_helper->General;
$this->_storage = new Zend_Session_Namespace(self::USER_NAMESPACE);
$this->_packagesearchdata = new Zend_Session_Namespace('Packagesearchdata');
// echo"<pre>";print_r($this->_storage->packageSession);die('dd');
//error_reporting(E_ALL);
}
public function indexAction() {
// error_reporting(E_ALL);
$params = $this->getRequest()->getParams();
// $this->_storage->packageSession = array(); //package-customize kar di
// echo"<pre>";print_r($this->_storage->packageSession);die('dd');
// $this->packagesearchData = $params;
// echo"<pre>";print_r($_SESSION);die('dd');
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->modulename = $this->modulename;
$paramsss = explode('-', trim($params['name'], '.html'));
krsort($paramsss); // reverse sort the array to find all url param ids for fetching recor
$listkeys = ['mp', 'tourtype', 'gtxid', 'catid', 'pkgid', 'destname']; // array of parameters
//echo"<pre>";print_r($params);die();
$i = 0;
foreach ($paramsss as $value) {
if ($i == count($listkeys))
break;
$param[$listkeys[$i]] = $value;
$i++;
}
$fixDestinations = isset($param['fixDestinations']) ? (int) $param['fixDestinations'] : '';
$catId = isset($param['catid']) ? (int) $param['catid'] : '';
$gtxId = isset($param['gtxid']) ? (int) $param['gtxid'] : '';
$packageId = isset($param['pkgid']) ? (int) $param['pkgid'] : '';
$tourtype = isset($param['tourtype']) ? (int) $param['tourtype'] : '';
$mealplantype = (int) $param['mp'];
$keywords = $param['destname'];
$customize = (isset($param['customize'])) ? $param['customize'] : 0; // for customization [ 1 , 0]
$this->view->mealplantype = $mealplantype;
$model = new Detail_Model_PackageMapper();
// check package for inactive case
$checkPackaageSysID = $model->checkPackaageSysID($gtxId);
if (!empty($checkPackaageSysID)) {
$packageId = $checkPackaageSysID['PkgSysId'];
}
$isModified = 0;
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2B'); // 4th optional parameter [ B2B | B2C ]
} else {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2C'); // 4th optional parameter [ B2B | B2C ]
}
if (empty($getDetail)) {
$this->_redirect($this->baseUrl);
}
if(isset($getDetail['itementries']['AgencyIdB2C']) && isset($getDetail['itementries']['AgencyIdB2B']) && ($getDetail['itementries']['AgencyIdB2C'] != $getDetail['itementries']['AgencyIdB2B'])){
$market = 'B2B';
$MarkUpOnGTXNetworkPackage = isset($getDetail['itementries']['MarkUpOnGTXNetworkPackage']) ? $getDetail['itementries']['MarkUpOnGTXNetworkPackage'] : 0;
}else{
$market = 'B2C';
$MarkUpOnGTXNetworkPackage = 0;
}
$PackageType = $getDetail['PackageType']; // get package type [ Readymade , Dynamic ]
//$PackageSubType = $getDetail['PackageSubType']; // get package Sub type
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
// used for update package and send enquiry | category | meal plan change options
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], $market, $PackageType, $detail['PackageSubType']);
$this->view->priceJsonViewFile = $priceJsonViewFile['priceArrJson'];
$this->view->hotelStandardArr = $priceJsonViewFile['hotelStandardArr'];
$detail = $this->objHelperGeneral->createArrayDetailDynamic($getDetail, ['catid' => $catId, 'gtxid' => $gtxId, 'pkgid' => $packageId, 'tourtype' => $tourtype]);
//echo"<pre>";print_r($detail);die('aa');
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
$detail['TPId'] = $getDetail['TPId']; //get tpid same for all in Dynamic package case
$detail['Destinations'] = $getDetail['Destinations']; // get package destinations
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
$detail['MPType'] = $CONST_MEAL_PLAN_ARR[$mealplantype]; // get package meal plan type
$detail['hotels_array_included_only'] = $getDetail['hotels_array_included_only']; // get hotels included in all itineraries
$detail['CategoriesArray'] = $priceJsonViewFile['priceArrJson']; // override the variable here new version is included cp,ap,map plan prices too
$priceArrJson = $detail['CategoriesArray'];
$tourTypeChar = ($tourtype == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
// $pkgprice = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype, true); // Param 4: true ( if calculate discounted price )
// $pkgpriceDiscount = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype); // Param 4: true ( if calculate discounted price )
$pkgprice = $this->objHelperGeneral->getPackagePriceV3($catId, $tourTypeChar, $priceArrJson, $mealplantype, true); // Param 4: true ( if calculate discounted price )
$pkgpriceDiscount = $this->objHelperGeneral->getPackagePriceV3($catId, $tourTypeChar, $priceArrJson, $mealplantype); // Param 4: true ( if calculate discounted price )
// echo"<pre>";print_r($pkgprice);die('dd');
$detail['PackageCategory'] = $getDetail['PackageCategory'];
$detail['Image'] = $getDetail['Image'];
$detail['DestinationsId'] = $getDetail['DestinationsId'];
$detail['isFixedDeparture'] = $getDetail['isFixedDeparture'];
$detail['IsCF'] = $getDetail['IsCF'];
$detail['fixedInventoryNew'] = $getDetail['fixedInventoryNew'];
$detail['IsfixedInventory'] = $getDetail['IsfixedInventory'];
$detail['AddonServices'] = $getDetail['AddonServices'];
$detail['exchangeCurrencyRateFlight'] = $getDetail['exchangeCurrencyRateFlight'];
$detail['Symbol'] = $getDetail['Symbol'];
$TotalPrice = (isset($detail['fixedInventoryNew'][0]['TotalPrice'])) ? (int) $detail['fixedInventoryNew'][0]['TotalPrice'] : 0;
$exchangeRate = 1;
if ($this->AgencyId == 98196 && $detail['CategoriesArray']['P'][$catId]['price'][0]['Currency'] == 93) {
$exchangeRate = $this->objHelperGeneral->currencyExchangeRate($detail['CategoriesArray']['P'][$catId]['price'][0]['Currency'], 2, 0);
$detail['CategoriesArray']['P'][$catId]['price'][0]['Currency'] = 2;
$pkgprice = (int) ($pkgprice * $exchangeRate);
$TotalPrice = (int) ($TotalPrice * $exchangeRate);
$pkgpriceDiscount = (int) ($pkgpriceDiscount * $exchangeRate);
}
$detail['CategoriesArray']['TotalPrice'] = (int) ($TotalPrice);
$detail['CategoriesArray']['NetPrice'] = (int) ($pkgprice);
$detail['CategoriesArray']['DiscountNetPrice'] = (int) $pkgpriceDiscount + (int) $TotalPrice;
$detail['CategoriesArray']['DefaultAdultCost'] = $getDetail['DefaultAdultCost'];
if ($PackageType == $this->packageTypeStatic) {
$TransfersArrayCar = $this->objHelperGeneral->getTransfersArray('car', $detail['TransfersMaster']);
$OtherServicesArray = $this->objHelperGeneral->getTransfersArray('otherservices', $detail['OtherServices']);
$customize = 1;
if ($customize) {
$sessionid = $this->objHelperGeneral->checksession((int) $packageId, $tourtype, $catId); // create the session
if (!$sessionid) {
$others = ['services' => $OtherServicesArray, 'transfers' => $TransfersArrayCar];
$this->objHelperGeneral->copysession($packageId, $tourtype, $catId, $detail['itinerariesArray'], $pkgprice, $others); // copy itinerary details to session
}
// echo"<pre>";print_r($this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries']);die('aa');
$detail['itinerariesArray'] = $this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'];
$PackageMapper = new Detail_Model_PackageMapper();
$ACCOMSYSIDArray = $ROOMSYSIDArray = $MEALSYSIDArray = $hITEMIdArray = array();
$HotelPrice = $HotelMarkup = array();
$TransferPrice = $TransferMarkup = array();
$SightPrice = $SightMarkup = array();
foreach ($detail['itinerariesArray'] as $hKey => $hVal) {
$day = $hVal['day'];
$countit = 1;
$sessionPackageSearchParams = new Zend_Session_Namespace('sessionPackageSearchParams');
$sessionPackageSearch = $sessionPackageSearchParams->params;
$checkInDate = isset($sessionPackageSearch['boarding_date']) ? $sessionPackageSearch['boarding_date'] : date('d/m/Y');
$checkInDate1 = str_replace('/', '-', $checkInDate);
$checkInDate2 = isset($checkInDate) ? date('Y-m-d', strtotime($checkInDate1)) : date("Y-m-d");
$datecheckin = date('Y-m-d', strtotime('+' . ($day - 1) . 'day', strtotime($checkInDate2)));
$checkOutDate = date('Y-m-d', strtotime('+' . $countit . 'day', strtotime($datecheckin)));
$adults = isset($sessionPackageSearch['totadlt']) ? $sessionPackageSearch['totadlt'] : '2';
$child = isset($sessionPackageSearch['totchld']) ? $sessionPackageSearch['totchld'] : '0';
$infent = '0';
$TotalPax = $adults + $child + $infent;
// echo"<pre>";print_r($TotalPax);die('ss');
$refId = '';
$destIndex = (int) 1;
$roomJsonInfo = isset($sessionPackageSearch['roominfojson']) ? $sessionPackageSearch['roominfojson'] : '';
if ($hVal['hotel'][0]['AccomSysId'] > 0) {
$ACCOMSYSIDArray[] = $hVal['hotel'][0]['AccomSysId'];
$hITEMIdArray[] = $hVal['hotel'][0]['itemid'];
$ROOMSYSIDArray[$hVal['hotel'][0]['itemid']][$hVal['hotel'][0]['AccomSysId']] = $hVal['hotel'][0]['RoomType'];
$MEALSYSIDArray[$hVal['hotel'][0]['itemid']][$hVal['hotel'][0]['AccomSysId']] = $hVal['hotel'][0]['MealPlanType'];
$destinationCity = 0;
$markupDetailsArray = array();
$hotelId = $hVal['hotel'][0]['AccomSysId'];
$priceSort = 1;
$resultData = $PackageMapper->getHotel($destinationCity, "tb_tbb2c_packages_master", $datecheckin, $checkOutDate, $adults, $child, $infent, $refId, $destIndex, json_encode($roomJsonInfo), '', $markupDetailsArray, '', '', $hotelId, '', '', 0, $priceSort);
$checkPlan = json_decode(base64_decode($resultData[0]['checkPlan']), 1);
$Price = $checkPlan['category']['SUB'][$hVal['hotel'][0]['RoomType']][$hVal['hotel'][0]['MealPlanType']]['Price'];
$Markup = $checkPlan['category']['SUB'][$hVal['hotel'][0]['RoomType']][$hVal['hotel'][0]['MealPlanType']]['Markup'];
// echo"<pre>";print_r($detail['itinerariesArray']);die('dd');
if ($Price == 0) {
// echo"<pre>";print_r($this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'][$hKey]['hotel']['0']['IsIncluded']);die('ss');
$this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'][$hKey]['hotel']['0']['IsIncluded'] = 0;
} else {
$this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'][$hKey]['hotel']['0']['IsIncluded'] = 1;
}
$HotelPrice[$hotelId] = $HotelPrice[$hotelId] + $Price;
$HotelMarkup[$hotelId] = $HotelMarkup[$hotelId] + $Markup;
}
// echo"<pre>";print_r($hVal['transfers']);die('dd');
foreach ($hVal['transfers'] as $transferval) {
if ($transferval['IsIncluded'] == 1) {
$RouteSysId = $transferval['RouteSysId'];
$RouteSysIdArr[] = $transferval['RouteSysId'];
$transfervalId = $transferval['itemid'];
$RouteVechSysId = $transferval['RouteVechSysId'];
$RouteVechSysIdArr[] = $transferval['RouteVechSysId'];
$day = $hVal['day'];
if (!empty($RouteSysId)) {
$resultData = $PackageMapper->fetchTransfersDetailsByRouteSysID($RouteSysId);
foreach ($resultData as $categoryVl) {
$category = $categoryVl['category'];
$dataArray = Zend_Json::decode($category);
foreach ($dataArray as $transfersprice) {
if ($transfersprice['RouteVechSysId'] == $RouteVechSysId) {
$Price = $transfersprice['Cost'];
// echo"<pre>";print_r($Price);die;
}
}
}
$TransferPrice[$day][$RouteVechSysId] = $TransferPrice[$day][$RouteVechSysId] + $Price;
}
}
}
// echo"<pre>";print_r($TransferPrice);die;
foreach ($hVal['sightSeeing'] as $sightval) {
if ($sightval['IsIncluded'] == 1) {
$sightSeeingId = $sightval['itemid'];
$day = $hVal['day'];
$resultData = $PackageMapper->fetchDayWiseOptionsDetails($catId, $gtxId, $packageId, $day, $sightSeeingId, 's');
foreach ($resultData['finalArray']['0']['SightSeeing'] as $sighprice) {
// echo "<pre>";
// print_r($resultData['finalArray']['0']['SightSeeing']);
// die('ss');
if ($sighprice['RefSSId'] == $sightSeeingId) {
if ($sighprice['priceaditionals']['RouteVechSysId'] > 0) {
$quantity = 1;
if ($TotalPax > $sighprice['priceaditionals']['Capacity']) {
$quantity = $TotalPax / $sighprice['priceaditionals']['Capacity'];
if (is_float($quantity)) {
$quantity = intval($quantity) + 1;
}
}
$Price = ($sighprice['priceaditionals']['netCost']) * $quantity;
} else {
$adultcost = $adults * $sighprice['priceaditionals']['adultCost'];
$childcost = $child * $sighprice['priceaditionals']['kidsCost'];
$Price = $adultcost + $childcost;
}
}
}
$SightPrice[$day][$sightSeeingId] = $SightPrice[$day][$sightSeeingId] + $Price;
}
}
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['transfers'] = $TransferPrice;
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['transfers'][$hVal['day']] as $transferprice) {
$transfer_price += $transferprice;
}
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['sightSeeing'] = $SightPrice;
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['sightSeeing'][$hVal['day']] as $sightSeeingprice) {
$sightseeing_price += $sightSeeingprice;
}
}
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['hotel'] = $HotelPrice;
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Markup']['hotel'] = $HotelMarkup;
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['hotel'] as $hotelprice) {
$hotel_price += $hotelprice;
}
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Markup']['hotel'] as $hotelmarkup) {
$hotel_markup += $hotelmarkup;
}
// echo"<pre>";print_r($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']);die('ss');
// $perpersonhotelprice = $hotel_price / $TotalPax;
$detail['price'] = ($hotel_price + $transfer_price + $sightseeing_price + $hotel_markup) / $TotalPax;
$ACCOMSYSIDArrayU = array_unique($ACCOMSYSIDArray);
$ACCOMSYSIDArrayStr = implode(',', $ACCOMSYSIDArrayU);
if (is_array($RouteSysIdArr)) {
$RouteSysIdArrU = array_unique($RouteSysIdArr);
$RouteSysIdArrStr = implode(',', $RouteSysIdArrU);
}
$HotelMaster = new Travel_Model_HotelMaster();
if (!empty($ACCOMSYSIDArrayStr)) {
$getHotelDetailByHotelIds = $HotelMaster->getHotelDetailByHotelIds('tb_tbb2c_packages_master', $ACCOMSYSIDArrayStr);
}
$PackageMapper = new Detail_Model_PackageMapper();
if (isset($RouteSysIdArrStr) && !empty($RouteSysIdArrStr)) {
$TransfersDetailsByRouteSysID = $PackageMapper->fetchTransfersDetailsByRouteSysIDs($RouteSysIdArrStr);
}
$TransferDataArray = array();
foreach ($TransfersDetailsByRouteSysID as $tKey => $tValue) {
$categoryJsonInfo = json_decode($tValue['category'], 1);
$area = json_decode($tValue['Area'], 1);
$TransportCategory = json_decode($tValue['TransportCategory'], 1);
foreach ($categoryJsonInfo as $VehicleData) {
// echo"<pre>";print_r($VehicleData);
// echo"<pre>";print_r($RouteVechSysIdArr);
$RouteVechSysIdUni = array_unique($RouteVechSysIdArr);
if (in_array($VehicleData['RouteVechSysId'], $RouteVechSysIdUni)) {
$TransferDataArray[$tValue['RouteSysId']][$VehicleData['RouteVechSysId']] = array(
'RouteSysId' => $tValue['RouteSysId'],
'RouteVechSysId' => $VehicleData['RouteVechSysId'],
'city' => $tValue['CityName'],
'Cost' => $VehicleData['Cost'],
'Capacity' => $VehicleData['Capacity'],
'VehName' => $VehicleData['VehName'],
'VehicleTypeName' => $VehicleData['VehicleTypeName'],
'CurrencySymbol' => $VehicleData['CurrencySymbol'],
'Description' => $tValue['Description'],
'pickupAreaId' => $area['0']['pickupAreaId'],
'dropAreaId' => $area['0']['dropAreaId'],
'PickUPLocation' => $area['0']['PickUPLocation'],
'DropLocation' => $area['0']['DropLocation'],
'SubCategory' => $TransportCategory['SubCategory'],
);
}
}
}
// echo"<pre>";print_r($TransferDataArray);die('ss');
$detail['DynamicTransferDataArray'] = $TransferDataArray;
$detail['itinerariesArray'] = $this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'];
$HotelDataArray = array();
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
foreach ($getHotelDetailByHotelIds as $hKey => $hValue) {
$LongJsonInfo = json_decode($hValue['LongJsonInfo'], 1);
$PriceAdditional = $LongJsonInfo['PriceAdditional'];
$GTXPkgId = $hValue['GTXPkgId'];
$RoomTypeName = $MealPlanTypeName = $MealPlanTypeId = $RoomTypeId = '';
foreach ($hITEMIdArray as $itemK => $itemVal) {
foreach ($PriceAdditional as $rrKey => $rrValue) {
if ($ROOMSYSIDArray[$itemVal][$hValue['GTXPkgId']] == $rrValue['EType'] && $MEALSYSIDArray[$itemVal][$hValue['GTXPkgId']] == $rrValue['MPType']) {
$RoomTypeName = $rrValue['Title'];
$MealPlanTypeName = $rrValue['MPTitle'];
$MealPlanTypeId = $rrValue['MPType'];
$RoomTypeId = $rrValue['EType'];
break;
}
}
$HotelDataArray[$hValue['GTXPkgId']][$MealPlanTypeId] = array(
'GTXPkgId' => $GTXPkgId,
'Name' => $LongJsonInfo['Title'],
'MealPlanTypeId' => $MealPlanTypeId,
'RoomTypeId' => $RoomTypeId,
'RoomTypeName' => $RoomTypeName,
'MealTypeName' => $MealPlanTypeName,
'Star' => $LongJsonInfo['Stars'],
'Brief' => $LongJsonInfo['Details'],
'MainImg' => $LongJsonInfo['DetailImg'],
'CheckinTime' => $LongJsonInfo['CheckinTime'],
'CheckOutTime' => $LongJsonInfo['CheckOutTime'],
'Location' => array('Address' => $LongJsonInfo['Address']),
);
}
//
}
$detail['DynamicHotelDataArray'] = $HotelDataArray;
}
@$isModified = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['modified']; // get if the package is modified or not
if ($isModified) {
// $this->view->sessionPrice = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['price'];
}
}
// echo"<pre>";print_r($_SESSION);die('dd');
$Destinations = $getDetail['Destinations']; // get the destination here
$whereDestination = '';
foreach (explode(',', $Destinations) as $key => $value) {
$whereDestinationArr[] = $value;
}
$where = [
'IsMarkForDel' => 0,
'IsActive' => 1,
'IsPublish' => 1,
'ItemType' => 1 // for Tour Package 1
];
if (count($whereDestinationArr) > 0) {
$str = $operator = '';
foreach ($whereDestinationArr as $k => $val) {
$operator = ($k != 0) ? ' OR ' : '';
if ($val) {
$str .= " $operator ( Destinations LIKE ('%" . $val . "%') OR Countries LIKE ('%" . $val . "%') ) ";
}
}
if ($str) {
$whereDestination .= ' (' . $str . ') ';
}
}
$whereCustom = " (1=1) and (`PkgSysId` <> '$packageId') ";
$whereCustom .= ($whereDestination) ? " AND $whereDestination " : "";
$currentTime = date('Y-m-d 00:00:00');
//$whereCustom .= " AND ( (`PkgValidFrom` <= '$currentTime') AND (`PkgValidUntil` >= '$currentTime') ) ";
// $whereCustom .= " AND ( `BookingValidUntil` >= '$currentTime') ";
$relatedPackages = $this->objMdl->rv_select_all_custom_query($this->tablename, ['Destinations', 'HotDeal', 'LongJsonInfo', 'StarRating', 'Nights', 'GTXPkgId', 'PackageType', 'Image', 'MainImage', 'PkgSysId', 'Countries'], $where, $whereCustom, ['MinPrice' => 'ASC'], 4);
$selectTitle = explode(",", $detail['Destinations']);
$searchContArr = array('title' => $relatedPackages['0']['Countries']);
$this->objMdl->searchContArr = $searchContArr;
$countrydata = $this->objMdl->rv_select_all_countries();
$searchStateArr = array('title' => $keywords);
$this->objMdl->searchStateArr = $searchStateArr;
$statedata = $this->objMdl->rv_select_all_states();
$destfaq = $countrydata[0]['title'];
$FAQ = $countrydata[0]['FAQ'];
$relatedPackagesArray = $this->objHelperGeneral->getPackageCardDetails($relatedPackages, 'B2C');
$whereCustomDes = (" FIND_IN_SET (Title, '" . $Destinations . "')");
$whereDes = ['IsActive' => 1];
$resultRegionId = $this->objMdl->rv_select_all_custom_query('tb_tbb2c_destinations', ['region_id'], $whereDes, $whereCustomDes, ['Title' => 'ASC'], 6);
$RegionId = array();
if ($resultRegionId) {
foreach ($resultRegionId as $value) {
$RegionId[] = $value['region_id'];
}
}
$RegionId = array_unique($RegionId);
if (trim($getDetail['MainImage']) != '') {
$explodedImages = explode(',', $getDetail['MainImage']);
// print_r($explodedImages); die;
$countImages = count($explodedImages);
// print_r($countImages); die;
$detail_image = array();
foreach ($explodedImages as $explodedvalue) {
$detail_image[] = $this->baseUrl . "public/upload/" . $this->stylecss . "/tours/" . $packageId . "/{size}/" . $explodedvalue;
}
} else if (trim($getDetail['Image']) != '') {
$explodedImages = explode(',', $getDetail['Image']);
// print_r($explodedImages); die;
$countImages = count($explodedImages);
// print_r($countImages); die;
$detail_image = array();
foreach ($explodedImages as $explodedvalue) {
$detail_image[] = $this->baseUrl . "public/upload/" . $this->stylecss . "/tours/" . $packageId . "/{size}/" . $explodedvalue;
}
} else {
$detail_image[] = $getDetail['itementries']['ImgThumbnail'];
}
$this->view->hotel_image = $getDetail['hotelWebImage'];
$this->view->detail_image = $detail_image;
/* SEO KEYWORD */
$itementriesName = strtolower($getDetail['itementries']['Name']);
$detailLayout = array();
$detailLayout['PackageTitle'] = $getDetail['itementries']['Name'] . ' (' . Catabatic_Helper::getPackageType($catId) . ') | ' . $Destinations . ' Tours Packages '; // get package name
$detailLayout['Keyword'] = ($getDetail['Keyword'] != '') ? $getDetail['Keyword'] : $itementriesName . ' holiday packages, ' . $itementriesName . ' honeymoon packages, ' . $itementriesName . ' travel package, ' . $itementriesName . ' travel and tours, travel agency, ' . $itementriesName . ' vacation tours, ' . $itementriesName . ' deals on holiday, ' . $itementriesName . ' honeymoon deals, ' . $itementriesName . ' budget tour packages, ' . $itementriesName . ' destination packages, ' . $itementriesName . ' group tours, ' . $itementriesName . ' tour package, ' . $itementriesName . ' holiday tours, ' . $itementriesName . ' honeymoon tours.'; // get package Keyword
$detailLayout['Description'] = ($getDetail['Description'] != '') ? $getDetail['Description'] : $getDetail['itementries']['Name'] . ' (' . Catabatic_Helper::getPackageType($catId) . ')- Book holiday and honeymoon packages and Travels and get great deals on tours packages. Plan your holidays and honeymoon with us.'; // get package Description
$detailLayout['metaTitle'] = (trim($getDetail['Metatag']) != '') ? $getDetail['Metatag'] : $detailLayout['PackageTitle']; // get package Metatag
$detailLayout['alttext'] = $getDetail['alttext'];
$detailLayout['alttext2'] = $getDetail['alttext2'];
$detailLayout['canonicaltag'] = $getDetail['canonicaltag'];
$detailLayout['Robotstag'] = $getDetail['Robotstag'];
$detailLayout['FAQschema'] = $getDetail['FAQschema'];
$detailLayout['FAQ'] = $getDetail['visaFAQ'];
$detailLayout['HTagDescription'] = $getDetail['HTagDescription'];
$detailLayout['FootDescription'] = $getDetail['FootDescription'];
$packageTheme = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title'], ['IsActive' => 1], ['packType' => 'ASC']);
$getPDFinfo = $getDetail['packageItinerary'];
$getPDFdata = explode('-AND-', $getPDFinfo);
$this->view->getPDFfile = $getPDFdata[0];
$this->view->getPDFlink = $getPDFdata[1];
$this->view->packageTheme = $packageTheme;
$this->view->catId = $catId;
$this->view->FAQ = $FAQ;
$this->view->destfaq = $destfaq;
$this->view->gtxId = $gtxId;
$this->view->packageId = $packageId;
$this->view->tourtype = $tourtype;
$this->view->detail = $detail;
$this->view->baseUrl = $this->baseUrl;
$this->view->callusnumber = $this->callusnumber;
$this->view->keywords = $keywords;
$this->view->detailLayout = $detailLayout;
$this->view->relatedPackages = $relatedPackagesArray;
$this->view->resultExpert = $resultExpert;
$this->view->isModified = $isModified;
$this->view->params = $params;
$this->view->MarkUpOnGTXNetworkPackage = $MarkUpOnGTXNetworkPackage;
$this->view->actionurl = $this->baseUrl . 'detail/index/index/pkgid/' . $packageId . '/gtxid/' . $gtxId . '/catid/' . $catId . '/tourtype/' . $tourtype . '/';
}
public function holidayAction() {
// error_reporting(E_ALL);
$params = $this->getRequest()->getParams();
// $this->_storage->packageSession = array();package-customize kar di
// layou
// echo"<pre>";print_r($this->_storage->packageSession);die('dd');
// $this->packagesearchData = $params;
// echo"<pre>";print_r($_SESSION);die('dd');
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->modulename = $this->modulename;
$paramsss = explode('-', trim($params['name'], '.html'));
krsort($paramsss); // reverse sort the array to find all url param ids for fetching recor
$listkeys = ['mp', 'tourtype', 'gtxid', 'catid', 'pkgid', 'destname']; // array of parameters
//echo"<pre>";print_r($params);die();
$i = 0;
foreach ($paramsss as $value) {
if ($i == count($listkeys))
break;
$param[$listkeys[$i]] = $value;
$i++;
}
$fixDestinations = isset($param['fixDestinations']) ? (int) $param['fixDestinations'] : '';
$catId = isset($param['catid']) ? (int) $param['catid'] : '';
$gtxId = isset($param['gtxid']) ? (int) $param['gtxid'] : '';
$packageId = isset($param['pkgid']) ? (int) $param['pkgid'] : '';
$tourtype = isset($param['tourtype']) ? (int) $param['tourtype'] : '';
$mealplantype = (int) $param['mp'];
$keywords = $param['destname'];
$customize = (isset($param['customize'])) ? $param['customize'] : 0; // for customization [ 1 , 0]
$this->view->mealplantype = $mealplantype;
$model = new Detail_Model_PackageMapper();
// check package for inactive case
$checkPackaageSysID = $model->checkPackaageSysID($gtxId);
if (!empty($checkPackaageSysID)) {
$packageId = $checkPackaageSysID['PkgSysId'];
}
$isModified = 0;
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2B'); // 4th optional parameter [ B2B | B2C ]
} else {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2C'); // 4th optional parameter [ B2B | B2C ]
}
if (empty($getDetail)) {
$this->_redirect($this->baseUrl);
}
$PackageType = $getDetail['PackageType']; // get package type [ Readymade , Dynamic ]
//$PackageSubType = $getDetail['PackageSubType']; // get package Sub type
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
// used for update package and send enquiry | category | meal plan change options
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], 'B2C', $PackageType, $detail['PackageSubType']);
//echo "<pre>";print_r($priceJsonViewFile);die;
$this->view->priceJsonViewFile = $priceJsonViewFile['priceArrJson'];
$detail = $this->objHelperGeneral->createArrayDetailDynamic($getDetail, ['catid' => $catId, 'gtxid' => $gtxId, 'pkgid' => $packageId, 'tourtype' => $tourtype]);
//echo"<pre>";print_r($detail);die('aa');
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
$detail['TPId'] = $getDetail['TPId']; //get tpid same for all in Dynamic package case
$detail['Destinations'] = $getDetail['Destinations']; // get package destinations
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
$detail['MPType'] = $CONST_MEAL_PLAN_ARR[$mealplantype]; // get package meal plan type
$detail['hotels_array_included_only'] = $getDetail['hotels_array_included_only']; // get hotels included in all itineraries
$detail['CategoriesArray'] = $priceJsonViewFile['priceArrJson']; // override the variable here new version is included cp,ap,map plan prices too
$priceArrJson = $detail['CategoriesArray'];
$tourTypeChar = ($tourtype == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
$pkgprice = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype, true); // Param 4: true ( if calculate discounted price )
$pkgpriceDiscount = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype); // Param 4: true ( if calculate discounted price )
$detail['PackageCategory'] = $getDetail['PackageCategory'];
$detail['Image'] = $getDetail['Image'];
$detail['DestinationsId'] = $getDetail['DestinationsId'];
$detail['isFixedDeparture'] = $getDetail['isFixedDeparture'];
$detail['fixedInventoryNew'] = $getDetail['fixedInventoryNew'];
$detail['IsfixedInventory'] = $getDetail['IsfixedInventory'];
$detail['exchangeCurrencyRateFlight'] = $getDetail['exchangeCurrencyRateFlight'];
$detail['Symbol'] = $getDetail['Symbol'];
$TotalPrice = (isset($detail['fixedInventoryNew'][0]['TotalPrice'])) ? (int) $detail['fixedInventoryNew'][0]['TotalPrice'] : 0;
$exchangeRate = 1;
if ($this->AgencyId == 98196 && $detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'] == 93) {
$exchangeRate = $this->objHelperGeneral->currencyExchangeRate($detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'], 2, 0);
$detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'] = 2;
$pkgprice = (int) ($pkgprice * $exchangeRate);
$TotalPrice = (int) ($TotalPrice * $exchangeRate);
$pkgpriceDiscount = (int) ($pkgpriceDiscount * $exchangeRate);
}
$detail['CategoriesArray']['TotalPrice'] = (int) ($TotalPrice);
$detail['CategoriesArray']['NetPrice'] = (int) ($pkgprice);
$detail['CategoriesArray']['DiscountNetPrice'] = (int) $pkgpriceDiscount + (int) $TotalPrice;
$detail['CategoriesArray']['DefaultAdultCost'] = $getDetail['DefaultAdultCost'];
if ($PackageType == $this->packageTypeStatic) {
$TransfersArrayCar = $this->objHelperGeneral->getTransfersArray('car', $detail['TransfersMaster']);
$OtherServicesArray = $this->objHelperGeneral->getTransfersArray('otherservices', $detail['OtherServices']);
$customize = 1;
if ($customize) {
$sessionid = $this->objHelperGeneral->checksession((int) $packageId, $tourtype, $catId); // create the session
if (!$sessionid) {
$others = ['services' => $OtherServicesArray, 'transfers' => $TransfersArrayCar];
$this->objHelperGeneral->copysession($packageId, $tourtype, $catId, $detail['itinerariesArray'], $pkgprice, $others); // copy itinerary details to session
}
// echo"<pre>";print_r($this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries']);die('aa');
$detail['itinerariesArray'] = $this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'];
$PackageMapper = new Detail_Model_PackageMapper();
$ACCOMSYSIDArray = $ROOMSYSIDArray = $MEALSYSIDArray = array();
$HotelPrice = $HotelMarkup = array();
$TransferPrice = $TransferMarkup = array();
$SightPrice = $SightMarkup = array();
foreach ($detail['itinerariesArray'] as $hKey => $hVal) {
$day = $hVal['day'];
$countit = 1;
$sessionPackageSearchParams = new Zend_Session_Namespace('sessionPackageSearchParams');
$sessionPackageSearch = $sessionPackageSearchParams->params;
$checkInDate = isset($sessionPackageSearch['boarding_date']) ? $sessionPackageSearch['boarding_date'] : date('d/m/Y');
$checkInDate1 = str_replace('/', '-', $checkInDate);
$checkInDate2 = isset($checkInDate) ? date('Y-m-d', strtotime($checkInDate1)) : date("Y-m-d");
$datecheckin = date('Y-m-d', strtotime('+' . ($day - 1) . 'day', strtotime($checkInDate2)));
$checkOutDate = date('Y-m-d', strtotime('+' . $countit . 'day', strtotime($datecheckin)));
$adults = isset($sessionPackageSearch['totadlt']) ? $sessionPackageSearch['totadlt'] : '2';
$child = isset($sessionPackageSearch['totchld']) ? $sessionPackageSearch['totchld'] : '0';
$infent = '0';
$TotalPax = $adults + $child + $infent;
// echo"<pre>";print_r($TotalPax);die('ss');
$refId = '';
$destIndex = (int) 1;
$roomJsonInfo = isset($sessionPackageSearch['roominfojson']) ? $sessionPackageSearch['roominfojson'] : '';
if ($hVal['hotel'][0]['AccomSysId'] > 0) {
$ACCOMSYSIDArray[] = $hVal['hotel'][0]['AccomSysId'];
$ROOMSYSIDArray[$hVal['hotel'][0]['AccomSysId']] = $hVal['hotel'][0]['RoomType'];
$MEALSYSIDArray[$hVal['hotel'][0]['AccomSysId']] = $hVal['hotel'][0]['MealPlanType'];
$destinationCity = 0;
$markupDetailsArray = array();
$hotelId = $hVal['hotel'][0]['AccomSysId'];
$priceSort = 1;
$resultData = $PackageMapper->getHotel($destinationCity, "tb_tbb2c_packages_master", $datecheckin, $checkOutDate, $adults, $child, $infent, $refId, $destIndex, json_encode($roomJsonInfo), '', $markupDetailsArray, '', '', $hotelId, '', '', 0, $priceSort);
$checkPlan = json_decode(base64_decode($resultData[0]['checkPlan']), 1);
$Price = $checkPlan['category']['SUB'][$hVal['hotel'][0]['RoomType']][$hVal['hotel'][0]['MealPlanType']]['Price'];
$Markup = $checkPlan['category']['SUB'][$hVal['hotel'][0]['RoomType']][$hVal['hotel'][0]['MealPlanType']]['Markup'];
if ($Price == 0) {
// echo"<pre>";print_r($this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'][$hKey]['hotel']['0']['IsIncluded']);die('ss');
$this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'][$hKey]['hotel']['0']['IsIncluded'] = 0;
} else {
$this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'][$hKey]['hotel']['0']['IsIncluded'] = 1;
}
$HotelPrice[$hotelId] = $HotelPrice[$hotelId] + $Price;
$HotelMarkup[$hotelId] = $HotelMarkup[$hotelId] + $Markup;
}
foreach ($hVal['transfers'] as $transferval) {
// if ($transferval['IsIncluded'] == 1) {
$RouteSysId = $transferval['RouteSysId'];
$transfervalId = $transferval['itemid'];
$RouteVechSysId = $transferval['RouteVechSysId'];
$day = $hVal['day'];
if (!empty($RouteSysId)) {
$resultData = $PackageMapper->fetchTransfersDetailsByRouteSysID($RouteSysId);
foreach ($resultData as $categoryVl) {
$category = $categoryVl['category'];
$dataArray = Zend_Json::decode($category);
foreach ($dataArray as $transfersprice) {
if ($transfersprice['RouteVechSysId'] == $RouteVechSysId) {
$Price = $transfersprice['Cost'];
// echo"<pre>";print_r($Price);die;
}
}
}
$TransferPrice[$day][$RouteVechSysId] = $TransferPrice[$day][$RouteVechSysId] + $Price;
}
// }
}
// echo"<pre>";print_r($TransferPrice);die;
foreach ($hVal['sightSeeing'] as $sightval) {
if ($sightval['IsIncluded'] == 1) {
$sightSeeingId = $sightval['itemid'];
$day = $hVal['day'];
$resultData = $PackageMapper->fetchDayWiseOptionsDetails($catId, $gtxId, $packageId, $day, $sightSeeingId, 's');
foreach ($resultData['finalArray']['0']['SightSeeing'] as $sighprice) {
// echo "<pre>";
// print_r($resultData['finalArray']['0']['SightSeeing']);
// die('ss');
if ($sighprice['RefSSId'] == $sightSeeingId) {
if ($sighprice['priceaditionals']['RouteVechSysId'] > 0) {
$quantity = 1;
if ($TotalPax > $sighprice['priceaditionals']['Capacity']) {
$quantity = $TotalPax / $sighprice['priceaditionals']['Capacity'];
if (is_float($quantity)) {
$quantity = intval($quantity) + 1;
}
}
$Price = ($sighprice['priceaditionals']['netCost']) * $quantity;
} else {
$adultcost = $adults * $sighprice['priceaditionals']['adultCost'];
$childcost = $child * $sighprice['priceaditionals']['kidsCost'];
$Price = $adultcost + $childcost;
}
}
}
$SightPrice[$day][$sightSeeingId] = $SightPrice[$day][$sightSeeingId] + $Price;
}
}
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['transfers'] = $TransferPrice;
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['transfers'][$hVal['day']] as $transferprice) {
$transfer_price += $transferprice;
}
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['sightSeeing'] = $SightPrice;
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['sightSeeing'][$hVal['day']] as $sightSeeingprice) {
$sightseeing_price += $sightSeeingprice;
}
}
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['hotel'] = $HotelPrice;
$this->_storage->packageSession[$packageId][$tourtype][$catId]['Markup']['hotel'] = $HotelMarkup;
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']['hotel'] as $hotelprice) {
$hotel_price += $hotelprice;
}
foreach ($this->_storage->packageSession[$packageId][$tourtype][$catId]['Markup']['hotel'] as $hotelmarkup) {
$hotel_markup += $hotelmarkup;
}
// echo"<pre>";print_r($this->_storage->packageSession[$packageId][$tourtype][$catId]['Price']);die('ss');
// $perpersonhotelprice = $hotel_price / $TotalPax;
$detail['price'] = ($hotel_price + $transfer_price + $sightseeing_price + $hotel_markup) / $TotalPax;
$ACCOMSYSIDArrayU = array_unique($ACCOMSYSIDArray);
$ACCOMSYSIDArrayStr = implode(',', $ACCOMSYSIDArrayU);
$HotelMaster = new Travel_Model_HotelMaster();
if (!empty($ACCOMSYSIDArrayStr)) {
$getHotelDetailByHotelIds = $HotelMaster->getHotelDetailByHotelIds('tb_tbb2c_packages_master', $ACCOMSYSIDArrayStr);
}
$PackageMapper = new Detail_Model_PackageMapper();
if (!empty($RouteSysId)) {
$TransfersDetailsByRouteSysID = $PackageMapper->fetchTransfersDetailsByRouteSysID($RouteSysId);
}
$TransferDataArray = array();
foreach ($TransfersDetailsByRouteSysID as $tKey => $tValue) {
$categoryJsonInfo = json_decode($tValue['category'], 1);
$area = json_decode($tValue['Area'], 1);
$TransportCategory = json_decode($tValue['TransportCategory'], 1);
foreach ($categoryJsonInfo as $VehicleData) {
// echo"<pre>";print_r($VehicleData);
// echo"<pre>";print_r($RouteVechSysId);
if ($RouteVechSysId == $VehicleData['RouteVechSysId']) {
$TransferDataArray[$tValue['RouteSysId']] = array(
'RouteSysId' => $tValue['RouteSysId'],
'RouteVechSysId' => $VehicleData['RouteVechSysId'],
'city' => $tValue['CityName'],
'Cost' => $VehicleData['Cost'],
'Capacity' => $VehicleData['Capacity'],
'VehName' => $VehicleData['VehName'],
'VehicleTypeName' => $VehicleData['VehicleTypeName'],
'CurrencySymbol' => $VehicleData['CurrencySymbol'],
'Description' => $tValue['Description'],
'pickupAreaId' => $area['0']['pickupAreaId'],
'dropAreaId' => $area['0']['dropAreaId'],
'PickUPLocation' => $area['0']['PickUPLocation'],
'DropLocation' => $area['0']['DropLocation'],
'SubCategory' => $TransportCategory['SubCategory'],
);
}
}
}
// echo"<pre>";print_r($TransferDataArray);die('ss');
$detail['DynamicTransferDataArray'] = $TransferDataArray;
$detail['itinerariesArray'] = $this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'];
$HotelDataArray = array();
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
foreach ($getHotelDetailByHotelIds as $hKey => $hValue) {
// echo"<pre>";print_r($hValue);die('dd');
$LongJsonInfo = json_decode($hValue['LongJsonInfo'], 1);
$PriceAdditional = $LongJsonInfo['PriceAdditional'];
$GTXPkgId = $hValue['GTXPkgId'];
$RoomTypeName = $MealPlanTypeName = $MealPlanTypeId = $RoomTypeId = '';
foreach ($PriceAdditional as $rrKey => $rrValue) {
// echo"<pre>";print_r($hValue);die('dd');
if ($ROOMSYSIDArray[$hValue['GTXPkgId']] == $rrValue['EType'] && $MEALSYSIDArray[$hValue['GTXPkgId']] == $rrValue['MPType']) {
$RoomTypeName = $rrValue['Title'];
$MealPlanTypeName = $rrValue['MPTitle'];
$MealPlanTypeId = $rrValue['MPType'];
$RoomTypeId = $rrValue['EType'];
break;
}
}
//
$HotelDataArray[$hValue['GTXPkgId']] = array(
'GTXPkgId' => $GTXPkgId,
'Name' => $LongJsonInfo['Title'],
'MealPlanTypeId' => $MealPlanTypeId,
'RoomTypeId' => $RoomTypeId,
'RoomTypeName' => $RoomTypeName,
'MealTypeName' => $MealPlanTypeName,
'Star' => $LongJsonInfo['Stars'],
'Brief' => $LongJsonInfo['Details'],
'MainImg' => $LongJsonInfo['DetailImg'],
'CheckinTime' => $LongJsonInfo['CheckinTime'],
'CheckOutTime' => $LongJsonInfo['CheckOutTime'],
'Location' => array('Address' => $LongJsonInfo['Address']),
);
}
$detail['DynamicHotelDataArray'] = $HotelDataArray;
}
@$isModified = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['modified']; // get if the package is modified or not
if ($isModified) {
// $this->view->sessionPrice = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['price'];
}
}
$Destinations = $getDetail['Destinations']; // get the destination here
$whereDestination = '';
foreach (explode(',', $Destinations) as $key => $value) {
$whereDestinationArr[] = $value;
}
$where = [
'IsMarkForDel' => 0,
'IsActive' => 1,
'IsPublish' => 1,
'ItemType' => 1 // for Tour Package 1
];
if (count($whereDestinationArr) > 0) {
$str = $operator = '';
foreach ($whereDestinationArr as $k => $val) {
$operator = ($k != 0) ? ' OR ' : '';
if ($val) {
$str .= " $operator ( Destinations LIKE ('%" . $val . "%') OR Countries LIKE ('%" . $val . "%') ) ";
}
}
if ($str) {
$whereDestination .= ' (' . $str . ') ';
}
}
$whereCustom = " (1=1) and (`PkgSysId` <> '$packageId') ";
$whereCustom .= ($whereDestination) ? " AND $whereDestination " : "";
$currentTime = date('Y-m-d 00:00:00');
//$whereCustom .= " AND ( (`PkgValidFrom` <= '$currentTime') AND (`PkgValidUntil` >= '$currentTime') ) ";
// $whereCustom .= " AND ( `BookingValidUntil` >= '$currentTime') ";
$relatedPackages = $this->objMdl->rv_select_all_custom_query($this->tablename, ['Destinations', 'HotDeal', 'LongJsonInfo', 'StarRating', 'Nights', 'GTXPkgId', 'PackageType', 'Image', 'PkgSysId', 'Countries'], $where, $whereCustom, ['MinPrice' => 'ASC'], 4);
$selectTitle = explode(",", $detail['Destinations']);
$searchContArr = array('title' => $relatedPackages['0']['Countries']);
$this->objMdl->searchContArr = $searchContArr;
$countrydata = $this->objMdl->rv_select_all_countries();
$searchStateArr = array('title' => $keywords);
$this->objMdl->searchStateArr = $searchStateArr;
$statedata = $this->objMdl->rv_select_all_states();
$destfaq = $countrydata[0]['title'];
$FAQ = $countrydata[0]['FAQ'];
$relatedPackagesArray = $this->objHelperGeneral->getPackageCardDetails($relatedPackages, 'B2C');
$whereCustomDes = (" FIND_IN_SET (Title, '" . $Destinations . "')");
$whereDes = ['IsActive' => 1];
$resultRegionId = $this->objMdl->rv_select_all_custom_query('tb_tbb2c_destinations', ['region_id'], $whereDes, $whereCustomDes, ['Title' => 'ASC'], 6);
$RegionId = array();
if ($resultRegionId) {
foreach ($resultRegionId as $value) {
$RegionId[] = $value['region_id'];
}
}
$RegionId = array_unique($RegionId);
if (trim($getDetail['MainImage']) != '') {
$explodedImages = explode(',', $getDetail['MainImage']);
// print_r($explodedImages); die;
$countImages = count($explodedImages);
// print_r($countImages); die;
$detail_image = array();
foreach ($explodedImages as $explodedvalue) {
$detail_image[] = $this->baseUrl . "public/upload/" . $this->stylecss . "/tours/" . $packageId . "/{size}/" . $explodedvalue;
}
} else if (trim($getDetail['Image']) != '') {
$explodedImages = explode(',', $getDetail['Image']);
// print_r($explodedImages); die;
$countImages = count($explodedImages);
// print_r($countImages); die;
$detail_image = array();
foreach ($explodedImages as $explodedvalue) {
$detail_image[] = $this->baseUrl . "public/upload/" . $this->stylecss . "/tours/" . $packageId . "/{size}/" . $explodedvalue;
}
} else {
$detail_image[] = $getDetail['itementries']['ImgThumbnail'];
}
$this->view->hotel_image = $getDetail['hotelWebImage'];
$this->view->detail_image = $detail_image;
/* SEO KEYWORD */
$itementriesName = strtolower($getDetail['itementries']['Name']);
$detailLayout = array();
$detailLayout['PackageTitle'] = $getDetail['itementries']['Name'] . ' (' . Catabatic_Helper::getPackageType($catId) . ') | ' . $Destinations . ' Tours Packages '; // get package name
$detailLayout['Keyword'] = ($getDetail['Keyword'] != '') ? $getDetail['Keyword'] : $itementriesName . ' holiday packages, ' . $itementriesName . ' honeymoon packages, ' . $itementriesName . ' travel package, ' . $itementriesName . ' travel and tours, travel agency, ' . $itementriesName . ' vacation tours, ' . $itementriesName . ' deals on holiday, ' . $itementriesName . ' honeymoon deals, ' . $itementriesName . ' budget tour packages, ' . $itementriesName . ' destination packages, ' . $itementriesName . ' group tours, ' . $itementriesName . ' tour package, ' . $itementriesName . ' holiday tours, ' . $itementriesName . ' honeymoon tours.'; // get package Keyword
$detailLayout['Description'] = ($getDetail['Description'] != '') ? $getDetail['Description'] : $getDetail['itementries']['Name'] . ' (' . Catabatic_Helper::getPackageType($catId) . ')- Book holiday and honeymoon packages and Travels and get great deals on tours packages. Plan your holidays and honeymoon with us.'; // get package Description
$detailLayout['metaTitle'] = (trim($getDetail['Metatag']) != '') ? $getDetail['Metatag'] : $detailLayout['PackageTitle']; // get package Metatag
//echo "<pre>";print_r($detail);die;
$packageTheme = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title'], ['IsActive' => 1], ['packType' => 'ASC']);
$getPDFinfo = $getDetail['packageItinerary'];
$getPDFdata = explode('-AND-', $getPDFinfo);
$this->view->getPDFfile = $getPDFdata[0];
$this->view->getPDFlink = $getPDFdata[1];
$this->view->packageTheme = $packageTheme;
$this->view->catId = $catId;
$this->view->FAQ = $FAQ;
$this->view->destfaq = $destfaq;
$this->view->gtxId = $gtxId;
$this->view->packageId = $packageId;
$this->view->tourtype = $tourtype;
$this->view->detail = $detail;
$this->view->baseUrl = $this->baseUrl;
$this->view->callusnumber = $this->callusnumber;
$this->view->keywords = $keywords;
$this->view->detailLayout = $detailLayout;
$this->view->relatedPackages = $relatedPackagesArray;
$this->view->resultExpert = $resultExpert;
$this->view->isModified = $isModified;
$this->view->params = $params;
$this->view->actionurl = $this->baseUrl . 'detail/index/index/pkgid/' . $packageId . '/gtxid/' . $gtxId . '/catid/' . $catId . '/tourtype/' . $tourtype . '/';
}
public function packagesearchdataAction() {
$params = $this->getRequest()->getParams();
// echo"<pre>";print_r($params);die;
$sessionPackageSearchParams = new Zend_Session_Namespace('sessionPackageSearchParams');
$sessionPackageSearchParams->params = $params;
$response = array('success' => true);
echo json_encode($response);
exit;
}
public function indexAjaxTabAction() {
// error_reporting(E_ALL);
$params = $this->getRequest()->getParams();
// echo"<pre>";print_r( $params);die;
$this->view->layout()->disableLayout();
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->modulename = $this->modulename;
$fixdestinations = isset($params['fixdestinations']) ? (int) $params['fixdestinations'] : 0;
$paramsss = explode('-', trim($params['name'], '.html'));
krsort($paramsss); // reverse sort the array to find all url param ids for fetching recor
$listkeys = ['mp', 'tourtype', 'gtxid', 'catid', 'pkgid', 'destname']; // array of parameters
$i = 0;
foreach ($paramsss as $value) {
if ($i == count($listkeys))
break;
$param[$listkeys[$i]] = $value;
$i++;
}
$catId = isset($param['catid']) ? (int) $param['catid'] : '';
$gtxId = isset($param['gtxid']) ? (int) $param['gtxid'] : '';
$packageId = isset($param['pkgid']) ? (int) $param['pkgid'] : '';
$tourtype = isset($param['tourtype']) ? (int) $param['tourtype'] : '';
$mealplantype = (int) $param['mp'];
$keywords = $param['destname'];
$customize = (isset($param['customize'])) ? $param['customize'] : 0; // for customization [ 1 , 0]
$this->view->mealplantype = $mealplantype;
// print_r($mealplantype);die;
$model = new Detail_Model_PackageMapper();
// check package for inactive case
$checkPackaageSysID = $model->checkPackaageSysID($gtxId);
if (!empty($checkPackaageSysID)) {
$packageId = $checkPackaageSysID['PkgSysId'];
}
$isModified = 0;
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2B'); // 4th optional parameter [ B2B | B2C ]
} else {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2C'); // 4th optional parameter [ B2B | B2C ]
}
if (!$getDetail) {
echo '';
exit;
}
if(isset($getDetail['itementries']['AgencyIdB2C']) && isset($getDetail['itementries']['AgencyIdB2B']) && ($getDetail['itementries']['AgencyIdB2C'] != $getDetail['itementries']['AgencyIdB2B'])){
$market = 'B2B';
$MarkUpOnGTXNetworkPackage = isset($getDetail['itementries']['MarkUpOnGTXNetworkPackage']) ? $getDetail['itementries']['MarkUpOnGTXNetworkPackage'] : 0;
}else{
$market = 'B2C';
$MarkUpOnGTXNetworkPackage = 0;
}
// if (!$getDetail['tourType']) {
// $this->_redirect($this->baseUrl);
// }
$PackageType = $getDetail['PackageType']; // get package type [ Readymade , Dynamic ]
// $PackageSubType = $getDetail['PackageSubType']; // get package Sub type
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
// used for update package and send enquiry | category | meal plan change options
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], 'B2B', $PackageType, $detail['PackageSubType']);
} else {
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], $market, $PackageType, $detail['PackageSubType']);
}
$this->view->priceJsonViewFile = $priceJsonViewFile['priceArrJson'];
$this->view->hotelStandardArr = $priceJsonViewFile['hotelStandardArr'];
$detail = $this->objHelperGeneral->createArrayDetailDynamic($getDetail, ['catid' => $catId, 'gtxid' => $gtxId, 'pkgid' => $packageId, 'tourtype' => $tourtype]);
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
$detail['TPId'] = $getDetail['TPId']; // get tpid same for all in Dynamic package case
$detail['Destinations'] = $getDetail['Destinations']; // get package destinations
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
$detail['MPType'] = $CONST_MEAL_PLAN_ARR[$mealplantype]; // get package meal plan type
$detail['hotels_array_included_only'] = $getDetail['hotels_array_included_only']; // get hotels included in all itineraries
$detail['CategoriesArray'] = $priceJsonViewFile['priceArrJson']; // override the variable here new version is included cp,ap,map plan prices too
$detail['TransferDayData'] = $getDetail['TransferDayData']; // override the variable here new version is included cp,ap,map plan prices too
$priceArrJson = $detail['CategoriesArray'];
$tourTypeChar = ($tourtype == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
$pkgprice = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype, true); // Param 4: true ( if calculate discounted price )
$pkgpriceDiscount = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype); // Param 4: true ( if calculate discounted price )
$TotalPrice = (isset($fixedInventoryNew['TotalPrice'])) ? (int) $fixedInventoryNew['TotalPrice'] : 0;
$exchangeRate = 1;
if ($this->AgencyId == 98196 && $detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'] == 93) {
$exchangeRate = $this->objHelperGeneral->currencyExchangeRate($detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'], 2, 0);
}
$detail['CategoriesArray']['TotalPrice'] = (int) ($TotalPrice);
$detail['CategoriesArray']['exchangeRate'] = $exchangeRate;
$detail['CategoriesArray']['NetPrice'] = $pkgprice;
$detail['CategoriesArray']['DefaultAdultCost'] = $getDetail['DefaultAdultCost'];
$detail['CategoriesArray']['DiscountNetPrice'] = (int) $pkgpriceDiscount + (int) $TotalPrice;
$detail['PackageCategory'] = $getDetail['PackageCategory'];
$detail['Image'] = $getDetail['Image'];
$detail['DestinationsId'] = $getDetail['DestinationsId'];
$detail['AddonServices'] = $getDetail['AddonServices'];
$detail['FlightData'] = $getDetail['FlightData'];
$detail['fixedInventoryNew'] = $getDetail['itementries']['fixedInventory'][$fixdestinations];
if ($PackageType == $this->packageTypeStatic) {
// get transfers array details
$TransfersArrayCar = $this->objHelperGeneral->getTransfersArray('car', $detail['TransfersMaster']);
$OtherServicesArray = $this->objHelperGeneral->getTransfersArray('otherservices', $detail['OtherServices']);
// echo '<pre>'; print_r( $OtherServicesArray ); die;
$customize = 1;
if ($customize) {
$sessionid = $this->objHelperGeneral->checksession((int) $packageId, $tourtype, $catId); // create the session
if (!$sessionid) {
// $this->PSESS_TIMESTAMP = $sessionid;
$others = ['services' => $OtherServicesArray, 'transfers' => $TransfersArrayCar];
$this->objHelperGeneral->copysession($packageId, $tourtype, $catId, $detail['itinerariesArray'], $pkgprice, $others); // copy itinerary details to session
}
$detail['itinerariesArray'] = $this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'];
}
@$isModified = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['modified']; // get if the package is modified or not
// show session price only if the package is modified
if ($isModified) {
$this->view->sessionPrice = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['price'];
}
}
// start : fetch related destinations here
$Destinations = $getDetail['Destinations']; // get the destination here
$whereDestination = '';
foreach (explode(',', $Destinations) as $key => $value) {
$whereDestinationArr[] = $value;
}
$where = [
'IsMarkForDel' => 0,
'IsActive' => 1,
'IsPublish' => 1,
'ItemType' => 1 // for Tour Package 1
];
// param conditions
if (count($whereDestinationArr) > 0) {
$str = $operator = '';
foreach ($whereDestinationArr as $k => $val) {
$operator = ($k != 0) ? ' OR ' : '';
if ($val) {
$str .= " $operator ( Destinations LIKE ('%" . $val . "%') OR Countries LIKE ('%" . $val . "%') ) ";
}
}
if ($str) {
$whereDestination .= ' (' . $str . ') ';
}
}
$whereCustom = " (1=1) and (`PkgSysId` <> '$packageId') ";
$whereCustom .= ($whereDestination) ? " AND $whereDestination " : "";
$currentTime = date('Y-m-d 00:00:00');
$whereCustom .= " AND ( (`PkgValidFrom` <= '$currentTime') AND (`PkgValidUntil` >= '$currentTime') ) ";
$whereCustom .= " AND ( `BookingValidUntil` >= '$currentTime') ";
$relatedPackages = $this->objMdl->rv_select_all_custom_query($this->tablename, ['Destinations', 'HotDeal', 'LongJsonInfo', 'StarRating', 'Nights', 'GTXPkgId', 'PackageType', 'Image', 'MainImage', 'PkgSysId'], $where, $whereCustom, ['MinPrice' => 'ASC'], 4);
// echo "<pre>"; print_r($relatedPackages); die("chk");
if (empty($relatedPackages)) {
$Countries = $getDetail['Countries'];
if (trim(strtolower($Countries)) == 'india') {
$Countries = $Countries . ',Indian Subcontinent';
}
$PackageSearchString = $getDetail['PackageSearchString'];
$Countries = explode(',', $Countries);
$PackageSearchString = explode(',', $PackageSearchString);
$final_PackageSearchStringArr = array_diff($PackageSearchString, $Countries);
// echo"<pre>"; print_r($final_PackageSearchStringArr); die;
$where1 = [
'IsMarkForDel' => 0,
'IsActive' => 1,
'IsPublish' => 1,
'ItemType' => 1 // for Tour Package 1
];
if (count($final_PackageSearchStringArr) > 0) {
$str = $operator = '';
foreach ($final_PackageSearchStringArr as $k => $val) {
$operator = ($k != 0) ? ' OR ' : '';
if ($val) {
$str .= " $operator ( PackageSearchString LIKE ('%" . $val . "%') ) ";
}
}
if ($str) {
$whereDest1 .= ' (' . $str . ') ';
}
}
$whereCustom1 = " (1=1) and (`PkgSysId` <> '$packageId') ";
$whereCustom1 .= ($whereDest1) ? " AND $whereDest1 " : "";
// echo $whereCustom1; die;
$relatedPackages = $this->objMdl->rv_select_all_custom_query($this->tablename, ['Destinations', 'HotDeal', 'LongJsonInfo', 'StarRating', 'Nights', 'GTXPkgId', 'PackageType', 'Image', 'MainImage', 'PkgSysId'], $where1, $whereCustom1, ['MinPrice' => 'ASC'], 4);
}
// echo "<pre>"; print_r($relatedPackages); die;
// start : get package price here
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$relatedPackagesArray = $this->objHelperGeneral->getPackageCardDetails($relatedPackages, 'B2B');
} else {
$relatedPackagesArray = $this->objHelperGeneral->getPackageCardDetails($relatedPackages, 'B2C');
}
// end : get package price here
// end : fetch related destinations here
// Get region id from destination table
$whereCustomDes = (" FIND_IN_SET (Title, '" . $Destinations . "')");
$whereDes = ['IsActive' => 1];
$resultRegionId = $this->objMdl->rv_select_all_custom_query('tb_tbb2c_destinations', ['region_id'], $whereDes, $whereCustomDes, ['Title' => 'ASC'], 6);
if ($resultRegionId) {
$RegionId = array();
foreach ($resultRegionId as $value) {
$RegionId[] = $value['region_id'];
}
}
if (is_array($RegionId)) {
$RegionId = array_unique($RegionId);
}
if ($Destinations) {
$selectTitle = explode(",", $Destinations);
foreach ($selectTitle as $value) {
$checkdata = $this->objMdl->selectOne('tb_tbb2c_destinations', ['Bannerimg', 'DesSysId'], ['Title' => $value]);
if (!empty($checkdata['Bannerimg']) && !empty($checkdata)) {
$array[] = [
'Bannerimg' => $checkdata['Bannerimg'],
'DesSysId' => $checkdata['DesSysId'],
];
}
}
$this->view->bannerArray = $array;
$this->view->DesSysId = $checkdata['DesSysId'];
}
$mealforhotel = $getDetail['finalArray']['Hotel'][0]['Hotel'][0]['MealTypeName'];
/* SEO KEYWORD */
$detailLayout = array();
$detailLayout['Keyword'] = $getDetail['Keyword']; // get package Keyword
$detailLayout['Description'] = $getDetail['Description']; // get package Description
$detailLayout['Metatag'] = $getDetail['Metatag']; // get package Metatag
$detailLayout['PackageTitle'] = $getDetail['itementries']['Name'] . ' (' . Catabatic_Helper::getPackageType($catId) . ')'; // get package name
$packageTheme = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title'], ['IsActive' => 1], ['packType' => 'ASC']);
// echo "<pre>";print_r($packageTheme);die;
$activeHotel = $params['hotel_type'];
$activeTab = $params['tab'];
$this->view->activeHotel = $activeHotel;
$this->view->activeTab = $activeTab;
$this->view->packageTheme = $packageTheme;
$this->view->catId = $catId;
$this->view->gtxId = $gtxId;
$this->view->packageId = $packageId;
$this->view->tourtype = $tourtype;
$this->view->mealforhotel = $mealforhotel;
$this->view->detail = $detail;
$this->view->baseUrl = $this->baseUrl;
$this->view->callusnumber = $this->callusnumber;
$this->view->keywords = $keywords;
$this->view->detailLayout = $detailLayout;
$this->view->relatedPackages = $relatedPackagesArray;
$this->view->resultExpert = $resultExpert;
$this->view->isModified = $isModified;
$this->view->params = $params;
$this->view->market = $market;
$this->view->MarkUpOnGTXNetworkPackage = $MarkUpOnGTXNetworkPackage;
$this->view->actionurl = $this->baseUrl . 'detail/index/index/pkgid/' . $packageId . '/gtxid/' . $gtxId . '/catid/' . $catId . '/tourtype/' . $tourtype . '/';
}
public function indexAjaxDataAction() {
// error_reporting(E_ALL);
$params = $this->getRequest()->getParams();
$this->view->layout()->disableLayout();
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->modulename = $this->modulename;
$paramsss = explode('-', trim($params['name'], '.html'));
krsort($paramsss); // reverse sort the array to find all url param ids for fetching recor
$listkeys = ['mp', 'tourtype', 'gtxid', 'catid', 'pkgid', 'destname']; // array of parameters
$i = 0;
foreach ($paramsss as $key => $value) {
if ($i == count($listkeys))
break;
$param[$listkeys[$i]] = $value;
$i++;
}
$catId = isset($param['catid']) ? (int) $param['catid'] : '';
$gtxId = isset($param['gtxid']) ? (int) $param['gtxid'] : '';
$packageId = isset($param['pkgid']) ? (int) $param['pkgid'] : '';
$tourtype = isset($param['tourtype']) ? (int) $param['tourtype'] : '';
$mealplantype = (int) $param['mp'];
$keywords = $param['destname'];
$customize = (isset($param['customize'])) ? $param['customize'] : 0; // for customization [ 1 , 0]
$fixDestinations = isset($params['fixDestinations']) ? (int) $params['fixDestinations'] : 0;
$this->view->mealplantype = $mealplantype;
$model = new Detail_Model_PackageMapper();
// check package for inactive case
$checkPackaageSysID = $model->checkPackaageSysID($gtxId);
if (!empty($checkPackaageSysID)) {
$packageId = $checkPackaageSysID['PkgSysId'];
}
$isModified = 0;
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2B'); // 4th optional parameter [ B2B | B2C ]
} else {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2C'); // 4th optional parameter [ B2B | B2C ]
}
if (!$getDetail['tourType']) {
$this->_redirect($this->baseUrl);
}
$PackageType = $getDetail['PackageType']; // get package type [ Readymade , Dynamic ]
// $PackageSubType = $getDetail['PackageSubType']; // get package Sub type
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
// used for update package and send enquiry | category | meal plan change options
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], 'B2B', $PackageType, $detail['PackageSubType']);
} else {
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], 'B2C', $PackageType, $detail['PackageSubType']);
}
$this->view->priceJsonViewFile = $priceJsonViewFile['priceArrJson'];
$detail = $this->objHelperGeneral->createArrayDetailDynamic($getDetail, ['catid' => $catId, 'gtxid' => $gtxId, 'pkgid' => $packageId, 'tourtype' => $tourtype]);
$detail['PackageSubType'] = $getDetail['PackageSubType']; // get the package sub category
$detail['TPId'] = $getDetail['TPId']; // get tpid same for all in Dynamic package case
$detail['Destinations'] = $getDetail['Destinations']; // get package destinations
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
$detail['MPType'] = $CONST_MEAL_PLAN_ARR[$mealplantype]; // get package meal plan type
$detail['hotels_array_included_only'] = $getDetail['hotels_array_included_only']; // get hotels included in all itineraries
$detail['CategoriesArray'] = $priceJsonViewFile['priceArrJson']; // override the variable here new version is included cp,ap,map plan prices too
$detail['fixedInventoryNew'] = $getDetail['fixedInventoryNew'];
$detail['IsfixedInventory'] = $getDetail['IsfixedInventory'];
$detail['fixDestinations'] = $fixDestinations;
$priceArrJson = $detail['CategoriesArray'];
$tourTypeChar = ($tourtype == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
$pkgprice = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype, true); // Param 4: true ( if calculate discounted price )
$pkgpriceDiscount = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype); // Param 4: true ( if calculate discounted price )
//$detail['fixedInventoryNew'] = $getDetail['itementries']['fixedInventory'][$fixdestinations];
if (!empty($fixDestinations) && $fixDestinations != 0) {
$keyInv = array_search($fixDestinations, array_column($detail['fixedInventoryNew'], 'CityId'));
}
$fixedInventoryNew = isset($detail['fixedInventoryNew'][$keyInv]) ? $detail['fixedInventoryNew'][$keyInv] : array();
$detail['Symbol'] = isset($getDetail['Symbol']) ? $getDetail['Symbol'] : ' ';
$TotalPrice = (isset($fixedInventoryNew['TotalPrice'])) ? (int) $fixedInventoryNew['TotalPrice'] : 0;
$exchangeRate = 1;
if ($this->AgencyId == 98196 && $detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'] == 93) {
$exchangeRate = $this->objHelperGeneral->currencyExchangeRate($detail['CategoriesArray']['P'][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency'], 2, 0);
$TotalPrice = $TotalPrice * $exchangeRate;
$pkgprice = $pkgprice * $exchangeRate;
$pkgpriceDiscount = $pkgpriceDiscount * $exchangeRate;
}
$detail['CategoriesArray']['TotalPrice'] = (int) ($TotalPrice);
$detail['CategoriesArray']['NetPrice'] = (int) $pkgprice;
$detail['CategoriesArray']['DiscountNetPrice'] = (int) $pkgpriceDiscount + (int) $TotalPrice;
$detail['PackageCategory'] = $getDetail['PackageCategory'];
$detail['Image'] = $getDetail['Image'];
$detail['DestinationsId'] = $getDetail['DestinationsId'];
if ($PackageType == $this->packageTypeStatic) {
// get transfers array details
$TransfersArrayCar = $this->objHelperGeneral->getTransfersArray('car', $detail['TransfersMaster']);
$OtherServicesArray = $this->objHelperGeneral->getTransfersArray('otherservices', $detail['OtherServices']);
$customize = 1;
if ($customize) {
$sessionid = $this->objHelperGeneral->checksession((int) $packageId, $tourtype, $catId); // create the session
if (!$sessionid) {
// $this->PSESS_TIMESTAMP = $sessionid;
$others = ['services' => $OtherServicesArray, 'transfers' => $TransfersArrayCar];
$this->objHelperGeneral->copysession($packageId, $tourtype, $catId, $detail['itinerariesArray'], $pkgprice, $others); // copy itinerary details to session
}
$detail['itinerariesArray'] = $this->_storage->packageSession[$packageId][$tourtype][$catId]['itineraries'];
}
@$isModified = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['modified']; // get if the package is modified or not
// show session price only if the package is modified
if ($isModified) {
$this->view->sessionPrice = $this->_storage->packageSession[$packageId][$tourtype][$catId]['others']['price'];
}
}
// start : fetch related destinations here
$Destinations = $getDetail['Destinations']; // get the destination here
$whereDestination = '';
foreach (explode(',', $Destinations) as $key => $value) {
$whereDestinationArr[] = $value;
}
$where = [
'IsMarkForDel' => 0,
'IsActive' => 1,
'IsPublish' => 1,
'ItemType' => 1 // for Tour Package 1
];
// param conditions
if ((!empty($whereDestinationArr)) && ($whereDestinationArr) > 0) {
$str = $operator = '';
foreach ($whereDestinationArr as $k => $val) {
$operator = ($k != 0) ? ' OR ' : '';
if ($val) {
$str .= " $operator ( Destinations LIKE ('%" . $val . "%') OR Countries LIKE ('%" . $val . "%') ) ";
}
}
if ($str) {
$whereDestination .= ' (' . $str . ') ';
}
}
$whereCustom = " (1=1) and (`PkgSysId` <> '$packageId') ";
$whereCustom .= ($whereDestination) ? " AND $whereDestination " : "";
$currentTime = date('Y-m-d 00:00:00');
$whereCustom .= " AND ( (`PkgValidFrom` <= '$currentTime') AND (`PkgValidUntil` >= '$currentTime') ) ";
$whereCustom .= " AND ( `BookingValidUntil` >= '$currentTime') ";
$relatedPackages = $this->objMdl->rv_select_all_custom_query($this->tablename, ['Destinations', 'HotDeal', 'LongJsonInfo', 'StarRating', 'Nights', 'GTXPkgId', 'PackageType', 'Image', 'PkgSysId'], $where, $whereCustom, ['MinPrice' => 'ASC'], 4);
// echo"<pre>";print_r( $whereCustom);die('shalvii');
// start : get package price here
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$relatedPackagesArray = $this->objHelperGeneral->getPackageCardDetails($relatedPackages, 'B2B');
} else {
$relatedPackagesArray = $this->objHelperGeneral->getPackageCardDetails($relatedPackages, 'B2C');
}
// end : get package price here
// end : fetch related destinations here
// Get region id from destination table
$whereCustomDes = (" FIND_IN_SET (Title, '" . $Destinations . "')");
$whereDes = ['IsActive' => 1];
$resultRegionId = $this->objMdl->rv_select_all_custom_query('tb_tbb2c_destinations', ['region_id'], $whereDes, $whereCustomDes, ['Title' => 'ASC'], 6);
if ($resultRegionId) {
$RegionId = array();
foreach ($resultRegionId as $value) {
$RegionId[] = $value['region_id'];
}
}
if ($RegionId) {
$RegionId = array_unique($RegionId);
}
if ($Destinations) {
$selectTitle = explode(",", $Destinations);
foreach ($selectTitle as $value) {
$checkdata = $this->objMdl->selectOne('tb_tbb2c_destinations', ['Bannerimg', 'DesSysId'], ['Title' => $value]);
if (!empty($checkdata['Bannerimg']) && !empty($checkdata)) {
$array[] = [
'Bannerimg' => $checkdata['Bannerimg'],
'DesSysId' => $checkdata['DesSysId'],
];
}
}
$this->view->bannerArray = $array;
$this->view->DesSysId = $checkdata['DesSysId'];
}
/* SEO KEYWORD */
$detailLayout = array();
$detailLayout['Keyword'] = $getDetail['Keyword']; // get package Keyword
$detailLayout['Description'] = $getDetail['Description']; // get package Description
$detailLayout['Metatag'] = $getDetail['Metatag']; // get package Metatag
$detailLayout['PackageTitle'] = $getDetail['itementries']['Name'] . ' (' . Catabatic_Helper::getPackageType($catId) . ')'; // get package name
$packageTheme = $this->objMdl->rv_select_all('tbl_pack_type', ['packType', 'Title'], ['IsActive' => 1], ['packType' => 'ASC']);
$this->view->packageTheme = $packageTheme;
$this->view->catId = $catId;
$this->view->gtxId = $gtxId;
$this->view->packageId = $packageId;
$this->view->tourtype = $tourtype;
$this->view->detail = $detail;
$this->view->baseUrl = $this->baseUrl;
$this->view->callusnumber = $this->callusnumber;
$this->view->keywords = $keywords;
$this->view->detailLayout = $detailLayout;
$this->view->relatedPackages = $relatedPackagesArray;
//$this->view->resultExpert = $resultExpert;
$this->view->isModified = $isModified;
$this->view->params = $params;
$this->view->actionurl = $this->baseUrl . 'detail/index/index/pkgid/' . $packageId . '/gtxid/' . $gtxId . '/catid/' . $catId . '/tourtype/' . $tourtype . '/';
}
public function sendQueryAction() {
$this->_helper->layout()->disableLayout('');
$this->_helper->viewRenderer->setNoRender(true);
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
echo '<pre>';
print_r($param);
die;
//check if any of the inputs are empty
if (empty($param['inputName']) || empty($param['inputEmail']) || empty($param['inputPhone']) || empty($param['inputMessage'])) {
$result = ['status' => false, 'message' => 'Please fill out the form completely.'];
} else {
$DestinationID = '';
$Destinations = '';
$roomjson = '';
$this->postFields = "";
$this->postFields .= "&AgencySysId=" . $this->AgencyId;
$this->postFields .= "&TravelPlanId=" . $param['TravelPlanId'];
$this->postFields .= "&FirstName=" . $param['inputName'];
$this->postFields .= "&LastName=";
$this->postFields .= "&Email=" . $param['inputEmail'];
$this->postFields .= "&MobileNumber=" . $param['inputPhone'];
$this->postFields .= "&PriceRange=" . $param['PriceRange']; // 2000-50000
$this->postFields .= "&PKGCheckInDate=" . $param['PKGCheckInDate']; // 12/08/2017
$this->postFields .= "&PKGCheckOutDate=" . $param['PKGCheckOutDate']; // 19/08/2017
$this->postFields .= "&MinPrice=" . $param['MinPrice']; // 2000
$this->postFields .= "&MaxPrice=" . $param['MaxPrice']; // 50000
$this->postFields .= "&DestinationID=" . $DestinationID; // destination id
$this->postFields .= "&Destination=" . $Destinations; // destination value
$this->postFields .= "&roomjson=" . $roomjson; // destination value
try {
$model = new Gtxwebservices_Model_Webservices();
$getPackagesData = $model->sendQuery($this->postFields);
// print_r($getPackagesData); die;
$message = "Your query has been sent successfully.";
$status = true;
} catch (Zend_Exception $error) {
$message = $this->view->error_msg = $error->getMessage();
$status = false;
}
$result = ['status' => $status, 'message' => $message];
}
} else {
$result = ['status' => false, 'message' => 'Invalid Request!'];
}
echo Zend_Json::encode($result);
exit;
}
public function getCustomizeDynamicPackageDetailAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
$CONST_PACKAGE_CAT = unserialize(CONST_PACKAGE_CAT);
// print_r($param); die;
$SourcePlaceSysId = trim($param['SourcePlaceSysId']);
// echo $SourcePlaceSysId ; die;
$DestinationPlacesSysId = trim($param['DestinationPlacesSysId']);
// echo $SourcePlaceSysId; die;
$NoofNights = trim($param['NoofNights']);
// echo $NoofNights; die;
$DestinationsIds = trim($param['DestinationsIds']);
$DestinationsIds = explode(',', $DestinationsIds);
$adults = 0;
$childs = 0;
$infants = 0;
$roomJsonInfo = array();
for ($i = 0; $i < $param['room']; $i++) {
$adults += $param['Adult'][$i];
$childs += $param['Child'][$i];
$roomJsonInfo[$i]['Adult'] = $param['Adult'][$i];
$roomJsonInfo[$i]['Child'] = $param['Child'][$i];
$roomJsonInfo[$i]['infent'] = 0;
}
// echo "<pre>";print_r($roomJsonInfo);die;
$destinationCity = (int) $DestinationsIds[0];
$adults = (int) $adults;
$child = (int) $childs;
$infent = (int) $infants;
$destIndex = (int) 1;
$date = $this->getRequest()->getParam('date');
$getcheckInExplode = explode('/', $date);
$getcheckIn = $getcheckInExplode[2] . '-' . $getcheckInExplode[1] . '-' . $getcheckInExplode[0];
$getcheckOut = date('Y-m-d', strtotime($getcheckIn . ' + ' . ($NoofNights) . ' days'));
$refId = 'eyJUIjoiMTciLCJEIjp7IjkyIjp7IkRlc0lkIjoiNjU2MSIsIlNlcSI6IjEifX19';
$model = new Travel_Model_HotelMaster();
$hotelids = isset($param['hotelid']) ? $param['hotelid'] : '';
$hotelCategory = isset($param['hotelcategoryid']) ? $CONST_PACKAGE_CAT[$param['hotelcategoryid']] : '';
$hotelidsArr = array();
// $hotelidsArr = json_decode($hotelids, 1);
// echo $hotelidsArr['night'][0]; die;
if ($hotelids != '') {
$hotelidsArr = json_decode($hotelids, 1);
// print_r($hotelidsArr); die;
}
$hotelDataById = array();
if (!empty($hotelidsArr['haid'][0])) {
$hotelDataById = $model->getHotelByHotelid("tb_tbb2c_packages_master", implode(',', $hotelidsArr['haid']), implode(',', $hotelidsArr['night']), implode(',', $hotelidsArr['ROOMTYPE']), implode(',', $hotelidsArr['MEALPLANTYPE']), $getcheckIn, json_encode($roomJsonInfo), $DestinationsIds, $param['package_destination_night_detail']);
}
// echo "<pre>";print_r($hotelDataById);die;
// echo $SourcePlaceSysId.' '.$DestinationPlacesSysId.' '.$NoofNights;die;
$TransportRouteData = $model->getAutosuggestTransportRouteData($SourcePlaceSysId, $DestinationPlacesSysId, $NoofNights);
$transportFinalArray = array();
foreach ($TransportRouteData as $tKey => $tVal) {
$category = json_decode($tVal['category'], 1);
foreach ($category as $cKey => $cVal) {
$transportFinalArray[$cVal['RouteVechSysId']]['RouteSysId'] = $tVal['RouteSysId'];
$transportFinalArray[$cVal['RouteVechSysId']]['RouteName'] = $tVal['RouteName'];
$transportFinalArray[$cVal['RouteVechSysId']]['StartCitySysId'] = $tVal['StartCitySysId'];
$transportFinalArray[$cVal['RouteVechSysId']]['EndCitySysId'] = $tVal['EndCitySysId'];
$transportFinalArray[$cVal['RouteVechSysId']]['Noofnights'] = $tVal['Noofnights'];
$transportFinalArray[$cVal['RouteVechSysId']]['CityName'] = $tVal['CityName'];
$transportFinalArray[$cVal['RouteVechSysId']]['EndCityName'] = $tVal['EndCityName'];
$transportFinalArray[$cVal['RouteVechSysId']]['RouteVechSysId'] = $cVal['RouteVechSysId'];
$transportFinalArray[$cVal['RouteVechSysId']]['VehicleSysId'] = $cVal['VehicleSysId'];
$transportFinalArray[$cVal['RouteVechSysId']]['VehicleTypeSysId'] = $cVal['VehicleTypeSysId'];
$transportFinalArray[$cVal['RouteVechSysId']]['Cost'] = Catabatic_Helper::calculateMarkup($cVal['Cost']);
$transportFinalArray[$cVal['RouteVechSysId']]['Capacity'] = $cVal['Capacity'];
$transportFinalArray[$cVal['RouteVechSysId']]['CurrencyType'] = $cVal['CurrencyType'];
$transportFinalArray[$cVal['RouteVechSysId']]['SupplierName'] = $cVal['SupplierName'];
$transportFinalArray[$cVal['RouteVechSysId']]['VehName'] = $cVal['VehName'];
$transportFinalArray[$cVal['RouteVechSysId']]['VehicleTypeName'] = $cVal['VehicleTypeName'];
$transportFinalArray[$cVal['RouteVechSysId']]['CurrencySymbol'] = $cVal['CurrencySymbol'];
$transportFinalArray[$cVal['RouteVechSysId']]['cityIncludes'] = $tVal['cityIncludes'];
}
}
// print_r($transportFinalArray); die;
// echo "<pre>";print_r($hotelDataById);die;
if (!empty($hotelDataById)) {
$hotelDataById = $hotelDataById;
// print_r($hotelDataById); die("test this");
} else {
$package_destination_night_detail = (isset($param['package_destination_night_detail']) && $param['package_destination_night_detail'] != '') ? json_decode($param['package_destination_night_detail'], 1) : '';
if (!empty($package_destination_night_detail)) {
$checkInDate = $getcheckIn;
foreach ($package_destination_night_detail as $pkKey => $pkVal) {
$NoofNights = $pkVal['nights'];
$checkOutDate = date('Y-m-d', strtotime($checkInDate . ' + ' . ($NoofNights) . ' days'));
$hotelDataById[] = array(
'destIndex' => $pkKey + 1,
'refId' => @$refId,
'NoofNights' => $pkVal['nights'],
'GTXPkgId' => 121212 + $pkKey,
'DestinationId' => $pkVal['cityId'],
'Destinations' => $pkVal['title'],
'ContSysId' => $pkVal['CountryIds'],
'checkInDate' => $checkInDate,
'checkOutDate' => $checkOutDate,
'isPrice' => 0,
);
$checkInDate = $checkOutDate;
}
}
}
// echo "<pre>";print_r($hotelDataById);die;
$this->view->transportFinalArray = $transportFinalArray;
$this->view->hotellist = $hotelDataById;
$this->view->hotelCategory = $hotelCategory;
$this->view->param = $param;
$this->view->adults = $adults;
$this->view->childs = $childs;
}
}
}
public function getHotelListAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
// echo "<pre>";print_r($param);die;
$NoofNights = 2;
$DestinationsIds = $param['DestinationsId'];
$hotelId = $param['hotelId'];
$Price = $param['Price'];
$adults = 0;
$childs = 0;
$infants = 0;
$roomJsonInfo = array();
for ($i = 0; $i < $param['room']; $i++) {
$adults += $param['Adult'][$i];
$childs += $param['Child'][$i];
$roomJsonInfo[$i]['Adult'] = $param['Adult'][$i];
$roomJsonInfo[$i]['Child'] = $param['Child'][$i];
$roomJsonInfo[$i]['infent'] = 0;
}
$destinationCity = (int) $DestinationsIds;
$adults = (int) $adults;
$child = (int) $childs;
$infent = (int) $infants;
$destIndex = (int) 1;
$checkInDate = $this->getRequest()->getParam('checkInDate');
$checkOutDate = $this->getRequest()->getParam('checkOutDate');
$refId = 'eyJUIjoiMTciLCJEIjp7IjkyIjp7IkRlc0lkIjoiNjU2MSIsIlNlcSI6IjEifX19';
$model = new Travel_Model_HotelMaster();
$hotelData = $model->getHotel($destinationCity, "tb_tbb2c_packages_master", $checkInDate, $checkOutDate, $adults, $child, $infent, $refId, $destIndex, json_encode($roomJsonInfo));
// echo "<pre>";print_r(json_decode(base64_decode($hotelData[0]['checkPlan'])));die;
// echo "<pre>";print_r($hotelData);die;
$this->view->hotellist = $hotelData;
$this->view->hotelId = $hotelId;
$this->view->Price = $Price;
}
}
}
public function getHotelDataByIdAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
// print_r($param); die;
$hotelData = json_decode(base64_decode($param['hotelJson']), 1);
// echo "<pre>";print_r($hotelData);die;
$this->view->hotelData = $hotelData;
$this->view->prehotelId = $param['prehotelId'];
}
}
}
public function saveCustomizeDynamicDataAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
// print_r($param); die;
$package_hotelcategoryid = $param['hotelcategoryid'];
$destinationNameIdArr = $hotelDataArr = array();
$DestinationPlacesArr = array();
$hotelPrice = !empty($param['hotelPrice']) ? $param['hotelPrice'] : 0;
$finalHotelPrice = 0;
foreach ($hotelPrice as $hpKey => $hpVal) {
$finalHotelPrice += (int) $hpVal;
}
$inc = 1;
foreach ($param['Destinations'] as $dKey => $dVal) {
$DestinationPlacesArr[$param['DestinationId'][$dKey]] = $dVal;
for ($n = 0; $n < $param['NoofNights'][$dKey]; $n++) {
$destinationNameIdArr[$inc]['DestinationId'] = $param['DestinationId'][$dKey];
$destinationNameIdArr[$inc]['Destinations'] = $param['Destinations'][$dKey];
$destinationNameIdArr[$inc]['ContSysId'] = isset($param['ContSysId'][0]) ? (int) $param['ContSysId'][0] : 101;
$hotelDataArr[$inc]['hidden_selected_hotel_id'] = $param['hotelId'][$dKey];
$hotelDataArr[$inc]['mealType'] = $param['MEALPLANTYPEE'][$dKey];
$hotelDataArr[$inc]['hotelRoomType'] = $param['ROOMTYPEE'][$dKey];
$hotelDataArr[$inc]['hotelName'] = $param['hotelName'][$dKey];
$hotelDataArr[$inc]['HotelCityId'] = $param['DestinationId'][$dKey];
$hotelDataArr[$inc]['NoofNights'] = $param['NoofNights'][$dKey];
$hotelDataArr[$inc]['FromDate'] = $param['checkInDate'][$dKey];
$hotelDataArr[$inc]['ToDate'] = $param['checkOutDate'][$dKey];
$inc++;
}
}
$destinationNameIdArr[$inc]['DestinationId'] = $param['DestinationPlacesSysId'];
$destinationNameIdArr[$inc]['Destinations'] = $param['DestinationPlaces'];
$destinationNameIdArr[$inc]['ContSysId'] = $param['ContSysId'][0];
//echo "<pre>";print_r($destinationNameIdArr);die('here');
$DestinationPlaces = json_encode($DestinationPlacesArr);
$DestinationID = $param['DestinationPlacesSysId'];
$Destinations = $param['DestinationPlaces'];
$pkgCheckinDate = json_decode($param['date']);
$pkgCheckoutDate = $this->objHelperGeneral->dateAddDays(json_decode($param['date']), array_sum($param['NoofNights']));
$adult = json_decode($param['Adult'], 1);
$child = json_decode($param['Child'], 1);
$roominfojson = [];
for ($i = 0, $k = 1; $k <= 9; $k++, $i++) {
if (trim($adult[$i]) != 0 || trim($child[$i]) != 0) {
$roominfojson[$k]['Adult'] = $adult[$i];
$roominfojson[$k]['Child'] = $child[$i];
$roominfojson[$k]['Infant'] = isset($param['infant'][$i]) ? $param['infant'][$i] : 0;
$noOfAdultsar[$k] = $adult[$i];
$noOfInfantar[$k] = isset($param['infant'][$i]) ? $param['infant'][$i] : 0;
;
if ($adult[$i] == 3) {
$roominfojson[$k]['AdultBedType'] = $param['adult_bed_type'][$i];
}
if ($child[$i] > 0) {
for ($c = 1; $c <= $child[$i]; $c++) {
$roominfojson[$k]['ChildBedType_' . $c] = $param['child' . $c . '_bed_type'][$i];
$roominfojson[$k]['ChildAge_' . $c] = '';
$selectnoOfChildar[$k] = $child[$i];
}
}
}
}
for ($k = 1; $k <= count($roominfojson); $k++) {
$roominfojson[$k]['departuredate'] = $pkgCheckinDate;
$roominfojson[$k]['returndate'] = $pkgCheckoutDate;
}
$dayView = array();
$resultSet = $this->objMdl->rv_select_all('tb_tbb2c_packages_master', ['*'], ['GTXPkgId' => $param['gtxpackage'], 'IsActive' => 1, 'IsMarkForDel' => 0, 'PkgSysId' => $param['pkg']], ['PkgSysId' => 'ASC']);
$LongJsonInfo = json_decode($resultSet[0]['LongJsonInfo'], 1);
foreach ($LongJsonInfo as $itinerariesDayVise) {
$finalArray = array();
foreach ($itinerariesDayVise['Itineraries']['Itinerary'] as $dayViewVal) {
$dayView[$dayViewVal['Day']]['day'] = $dayViewVal['Day'];
$dayView[$dayViewVal['Day']]['Title'] = $dayViewVal['Title'];
$dayView[$dayViewVal['Day']]['Program'] = $dayViewVal['Program'];
$dayView[$dayViewVal['Day']]['CityName'] = $destinationNameIdArr[$dayViewVal['Day']]['Destinations'];
$dayView[$dayViewVal['Day']]['CityId'] = $destinationNameIdArr[$dayViewVal['Day']]['DestinationId'];
$dayView[$dayViewVal['Day']]['ContId'] = $destinationNameIdArr[$dayViewVal['Day']]['ContSysId'];
$dayView[$dayViewVal['Day']]['Sightseeings'] = $dayViewVal['ItineraryItem'][3];
}
foreach ($itinerariesDayVise['Cities']['City'] as $finalData) {
$finalArray['SightSeeings'][] = $finalData['SightSeeings'];
}
}
$finalArraySightDaywise = $finalArraySightTransport = array();
foreach ($dayView as $itKey => $itinerariesItem1) {
$itinerariesItem = $itinerariesItem1['Sightseeings'];
$itinerariesItem = (isset($itineraries['repeat']) && $itineraries['repeat'] == 1) ? $itinerariesItem[0] : $itinerariesItem;
if (!empty($itinerariesItem['Items']['0']['Item'])) {
foreach ($itinerariesItem['Items']['0']['Item'] as $itinerariesActivity) {
if ($itinerariesActivity['IsIncluded'] == 1) {
if ($itinerariesItem['Type'] == 'SIGHTSEEING') {
foreach ($finalArray['SightSeeings'] as $finalSightSeeing => $valfinalSightSeeing) {
if (isset($valfinalSightSeeing['SightSeeing'])) {
foreach ($valfinalSightSeeing['SightSeeing'] as $keySightSeeing => $valSightSeeing) {
if ($itinerariesActivity['Id'] == $valSightSeeing['RefSSId']) {
$finalArraySightDaywise[$itKey]['Title'][] = $valSightSeeing['Title'];
$finalArraySightDaywise[$itKey]['SSSysId'][] = $valSightSeeing['RefSSId'];
$finalArraySightDaywise[$itKey]['CitySysId'][] = $itinerariesItem1['CityId'];
}
}
}
}
}
}
}
}
}
if (isset($param['transportSelectCheck']) && !empty($param['transportSelectCheck'])) {
$transportRouteSysId = $transportRouteVechSysId = array();
foreach ($param['transportSelectCheck'] as $tKey => $tVal) {
$transportSelectCheck = explode('_', $tVal);
$transportRouteSysId[] = $transportSelectCheck[0];
$transportRouteVechSysId[] = $transportSelectCheck[1];
}
$transportRouteSysIdU = implode(',', array_unique($transportRouteSysId));
$where = "AND IsMarkForDel = '0' AND IsActive = 1";
$getResults = $this->objMdl->getAllTransportDetailByIds('tb_transport_route', 'RouteSysId', $transportRouteSysIdU, $where, 'RouteSysId DESC');
// echo "<pre>";print_r($getResults);die;
$finalVehicleCost = 0;
foreach ($getResults as $trKey => $trVal) {
$category = json_decode($trVal['category'], 1);
$cityIncludes = json_decode($trVal['cityIncludes'], 1);
$SSIncludes = json_decode($trVal['SSIncludes'], 1);
foreach ($category as $vKey => $vVal) {
if (in_array($vVal['RouteVechSysId'], $transportRouteVechSysId)) {
$VehicleData[$trKey]['VehicleSysId'] = $vVal['VehicleSysId'];
$VehicleData[$trKey]['vehicleName'] = $vVal['VehName'];
$VehicleData[$trKey]['Cost'] = $vVal['Cost'];
$VehicleData[$trKey]['Capacity'] = $vVal['Capacity'];
$VehicleData[$trKey]['StartCitySysId'] = $trVal['StartCitySysId'];
$VehicleData[$trKey]['EndCitySysId'] = $trVal['EndCitySysId'];
$VehicleData[$trKey]['CityName'] = $trVal['CityName'];
$VehicleData[$trKey]['EndCityName'] = $trVal['EndCityName'];
$VehicleData[$trKey]['VehicleSysId'] = $vVal['VehicleSysId'];
$VehicleData[$trKey]['VehicleTypeSysId'] = $vVal['VehicleTypeSysId'];
$finalVehicleCost += (int) $vVal['Cost'] * $param['noofVehicles'][$trVal['RouteSysId'] . '_' . $vVal['RouteVechSysId']];
}
}
$finalVehicleCost = Catabatic_Helper::calculateMarkup($finalVehicleCost);
$dayi = 1;
foreach ($cityIncludes as $incKey => $incVal) {
for ($ni = 1; $ni <= $incVal['nights']; $ni++) {
$checkDsightseeingArr = array();
foreach ($SSIncludes[$incVal['destSequence']] as $ssKey => $ssVal) {
foreach ($ssVal as $ssKey1 => $ssVal1) {
if ($ni == $ssVal1['SSDaySequence']) {
if (!in_array($ssVal1['SSSysId'], $checkDsightseeingArr)) {
$finalArraySightTransport[$dayi]['Title'][] = $ssVal1['SightSeeingName'];
$finalArraySightTransport[$dayi]['SSSysId'][] = $ssVal1['SSSysId'];
$finalArraySightTransport[$dayi]['CitySysId'][] = $ssVal1['DestSysId'];
$checkDsightseeingArr[] = $ssVal1['SSSysId'];
}
}
}
}
$dayi++;
}
}
}
}
for ($ss = 1; $ss < count($dayView); $ss++) {
$checkFinalsightseeingArr = array();
foreach ($finalArraySightDaywise[$ss]['SSSysId'] as $ssdKey => $ssdVal) {
if (!in_array($ssdVal, $checkFinalsightseeingArr)) {
$finalArraySight[$ss]['Title'][] = $finalArraySightDaywise[$ss]['Title'][$ssdKey];
$finalArraySight[$ss]['SSSysId'][] = $ssdVal;
$finalArraySight[$ss]['CitySysId'][] = $finalArraySightDaywise[$ss]['CitySysId'][$ssdKey];
$checkFinalsightseeingArr[] = $ssdVal;
}
}
foreach ($finalArraySightTransport[$ss]['SSSysId'] as $sstKey => $sstVal) {
if (!in_array($sstVal, $checkFinalsightseeingArr)) {
$finalArraySight[$ss]['Title'][] = $finalArraySightTransport[$ss]['Title'][$sstKey];
$finalArraySight[$ss]['SSSysId'][] = $sstVal;
$finalArraySight[$ss]['CitySysId'][] = $finalArraySightTransport[$ss]['CitySysId'][$sstKey];
$checkFinalsightseeingArr[] = $sstVal;
}
}
}
$TncData = [
'Inclusions' => isset($LongJsonInfo['package']['Terms']['Inclusion']) ? $LongJsonInfo['package']['Terms']['Inclusion'] : 'Inclusion',
'Exclusions' => isset($LongJsonInfo['package']['Terms']['Exclusions']) ? $LongJsonInfo['package']['Terms']['Exclusions'] : 'Exclusions',
'TermsAndConditions' => isset($LongJsonInfo['package']['Terms']['Conditions']) ? $LongJsonInfo['package']['Terms']['Conditions'] : 'Term & Conditions',
'TravelBasics' => isset($LongJsonInfo['package']['Terms']['TravelBasics']) ? $LongJsonInfo['package']['Terms']['TravelBasics'] : 'Travel Basics',
'BookingTerms' => isset($LongJsonInfo['package']['Terms']['BookingTerms']) ? $LongJsonInfo['package']['Terms']['BookingTerms'] : 'Booking Terms',
'WhyUseUs' => isset($LongJsonInfo['package']['Terms']['WhyUseUs']) ? $LongJsonInfo['package']['Terms']['WhyUseUs'] : 'Why Use Us',
'CancellationPolicy' => isset($LongJsonInfo['package']['Terms']['CancellationPolicy']) ? $LongJsonInfo['package']['Terms']['CancellationPolicy'] : 'Cancellation Policy',
];
$Markup = (isset($_SESSION['User']['data']['Markup']) && trim($_SESSION['User']['data']['Markup']) != '') ? trim($_SESSION['User']['data']['Markup']) : $this->markup;
$finalHotelPriceMarkup = $finalHotelPrice * ($Markup / 100);
$MarkuponMarkup = $finalHotelPriceMarkup * ($Markup / 100);
$finalHotelPrice = (int) ($finalHotelPrice - $finalHotelPriceMarkup + $MarkuponMarkup);
$apiData = [];
$apiData['packid'] = $param['pkg'];
$apiData['TravelPlanId'] = $param['gtxpackage'];
$apiData['minpax'] = 2;
$apiData['catID'] = $package_hotelcategoryid;
$apiData['FirstName'] = trim($_SESSION['User']['data']['FirstName']) . ' ' . trim($_SESSION['User']['data']['LastName']);
$apiData['TotalNights'] = array_sum($param['NoofNights']);
$apiData['DestinationPlaces'] = $DestinationPlaces; // 'eyI3NzAxIjoiRGVsaGkiLCIxMDU3NiI6IkdvYSJ9';
$apiData['search_going_to'] = $DestinationID . '__' . $Destinations; // '7701__Delhi';
$apiData['cityIds'] = $DestinationID;
$apiData['Destinations'] = $Destinations;
$apiData['pkgCheckInDate'] = $pkgCheckinDate;
$apiData['pkgCheckOutDate'] = $pkgCheckoutDate;
$apiData['tripstartdate'] = $pkgCheckinDate;
$apiData['custemail'] = trim($_SESSION['User']['data']['EmailId']);
$apiData['custname'] = trim($_SESSION['User']['data']['FirstName']) . ' ' . trim($_SESSION['User']['data']['LastName']);
$apiData['custphone'] = trim($_SESSION['User']['data']['ContactNo1']);
$apiData['tripaddress'] = explode(',', $param['Destinations']);
$apiData['aboutpackage'] = '';
$apiData['pricetype'] = 'wp';
$apiData['AgencySysId'] = $this->gtxagencysysid;
$apiData['AgentSysId'] = $this->gtxagentsysid;
$apiData['Email'] = $_SESSION['User']['data']['EmailId'];
$apiData['MobileNumber'] = $_SESSION['User']['data']['ContactNo1'];
$apiData['leadsource'] = 'Website';
$apiData['mealplantype'] = 0;
$apiData['selectedCustomerId'] = base64_encode($_SESSION['User']['data']['CustomerSysId']);
$apiData['aId'] = $_SESSION['User']['data']['UserSysId'];
$apiData['IsB2BCustomer'] = 1;
$apiData['IsB2BAgent'] = 1;
$apiData['roomjson'] = json_encode($roominfojson);
$apiData['dayView'] = json_encode($dayView);
$apiData['hotelData'] = json_encode(array(1 => $hotelDataArr));
$apiData['TncData'] = json_encode($TncData);
$apiData['finalArraySight'] = json_encode($finalArraySight);
$apiData['VehicleData'] = json_encode($VehicleData);
$apiData['finalHotelPrice'] = $finalHotelPrice;
$apiData['finalVehicleCost'] = $finalVehicleCost;
$apiData['totalPrice'] = json_encode(array(1 => ((int) $finalHotelPrice + (int) $finalVehicleCost)));
$apiData['MarkupType'] = (isset($_SESSION['User']['data']['MarkupType']) && trim($_SESSION['User']['data']['MarkupType']) != '') ? trim($_SESSION['User']['data']['MarkupType']) : $this->markupType;
$apiData['Markup'] = (isset($_SESSION['User']['data']['Markup']) && trim($_SESSION['User']['data']['Markup']) != '') ? trim($_SESSION['User']['data']['Markup']) : $this->markup;
$apiData['extraMarkUp'] = (isset($param['extraMarkUp']) && trim($param['extraMarkUp']) != '') ? json_encode(array(1 => $param['extraMarkUp'])) : 0;
//echo "<pre>";print_r($apiData);die('here1');
try {
$model = new Gtxwebservices_Model_Webservices();
$responce = $model->sendCustomizeDynamicPackage($apiData);
// echo "<pre>";print_r($responce);die('here1');
} catch (Zend_Exception $error) {
echo $message_err = $error->getMessage();
$status = false;
}
echo "<pre>";
print_r($responce);
die('here');
}
}
}
public function getHotelDetailAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
$hotelId = $param['hotelId'];
$type = $param['type'];
$categoryId = $param['categoryId'];
$packageId = $param['packageId'];
$gtxID = $param['gtxID'];
$model = new Detail_Model_PackageMapper();
$HotelMaster = new Travel_Model_HotelMaster();
if ($type == 'H') {
$getDetail = $HotelMaster->getHotelDetailByHotelIds('tb_tbb2c_packages_master', $hotelId);
// $getDetail = $model->fetchHotelDetails($categoryId, $gtxID, $packageId, $hotelId);
} else if ($type == 'A') {
$getDetail = $model->fetchActivityDetails($categoryId, $gtxID, $packageId, $hotelId);
} else {
$getDetail = $model->fetchSightSeeingDetails($categoryId, $gtxID, $packageId, $hotelId);
}
// echo"<pre>";print_r($getDetail);die('ss');
$this->view->type = $type;
$this->view->hotelData = $getDetail;
$this->view->baseUrl = $this->baseUrl;
}
}
}
public function getHotelDetailOnclickAction() {
$this->_helper->layout()->disableLayout();
// if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
$hotelId = $param['hotelId'];
$type = $param['type'];
$categoryId = $param['categoryId'];
$packageId = $param['packageId'];
$HotelMaster = new Travel_Model_HotelMaster();
if ($type == 'h') {
$getDetail = $HotelMaster->getHotelDetailByHotelIds('tb_tbb2c_packages_master', $hotelId);
}
// echo"<pre>";print_r($getDetail);die('ss');
$this->view->type = $type;
$this->view->hotelData = $getDetail;
$this->view->param = $param;
$this->view->baseUrl = $this->baseUrl;
}
//}
}
public function getTransferDetailOnclickAction() {
$this->_helper->layout()->disableLayout();
// if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
$RouteVechSysId = $param['RouteVechSysId'];
$RouteSysId = $param['RouteSysId'];
$type = $param['type'];
$categoryId = $param['categoryId'];
$packageId = $param['packageId'];
$model = new Detail_Model_PackageMapper();
if ($type == 'car') {
$getDetail = $model->fetchTransfersDetailsByRouteSysID($RouteSysId);
$TransferDataArray = array();
foreach ($getDetail as $tKey => $tValue) {
$categoryJsonInfo = json_decode($tValue['category'], 1);
$area = json_decode($tValue['Area'], 1);
$TransportCategory = json_decode($tValue['TransportCategory'], 1);
foreach ($categoryJsonInfo as $VehicleData) {
if ($RouteVechSysId == $VehicleData['RouteVechSysId']) {
$TransferDataArray[$tValue['RouteSysId']] = array(
'RouteSysId' => $tValue['RouteSysId'],
'RouteVechSysId' => $VehicleData['RouteVechSysId'],
'city' => $tValue['CityName'],
'Cost' => $VehicleData['Cost'],
'Capacity' => $VehicleData['Capacity'],
'VehName' => $VehicleData['VehName'],
'VehicleTypeName' => $VehicleData['VehicleTypeName'],
'CurrencySymbol' => $VehicleData['CurrencySymbol'],
'Description' => $tValue['Description'],
'pickupAreaId' => $area['0']['pickupAreaId'],
'dropAreaId' => $area['0']['dropAreaId'],
'PickUPLocation' => $area['0']['PickUPLocation'],
'DropLocation' => $area['0']['DropLocation'],
'SubCategory' => $TransportCategory['SubCategory'],
);
}
}
}
}
// echo"<pre>";print_r($TransferDataArray);die('ss');
$this->view->type = $type;
$this->view->transferData = $TransferDataArray;
$this->view->param = $param;
$this->view->baseUrl = $this->baseUrl;
}
//}
}
public function getOptionalHotelAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
$day = $param['day'];
$categoryId = $param['categoryId'];
$packageId = $param['packageId'];
$gtxID = $param['gtxID'];
$model = new Detail_Model_PackageMapper();
$getDetail = $model->fetchDayWiseHotelDetails($categoryId, $gtxID, $packageId, $day);
// if($type == 'H'){
// $getDetail = $model->fetchHotelDetails($categoryId, $gtxID, $packageId,$hotelId);
// } else if($type == 'A') {
// $getDetail = $model->fetchActivityDetails($categoryId, $gtxID, $packageId,$hotelId);
// } else {
// $getDetail = $model->fetchSightSeeingDetails($categoryId, $gtxID, $packageId,$hotelId);
// }
$this->view->hotelData = $getDetail;
}
}
}
// get all the other options available for hotel per itinerary
public function changeOptionsAction() {
// error_reporting(E_ALL);
$this->_helper->layout()->disableLayout();
$getDetail = [];
$message = '';
if ($this->getRequest()->getMethod() === 'GET') {
$sessionPackageSearchParams = new Zend_Session_Namespace('sessionPackageSearchParams');
$sessionPackageSearch = $sessionPackageSearchParams->params;
$param = $this->getRequest()->getParams();
// echo"<pre>";print_r($param);die('pp');
$checkInDate = isset($sessionPackageSearch['boarding_date']) ? $sessionPackageSearch['boarding_date'] : date('d/m/Y');
$destinationCity = (isset($param['destinationId'])) ? $param['destinationId'] : '';
$day = (isset($param['day'])) ? $param['day'] : 0;
$categoryid = (isset($param['categoryid'])) ? $param['categoryid'] : 1;
$packageid = (isset($param['packageid'])) ? $param['packageid'] : 0;
$gtxid = (isset($param['gtxid'])) ? $param['gtxid'] : 0;
$hotelId = (isset($param['hotelId'])) ? $param['hotelId'] : 0;
$type = (isset($param['type'])) ? $param['type'] : '';
$tourtype = (isset($param['tourtype'])) ? $param['tourtype'] : 0;
$itinerary = (isset($param['itinerary'])) ? $param['itinerary'] : 0;
$sid = (isset($param['sid']) && !empty($param['sid'])) ? $param['sid'] : 0;
$group = (isset($param['group']) && !empty($param['group'])) ? $param['group'] : '';
$countit = (isset($param['countit']) && !empty($param['countit'])) ? $param['countit'] : 1;
$myaction = (isset($param['myaction']) && !empty($param['myaction'])) ? $param['myaction'] : ' ';
$mp = (isset($param['mp'])) ? $param['mp'] : 0;
$priceSort = (isset($param['sortbyprice'])) ? $param['sortbyprice'] : 1;
// echo"<pre>";print_r($param);die('ddd');
$checkInDate1 = str_replace('/', '-', $checkInDate);
$datecheckin = date('Y-m-d', strtotime('+' . $day - 1 . 'day', strtotime($checkInDate1)));
$checkOutDate = date('Y-m-d', strtotime('+' . $countit . 'day', strtotime($datecheckin)));
$adults = isset($sessionPackageSearch['totadlt']) ? $sessionPackageSearch['totadlt'] : '2';
$child = isset($sessionPackageSearch['totchld']) ? $sessionPackageSearch['totchld'] : '0';
$infent = '0';
$TotalPax = $adults + $child + $infent;
$refId = '';
$destIndex = (int) 1;
$roomJsonInfo = isset($sessionPackageSearch['roominfojson']) ? $sessionPackageSearch['roominfojson'] : '';
$markupDetailsArray = [];
$RouteSysId = $param['RouteSysId'];
$resultData = $includedItemPriceArray = $markupDetialsArray = [];
$itemName = '';
if (strtolower($type) === 'h' || strtolower($type) === 'r') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->getHotel($destinationCity, "tb_tbb2c_packages_master", $datecheckin, $checkOutDate, $adults, $child, $infent, $refId, $destIndex, json_encode($roomJsonInfo), '', $markupDetailsArray, '', '', $gtxid, $priceSort, $day, $categoryid);
$itemName = 'hotel';
} else if (strtolower($type) === 'a') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchDayWiseOptionsDetails($categoryid, $gtxid, $packageid, $day, $sid, 'a');
$itemName = 'activity';
} else if (strtolower($type) === 's') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchDayWiseOptionsDetails($categoryid, $gtxid, $packageid, $day, $sid, 's');
$itemName = 'sightSeeing';
} else if (strtolower($type) === 'car') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchTransfersDetailsByRouteSysID($RouteSysId, $gtxid, $day);
$itemName = 'transfers';
} else if (strtolower($type) === 'cc') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchPackageCateogies($packageid, $gtxid);
}
$masterDataArray = $this->objHelperGeneral->getMasterData($packageid, $type);
$markupDetialsArray = $this->objHelperGeneral->getMarkupDetailsArray($packageid, $tourtype, $categoryid);
if (strtolower($type) !== 'cc') {
$PSESS = $this->_storage->packageSession; // get the session values
if ($this->objHelperGeneral->checksession((int) $packageid, $tourtype, $categoryid)) {
$tempArr = [];
$IsIncluded = false;
if (strtolower($type) === 'h' || strtolower($type) === 'r') {
$IsIncluded2 = array();
$defaultAccomSysId = $defaultRoomType = $defaultMealPlanType = 0;
foreach ($PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName] as $itemkey => $itemval) {
$IsIncluded2[$itemval['AccomSysId']] = $itemval['IsIncluded']; // check the session here
if ($itemval['IsIncluded'] == 1) {
$defaultAccomSysId = $itemval['AccomSysId'];
$defaultRoomType = $itemval['RoomType'];
$defaultMealPlanType = $itemval['MealPlanType'];
}
}
$includedItemPriceArray[$type] = 0;
// echo"<pre>";print_r($resultData);die('dd');
foreach ($resultData as $key => $value) {
$checkPlan = json_decode(base64_decode($value['checkPlan']), 1);
if ($defaultAccomSysId == $value['GTXPkgId']) {
$defaultRoomTypeD = $defaultRoomType;
$defaultMealPlanTypeD = $defaultMealPlanType;
} else {
$defaultRoomTypeD = $value['defaultRoomType'];
$defaultMealPlanTypeD = $value['defaultMealPlanType'];
}
// echo"<pre>";print_r($resultData);die('dd');
$myPrice = ($value['Price'] + $value['Markup']) * $value['totalNight'] / $TotalPax;
if ($defaultAccomSysId == $value['GTXPkgId'] && !empty($checkPlan['category']['SUB'][$defaultRoomType][$defaultMealPlanType]['Price'])) {
$Price = $checkPlan['category']['SUB'][$defaultRoomType][$defaultMealPlanType]['Price'] * $value['totalNight'] / $TotalPax;
$Markup = $checkPlan['category']['SUB'][$defaultRoomType][$defaultMealPlanType]['Markup'] * $value['totalNight'] / $TotalPax;
$myPrice = $includedItemPriceArray[$type] = $Price + $Markup;
// echo"<pre>";print_r($value);die('dd');
}
$tempArr[] = [
'GTXPkgId' => $value['GTXPkgId'],
'DestinationId' => $value['DestinationId'],
'Destinations' => $value['Destinations'],
'Title' => $value['Title'],
'Details' => $value['Details'],
'Stars' => @$value['Stars'],
'ThumnailImg' => @$value['ThumnailImg'],
'DetailImg' => @$value['DetailImg'],
'IsIncluded' => ($IsIncluded2[$value['GTXPkgId']] == 1) ? 1 : $IsIncluded2[$value['GTXPkgId']],
'CheckinTime' => $value['CheckinTime'],
'Area' => $value['Area'],
'Price' => $myPrice,
'RoomType' => ($checkPlan['category']['SUB'][$defaultRoomTypeD][$defaultMealPlanTypeD]['ETitle']) ? $checkPlan['category']['SUB'][$defaultRoomTypeD][$defaultMealPlanTypeD]['ETitle'] : "",
'MealPlanType' => ($checkPlan['category']['SUB'][$defaultRoomTypeD][$defaultMealPlanTypeD]['Title']) ? $checkPlan['category']['SUB'][$defaultRoomTypeD][$defaultMealPlanTypeD]['Title'] : "",
'RoomTypeId' => $defaultRoomTypeD,
'MealPlanTypeId' => $defaultMealPlanTypeD,
'SupplierSysId' => isset($checkPlan['category']['SUB'][$defaultRoomTypeD][$defaultMealPlanTypeD]['priceVal'][0]['SSID']) ? $checkPlan['category']['SUB'][$defaultRoomTypeD][$defaultMealPlanTypeD]['priceVal'][0]['SSID'] : 0,
'defaultRoomType' => $defaultRoomType,
'defaultMealPlanType' => $defaultMealPlanType,
];
}
$resultData = [['itemArray']['0'] => $tempArr, 'finalArray' => $resultData, 'mainPrice' => $mainPrice, 'mainmarkup' => $mainmarkup];
} else {
if (!empty($resultData) && count($resultData)) {
$IsIncluded = false;
if (strtolower($type) === 'car') {
$IsIncluded2 = array();
foreach ($PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName] as $itemkey => $itemval) {
// echo"<pre>";print_r($PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName]);die('dd');
$IsIncluded2[$itemval['itemid']] = $itemval['IsIncluded']; // check the session here
if (!empty($itemval['RouteSysId']) && $itemval['IsIncluded'] == 1) {
$defaulltRouteVechSysId = $itemval['RouteVechSysId'];
}
}
foreach ($resultData as $key => $value) {
$category = $value['category'];
$dataArray = Zend_Json::decode($category);
// echo"<pre>";print_r($defaulltRouteVechSysId);
// echo"<pre>";print_r($dataArray);die;
foreach ($dataArray as $findprice) {
if ($defaulltRouteVechSysId == $findprice['RouteVechSysId'] && !empty($findprice['Cost'])) {
$Price = $findprice['Cost'];
$myPrice = $includedItemPriceArray[$type] = $Price;
}
}
$area = json_decode($value['Area'], 1);
$TransportSubType = end(explode(',', $value['TransportSubType']));
$TransportCategory = end(json_decode($value['TransportCategory'], 1));
$tempArr = [
'RouteSysId' => $value['RouteSysId'],
'RouteName' => $value['RouteName'],
'Noofnights' => $value['Noofnights'],
'CityName' => $value['CityName'],
'EndCityName' => $value['EndCityName'],
'cost' => $myPrice,
'category' => @$dataArray,
'pickupAreaId' => $area['0']['pickupAreaId'],
'dropAreaId' => $area['0']['dropAreaId'],
'PickUPLocation' => $area['0']['PickUPLocation'],
'DropLocation' => $area['0']['DropLocation'],
'TransportSubType' => $TransportSubType,
'SubCategory' => $TransportCategory[array_key_last($TransportCategory)],
];
}
$resultData = [['itemArray']['0'] => $tempArr, 'finalArray' => $resultData];
} else {
if (!empty($resultData['itemArray'][0]) && count($resultData['itemArray'][0]) && ($resultData['itemArray'][0])) {
if (strtolower($type) === 's') {
$IsIncluded2 = array();
foreach ($PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName] as $itemkey => $itemval) {
$IsIncluded2[$itemval['itemid']] = $itemval['IsIncluded']; // check the session here
}
foreach ($resultData['itemArray'] as $key => $value) {
// echo"<pre>";print_r($value);die('ss');
// $myPrice = ($value['Price'] + $value['Markup']) * $value['totalNight'] / $TotalPax;
if ($IsIncluded2[$itemval['itemid']]) {
$itemid = $value['Id']; // get recent updated item id
foreach ($resultData['finalArray']['0']['SightSeeing'] as $finval) {
if ($itemid == $finval['RefSSId']) {
$includedItemPriceArray[$type] = $finval['priceaditionals']['adultCost'] * $adults + $finval['priceaditionals']['kidsCost'] * $child;
}
}
}
$tempArr[] = ['Id' => $value['Id'], 'PriceType' => $value['PriceType'], 'IsIncluded' => ($IsIncluded2[$value['Id']] == 1) ? 1 : 0];
}
} else {
foreach ($resultData['itemArray'][0] as $key => $value) {
$IsIncluded = $PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName][$key]['IsIncluded']; // check the session here
if ($IsIncluded) {
$itemid = $value['Id']; // get recent updated item id
}
$tempArr[] = ['Id' => $value['Id'], 'MasterIntSysId' => $value['MasterIntSysId'], 'IsIncluded' => ($IsIncluded) ? true : false];
}
}
$resultData['itemArray'][0] = $tempArr;
} else if (!empty($resultData['itemArray'][1]) && count($resultData['itemArray'][1])) {
foreach ($resultData['itemArray'][1] as $key => $value) {
$IsIncluded = $PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName][$key]['IsIncluded']; // check the session here
if ($IsIncluded) {
$itemid = $value['Id']; // get recent updated item id
}
$tempArr[] = ['Id' => $value['Id'], 'MasterIntSysId' => $value['MasterIntSysId'], 'IsIncluded' => ($IsIncluded) ? true : false];
}
$resultData['itemArray'][1] = $tempArr;
}
}
}
}
}
}
foreach ($this->_storage->packageSession[$packageid][$tourtype][$categoryid]['Price']['hotel'] as $hotelprice) {
$hotel_price += $hotelprice;
}
foreach ($this->_storage->packageSession[$packageid][$tourtype][$categoryid]['Price']['transfers'][$day] as $transferprice) {
$transfer_price += $transferprice;
}
foreach ($this->_storage->packageSession[$packageid][$tourtype][$categoryid]['Price']['sightSeeing'][$day] as $sightSeeingprice) {
$sightseeing_price += $sightSeeingprice;
}
foreach ($this->_storage->packageSession[$packageid][$tourtype][$categoryid]['Markup']['hotel'] as $hotelmarkup) {
$hotel_markup += $hotelmarkup;
}
// echo"<pre>";print_r($hotel_price + $transfer_price + $sightseeing_price + $hotel_markup);die('ss');
$status = true;
} else {
$status = false;
$message = 'Invalid request!';
}
// echo '<pre>'; print_r($resultData);
// echo '<pre>ccc'; print_r($includedItemPriceArray); die;
$this->view->status = $status;
$this->view->datecheckin = $datecheckin;
$this->view->checkOutDate = $checkOutDate;
$this->view->message = $message;
$this->view->resultData = $resultData;
$this->view->param = $param;
$this->view->adults = $adults;
$this->view->child = $child;
$this->view->sessionPrice = $hotel_price + $transfer_price + $sightseeing_price + $hotel_markup / $TotalPax;
$this->view->markupDetialsArray = $markupDetialsArray;
//$this->view->itemPriceArray = $itemPriceArray;
$this->view->includedItemPriceArray = $includedItemPriceArray;
$this->view->baseUrl = $this->baseUrl;
$this->view->mealplantype = $mp;
}
public function changeOptionsCustomizeAction() {
$this->_helper->layout()->disableLayout();
$getDetail = [];
$message = '';
if ($this->getRequest()->getMethod() === 'POST') {
$param = $this->getRequest()->getParams();
// echo '<pre>'; print_r($param); die;
$day = (isset($param['day'])) ? $param['day'] : 0;
$categoryid = (isset($param['categoryid'])) ? $param['categoryid'] : 1;
$packageid = (isset($param['packageid'])) ? $param['packageid'] : 0;
$gtxid = (isset($param['gtxid'])) ? $param['gtxid'] : 0;
$type = (isset($param['type'])) ? $param['type'] : '';
$tourtype = (isset($param['tourtype'])) ? $param['tourtype'] : 0;
$itinerary = (isset($param['itinerary'])) ? $param['itinerary'] : 0;
$sid = (isset($param['sid']) && !empty($param['sid'])) ? $param['sid'] : 0;
$group = (isset($param['group']) && !empty($param['group'])) ? $param['group'] : '';
$countit = (isset($param['countit']) && !empty($param['countit'])) ? $param['countit'] : 1;
$mp = (isset($param['mp'])) ? $param['mp'] : 0;
$resultData = $includedItemPriceArray = $markupDetialsArray = [];
$itemName = '';
// check the change options
if (strtolower($type) === 'h') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchDayWiseOptionsDetails($categoryid, $gtxid, $packageid, $day, $sid, 'h');
$itemName = 'hotel';
} else if (strtolower($type) === 'a') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchDayWiseOptionsDetails($categoryid, $gtxid, $packageid, $day, $sid, 'a');
$itemName = 'activity';
} else if (strtolower($type) === 's') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchDayWiseOptionsDetails($categoryid, $gtxid, $packageid, $day, $sid, 's');
$itemName = 'sightSeeing';
} else if (strtolower($type) === 'car') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchTransfersDetails($packageid, $gtxid, $tourtype);
$itemName = 'transfers';
} else if (strtolower($type) === 'cc') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchPackageCateogies($packageid, $gtxid);
// $itemName = 'transfers';
}
// $type = 'hotel';
$masterDataArray = $this->objHelperGeneral->getMasterData($packageid, $type);
$markupDetialsArray = $this->objHelperGeneral->getMarkupDetailsArray($packageid, $tourtype, $categoryid);
// $masterDataArray1 = $this->objHelperGeneral->getPackagePriceArray( $packageid );
// $this->getPackageMasterData( $packageid );
// $this->objHelperGeneral->getPackageJSONDataArray( $packageid );
// echo '<pre>'; print_r( $markupDetialsArray ); die;
//echo $includedItemPriceArray; die;
// echo '<pre>'; print_r($resultData); die;
// check for the option type | only if not the category chage popup
if (strtolower($type) !== 'cc') {
if ($this->objHelperGeneral->checksession((int) $packageid, $tourtype, $categoryid)) {
if (count($resultData['itemArray'])) {
$PSESS = $this->_storage->packageSession; // get the session values
$tempArr = [];
$IsIncluded = false;
if (strtolower($type) === 'car') {
foreach ($resultData['itemArray'][0] as $key => $value) {
// echo '<pre>'; print_r( $resultData['itemArray'][0] ); die;
$IsIncluded = $PSESS[$packageid][$tourtype][$categoryid]['others'][$itemName][$key]['IsIncluded']; // check the session here
if ($IsIncluded) {
$itemid = $value['fixTransSysId']; // get recent updated item id
}
$tempArr[] = [
'fixTransSysId' => $value['fixTransSysId'],
'vehSysId' => $value['vehSysId'],
'cityCovered' => $value['cityCovered'],
'capacity' => $value['capacity'],
'costPerson' => $value['costPerson'],
'routeName' => @$value['routeName'],
'vehicleName' => @$value['vehicleName'],
// 'IsIncluded'=> ($IsIncluded) ? true : false
'IsIncluded' => ($value['IsIncluded']) ? true : false
];
}
$resultData['itemArray'][0] = $tempArr;
//echo $itemid;die;
} else {
//echo $packageid , $tourtype , $categoryid ; die;
// echo count($resultData['itemArray'][0]);
if (count($resultData['itemArray'][0]) && ($resultData['itemArray'][0])) {
// echo '<pre>'; print_r( $resultData['itemArray'][0] ); die;
foreach ($resultData['itemArray'][0] as $key => $value) {
$IsIncluded = $PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName][$key]['IsIncluded']; // check the session here
if ($IsIncluded) {
$itemid = $value['Id']; // get recent updated item id
}
$tempArr[] = ['Id' => $value['Id'], 'MasterIntSysId' => $value['MasterIntSysId'], 'IsIncluded' => ($IsIncluded) ? true : false];
}
$resultData['itemArray'][0] = $tempArr;
} else if (count($resultData['itemArray'][1])) {
foreach ($resultData['itemArray'][1] as $key => $value) {
$IsIncluded = $PSESS[$packageid][$tourtype][$categoryid]['itineraries'][$itinerary][$itemName][$key]['IsIncluded']; // check the session here
if ($IsIncluded) {
$itemid = $value['Id']; // get recent updated item id
}
$tempArr[] = ['Id' => $value['Id'], 'MasterIntSysId' => $value['MasterIntSysId'], 'IsIncluded' => ($IsIncluded) ? true : false];
}
$resultData['itemArray'][1] = $tempArr;
}
}
}
}
}
// echo '<pre>'; print_r($resultData['itemArray']); die;
// echo $itemid ;
if ((strtolower($type) === 'h') || (strtolower($type) === 'car')) {
if (isset($itemid)) {
$itemprice = $this->objHelperGeneral->getSelectedItemRate($itemid, $masterDataArray, $type); // get included item price
$includedItemPriceArray[$type] = $itemprice;
}
}
// echo '<pre>'; print_r($masterDataArray); die;
$status = true;
} else {
$status = false;
$message = 'Invalid request!';
}
// echo '<pre>'; print_r($resultData); die;
// echo '<pre>'; var_dump($resultData);
$this->view->status = $status;
$this->view->message = $message;
$this->view->resultData = $resultData;
$this->view->param = $param;
$this->view->sessionPrice = $this->_storage->packageSession[$packageid][$tourtype][$categoryid]['others']['price']; //
$this->view->markupDetialsArray = $markupDetialsArray;
// $this->view->itemPriceArray = $itemPriceArray;
$this->view->includedItemPriceArray = $includedItemPriceArray;
$this->view->baseUrl = $this->baseUrl;
$this->view->mealplantype = $mp;
}
// view all the other options available in modal popup
public function viewOptionsAction() {
$this->_helper->layout()->disableLayout();
$getDetail = [];
$message = '';
if ($this->getRequest()->getMethod() === 'GET') {
$param = $this->getRequest()->getParams();
// var_dump($this->PSESS->packageid); die;
// echo '<pre>'; print_r($param); die;
$day = (isset($param['day'])) ? $param['day'] : '';
$categoryid = (isset($param['categoryid'])) ? $param['categoryid'] : '';
$packageid = $param['packageid'];
$gtxid = $param['gtxid'];
$type = $param['type'];
$tourtype = (isset($param['tourtype'])) ? $param['tourtype'] : 0;
$itinerary = (isset($param['itinerary'])) ? $param['itinerary'] : 0;
$sid = (isset($param['sid']) && !empty($param['sid'])) ? $param['sid'] : 0;
$markupDetialsArray = [];
$markupDetialsArray = $this->objHelperGeneral->getMarkupDetailsArray($packageid, $tourtype, $categoryid);
// view all options available to add into services tab
if ($type == 'services') {
$getDetail = $this->objMdl->rv_select_row($this->tablename, ['LongJsonInfo'], ['PkgSysId' => $packageid, 'GTXPkgId' => $gtxid, 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1], ['PkgSysId' => 'DESC']);
if ($getDetail['LongJsonInfo']) {
$LongJsonInfo = $getDetail['LongJsonInfo'];
$dataArray = Zend_Json::decode($LongJsonInfo);
$resultData = $dataArray['package']['OtherServices'];
} else {
$resultData = [];
}
} else {
$getDetail = $this->objMdl->rv_select_row($this->tablename, ['LongJsonInfo'], ['PkgSysId' => $packageid, 'GTXPkgId' => $gtxid, 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1], ['PkgSysId' => 'DESC']);
if ($getDetail['LongJsonInfo']) {
$LongJsonInfo = $getDetail['LongJsonInfo'];
$dataArray = Zend_Json::decode($LongJsonInfo);
$transferMaster = $dataArray['package']['Transfers'];
// get transport itinerarys
$getTransportDetails = $this->getTransportDetails($packageid, $gtxid, strtolower($type));
// echo '<pre>'; print_r($transferMaster); die('here');
$resultData = [];
foreach ($getTransportDetails as $k => $v) {
$innerArr = $masterTemp = [];
foreach ($v['FinalArray'] as $key => $value) {
// echo '<pre>'; print_r($value); die;
$tempArr = [];
foreach ($value as $keyInner => $valueInner) {
// print_r($valueInner['itemid']);
// $innerArr[] = [ 'Day'=>$v['Day'] , 'FromPlace'=> $value['FromPlace'], 'ToPlace'=> $value['ToPlace'], 'CostPerson'=> $value['CostPerson'] ];
$masterTemp = $this->objHelperGeneral->filterArrayByValueKeyPair(['fixTransSysId', $valueInner['itemid']], $transferMaster);
// $masterTemp = $this->objHelperGeneral->filterArrayByValueKeyPair( ['Id', $valueInner['itemid'] ] , $transferMaster );1
// echo '<pre>'; print_r($masterTemp);
// $tempArr[] = $masterTemp[0];
// $masterTemp[0];
$tempArr[] = [
'Day' => $v['Day'],
'FromPlace' => $masterTemp[0]['fromPlace'],
'ToPlace' => $masterTemp[0]['toPlace'],
'CostPerson' => $masterTemp[0]['costPerson']
];
}
// echo '<pre>'; print_r($tempArr);
$innerArr[] = $tempArr;
// $innerArr[] = [ 'Day'=>$v['Day'] , 'FromPlace'=> $value['FromPlace'], 'ToPlace'=> $value['ToPlace'], 'CostPerson'=> $value['CostPerson'] ];
}
// $resultData[] = $innerArr;
$resultData[] = ['Day' => $v['Day'], 'FinalArray' => $innerArr];
}
// echo '<pre>'; print_r($resultData); die;
// $resultData = $dataArray['package']['Transfers'];
} else {
$resultData = [];
}
// echo '<pre>'; print_r($resultData); die;
}
$status = true;
// echo '<pre>'; print_r($resultData); die;
// echo '<pre>'; print_r($this->_storage->packageSession[$packageid][$tourtype][$categoryid]['others']['services']);
if ($this->objHelperGeneral->checksession((int) $packageid, $tourtype, $categoryid)) {
if (count($resultData)) {
$PSESS = $this->_storage->packageSession; // get the session values
$tempArr = [];
$IsIncluded = false;
if (strtolower($type) === 'services') {
foreach ($resultData as $key => $value) {
$IsIncluded = $PSESS[$packageid][$tourtype][$categoryid]['others']['services'][$key]['IsIncluded']; // check the session here
$IsIncludedNew = isset($PSESS[$packageid][$tourtype][$categoryid]['others']['services'][$key]['IsIncludedNew']) ? $PSESS[$packageid][$tourtype][$categoryid]['others']['services'][$key]['IsIncludedNew'] : ""; // check the session here
if ($IsIncluded) {
$itemid = $value['otherSrvSysId']; // get recent updated item id
}
// print_r($value);
$tempArr[] = [
'otherSrvSysId' => $value['otherSrvSysId'],
'tpIntSysId' => $value['tpIntSysId'],
'serviceTitle' => $value['serviceTitle'],
'comment' => $value['comment'],
'currencyType' => $value['currencyType'],
'paxCount' => $value['paxCount'],
'cost' => $value['cost'],
'supplierName' => $value['supplierName'],
'rateType' => $value['rateType'],
'isCostInclInTP' => ($IsIncluded) ? true : false,
'IsIncludedNew' => ($IsIncludedNew) ? true : false
];
}
$resultData = $tempArr;
}
}
}
} else {
$status = false;
$message = 'Invalid request!';
}
// echo '<pre>'; print_r($includedItemPriceArray); die;
$this->view->baseUrl = $this->baseUrl;
$this->view->status = $status;
$this->view->message = $message;
$this->view->resultData = $resultData;
$this->view->sessionPrice = $this->_storage->packageSession[$packageid][$tourtype][$categoryid]['others']['price']; //
$this->view->markupDetialsArray = $markupDetialsArray;
$this->view->param = $param;
}
public function addServicesAction() {
$this->_helper->layout()->disableLayout();
$resultData = [];
$message = '';
if ($this->getRequest()->getMethod() === 'GET') {
$param = $this->getRequest()->getParams();
// echo '<pre>'; print_r($param); die;
$packageid = $param['packageid'];
$gtxid = $param['gtxid'];
$getDetail = $this->objMdl->rv_select_row($this->tablename, ['LongJsonInfo'], ['PkgSysId' => $packageid, 'GTXPkgId' => $gtxid, 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1], ['PkgSysId' => 'DESC']);
if ($getDetail['LongJsonInfo']) {
$LongJsonInfo = $getDetail['LongJsonInfo'];
$dataArray = Zend_Json::decode($LongJsonInfo);
$resultData = $dataArray['package']['OtherServices'];
} else {
$resultData = [];
}
// echo '<pre>'; print_r( ($resultData)); die;
$status = true;
} else {
$status = false;
$message = 'Invalid request!';
}
$this->view->status = $status;
$this->view->message = $message;
$this->view->resultData = $resultData;
$this->view->baseUrl = $this->baseUrl;
}
// helper functions below
public function getTransportDetails($packageid, $gtxid, $type) {
$getDetail = $this->objMdl->rv_select_row($this->tablename, ['LongJsonInfo'], ['PkgSysId' => $packageid, 'GTXPkgId' => $gtxid, 'IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1], ['PkgSysId' => 'DESC']);
if ($getDetail['LongJsonInfo']) {
$LongJsonInfo = $getDetail['LongJsonInfo'];
$dataArray = Zend_Json::decode($LongJsonInfo);
$resultData = $dataArray['package']['Itineraries']['Itinerary'];
$masterData = $dataArray['package']['Transfers'];
// echo '<pre>'; print_r( ($resultData)); die;
// param : itinerary array
// return : array of transports
$result = $this->objHelperGeneral->getTransportItinerary($resultData, $masterData, $type);
// echo '<pre>'; print_r( $result); die;
} else {
$result = [];
}
return $result;
}
public function getPackageMasterData($packageid) {
$model = new Admin_Model_CRUD();
$result = $model->rv_select_row($this->tablename, ['LongJsonInfo'], ['IsMarkForDel' => 0, 'IsActive' => 1, 'IsPublish' => 1, 'PkgSysId' => $packageid], ['PkgSysId' => 'DESC']);
// echo '<pre>'; print_r( $result ); die;
return $result;
}
public function viewAction() {
$this->view->url = '';
if ($this->getRequest()->isGet()) {
$param = $this->getRequest()->getParams();
$REQUEST_URIExplode = explode('id/', $_SERVER['REQUEST_URI']);
$REQUEST_URIExplode1 = isset($REQUEST_URIExplode[1]) ? $REQUEST_URIExplode[1] : '';
$REQUEST_URIExplode2 = '';
if (!empty($REQUEST_URIExplode1)) {
$REQUEST_URIExplode2 = explode('/feed/', $REQUEST_URIExplode1);
}
$id = isset($REQUEST_URIExplode2[0]) ? $REQUEST_URIExplode2[0] : '';
$idDecode = base64_decode($id);
$feed = isset($REQUEST_URIExplode2[1]) ? $REQUEST_URIExplode2[1] : '';
if ($feed != 1) {
$this->_helper->layout()->disableLayout();
}
/* echo "<pre>";
print_r($param);
exit; */
$idDecode = explode('id/', $idDecode);
$idDecode = explode('/', $idDecode[1]);
$TPSysId = base64_decode($idDecode[0]);
$addtionalField = $encryptData = '';
if ($TPSysId > 0) {
$dataArray = array(
'CustomerSysId' => $_SESSION['User']['session']['CustomerSysId'],
'TPSysId' => $TPSysId,
);
$SecurityKey = SECURITYKEY;
$encryptData = Catabatic_ValidateCustomer::getEncGTX(json_encode($dataArray), $SecurityKey);
}
// echo "<pre>"; print_r($dataArray); exit;
if (isset($param['FN']) && trim($param['FN']) != '{FirstName}') {
$FirstName = $param['FN'];
$addtionalField .= '&FN=' . $FirstName;
} else if (isset($param['FirstName']) && $param['FirstName'] != "") {
$FirstName = $param['FirstName'];
$addtionalField .= '&FN=' . $FirstName;
}
if (isset($param['LN']) && trim($param['LN']) != '{LastName}') {
$LastName = $param['LN'];
$addtionalField .= '&LN=' . $LastName;
} else if (isset($param['LastName']) && $param['LastName'] != "") {
$LastName = $param['LastName'];
$addtionalField .= '&LN=' . $LastName;
}
if (isset($param['Email']) && $param['Email'] != "") {
$Email = $param['Email'];
$addtionalField .= '&Email=' . $Email;
}
if (isset($param['MNo']) && trim($param['MNo']) != '{MobileNo}') {
$MobileNo = $param['MNo'];
$addtionalField .= '&MNo=' . $MobileNo;
} else if (isset($param['MobileNo']) && $param['MobileNo'] != "") {
$MobileNo = $param['MobileNo'];
$addtionalField .= '&MNo=' . $MobileNo;
}
if (isset($param['AUID']) && trim($param['AUID']) != '{aid}') {
$AUID = $param['AUID'];
$addtionalField .= '&AUID=' . (int) $AUID;
}
// if (isset($param['source']) && trim($param['source']) != '{aid}') {
// $source = $param['source'];
// $addtionalField .= '&source=' . (int) $source;
// }
if (isset($param['campId']) && trim($param['campId']) != '{campSysId}') {
$campId = $param['campId'];
$addtionalField .= '&campId=' . $campId;
}
if ($feed == 1) {
$addtionalField .= '&source=Website';
}
if (isset($_SESSION['User']['session']['CustomerSysId']) && $addtionalField == '') {
$addtionalField .= '/token/' . base64_encode($encryptData);
}
// echo $addtionalField;
$this->view->addtionalField = $addtionalField;
$this->view->url = $id;
}
// echo "<pre>"; print_r($feed);
// echo "<pre>"; print_r($id);
// echo "<pre>"; print_r($addtionalField);
// exit;
$this->view->baseUrl = $this->baseUrl;
$this->view->siteName = $this->siteName;
$this->view->feed = $feed;
}
public function writeSessionModifytrueAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
$this->objHelperGeneral->flushSession();
echo Zend_Json::encode(['status' => 'success', 'mealplantype' => $param['mealplantype']]);
}
public function viewproposalAction() {
// $this->view->url = '';
// if ($this->getRequest()->isGet()) {
// $this->_helper->layout()->disableLayout();
$param = $this->getRequest()->getParams();
$this->view->url = isset($param['code']) ? $param['code'] : '';
// }
}
// update or write the session here
public function writeSessionAction() {
// error_reporting(E_ALL);
// error_reporting(E_ALL);
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$param = $this->getRequest()->getParams();
// echo '<pre>'; print_r($param);
$type = $param['type'];
$catid = $param['catid'];
$gtxid = $param['gtxID'];
$pkgid = $param['pkgid'];
$daynumber = $param['daynumber'];
$tourtype = $param['tourtype']; // Group or Private
$itinerary = isset($param['itinerary']) ? $param['itinerary'] : 0;
$myaction = (isset($param['myaction'])) ? $param['myaction'] : 'add';
$group = (isset($param['group'])) ? $param['group'] : '';
$ismulti = 0;
if ($type === 'services') {
$itemid = $param['itemid'];
$price = ($param['price']);
$ismulti = 1;
} else {
$itemidArray = ($param['itemid']) ? explode('__', $param['itemid']) : '';
$roomtypeArray = ($param['roomtype']) ? explode('__', $param['roomtype']) : '';
$mpArray = ($param['mp']) ? explode('__', $param['mp']) : '';
$priceArray = ($param['price']) ? explode('__', $param['price']) : '';
$myactionArray = ($param['myaction']) ? explode('__', $param['myaction']) : '';
$itemid = $itemidArray[0];
$RoomType = $roomtypeArray[0];
$MealPlanType = $mpArray[0];
$price = $priceArray[0];
$myaction = $myactionArray[0];
}
// echo"<pre>";print_r($price);die('aa');
$HotelName = isset($param['HotelName']) ? trim($param['HotelName']) : '';
$SupplierSysId = isset($param['SupplierSysId']) ? (int) $param['SupplierSysId'] : 0;
$PSESS = $this->_storage->packageSession;
$markupDetialsArray = $this->objHelperGeneral->getMarkupDetailsArray($pkgid, $tourtype, $catid); // get markup details
$day = $daynumber;
$countit = 2;
$sessionPackageSearchParams = new Zend_Session_Namespace('sessionPackageSearchParams');
$sessionPackageSearch = $sessionPackageSearchParams->params;
$checkInDate = isset($sessionPackageSearch['boarding_date']) ? $sessionPackageSearch['boarding_date'] : date('d/m/Y');
$checkInDate1 = str_replace('/', '-', $checkInDate);
$checkInDate2 = isset($checkInDate) ? date('Y-m-d', strtotime($checkInDate1)) : date("Y-m-d");
$datecheckin = date('Y-m-d', strtotime('+' . ($day - 1) . 'day', strtotime($checkInDate2)));
$checkOutDate = date('Y-m-d', strtotime('+' . $countit . 'day', strtotime($datecheckin)));
$adults = isset($sessionPackageSearch['totadlt']) ? $sessionPackageSearch['totadlt'] : '2';
$child = isset($sessionPackageSearch['totchld']) ? $sessionPackageSearch['totchld'] : '0';
$infent = '0';
$TotalPax = $adults + $child + $infent;
$refId = '';
$destIndex = (int) 1;
$roomJsonInfo = isset($sessionPackageSearch['roominfojson']) ? $sessionPackageSearch['roominfojson'] : '';
$destinationCity = 0;
$markupDetailsArray = array();
$hotelId = $itemid;
if (strtolower($type) === 'h' || strtolower($type) === 'r') {
$PackageMapper = new Detail_Model_PackageMapper();
$resultData = $PackageMapper->getHotel($destinationCity, "tb_tbb2c_packages_master", $datecheckin, $checkOutDate, $adults, $child, $infent, $refId, $destIndex, json_encode($roomJsonInfo), '', $markupDetailsArray, '', '', $hotelId);
$typeAlpha = 'hotel';
} else if (strtolower($type) === 'a') {
$typeAlpha = 'activity';
} else if (strtolower($type) === 's') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchDayWiseOptionsDetails($catid, $gtxid, $pkgid, $day, $hotelId, 's');
// echo '<pre>'; print_r($resultData); die;
$typeAlpha = 'sightSeeing';
} else if (strtolower($type) === 'car') {
$model = new Detail_Model_PackageMapper();
$resultData = $model->fetchTransfersDetailsByRouteSysID($param['RouteSysId']);
$typeAlpha = 'transfers';
} else if (strtolower($type) === 'services') {
$typeAlpha = 'services';
} else if (strtolower($type) === 'r') {
$typeAlpha = 'hotel';
}
$preitemid = 0;
if (array_key_exists($pkgid, $PSESS)) {
// chaeck tour type
if (array_key_exists($tourtype, $PSESS[$pkgid])) {
// chaeck type category
if (array_key_exists($catid, $PSESS[$pkgid][$tourtype])) {
if ($typeAlpha == 'hotel' || $typeAlpha == 'room') {
$PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$itemid] = 0;
$PSESS[$pkgid][$tourtype][$catid]['Markup'][$typeAlpha][$itemid] = 0;
if ($group === 'yes') {
// iterate the array
$tempArr = [];
$countITIHotel = 0;
// echo"<pre>";print_r($PSESS[$pkgid][$tourtype][$catid]);die('dd');
foreach ($PSESS[$pkgid][$tourtype][$catid] as $keyO => $valueO) {
if ($keyO === 'itineraries') {
$tempArr1 = [];
$HotelPrice = $HotelMarkup = 0;
foreach ($valueO as $keyH => $valueH) {
if (is_array($valueH['hotel']) && count($valueH['hotel'])) {
$innerArr = [];
$MasterIntSysId = $itemidID = 0;
$IsIncluded = false;
foreach ($valueH['hotel'] as $key => $value) {
if ($keyH == $itinerary || $value['MasterIntSysId'] == $itinerary) {
$IsIncluded = 1;
$MasterIntSysId = $value['MasterIntSysId'];
$itemidID = $value['itemid'];
$MealPlanId = 0;
$innerArr[] = ['itemid' => $itemidID, 'MasterIntSysId' => $MasterIntSysId, 'MealPlanId' => $MealPlanId, 'IsIncluded' => $IsIncluded, 'AccomSysId' => $itemid, 'RoomType' => $RoomType, 'MealPlanType' => $MealPlanType, 'Title' => $HotelName, 'SupplierSysId' => $SupplierSysId];
$checkPlan = json_decode(base64_decode($resultData[0]['checkPlan']), 1);
$Price = $checkPlan['category']['SUB'][$RoomType][$MealPlanType]['Price'];
$Markup = $checkPlan['category']['SUB'][$RoomType][$MealPlanType]['Markup'];
$PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$itemid] += $Price;
$PSESS[$pkgid][$tourtype][$catid]['Markup'][$typeAlpha][$itemid] += $Markup;
if ($value['AccomSysId'] != $itemid) {
$preitemid = $value['AccomSysId'];
}
} else {
$innerArr[] = $value;
}
}
$PSESS[$pkgid][$tourtype][$catid]['itineraries'][$keyH][$typeAlpha] = $innerArr; // rewrite the session here
}
}
}
}
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = (float) $PSESS[$pkgid][$tourtype][$catid]['others']['price'] + (float) $price; // update price here in session
} else {
foreach ($PSESS[$pkgid][$tourtype][$catid]['itineraries'][$itinerary][$typeAlpha] as $key => $value) {
$tempArr[] = ['itemid' => $value['itemid'], 'MasterIntSysId' => $value['MasterIntSysId'], 'IsIncluded' => ($value['itemid'] == $itemid) ? true : false];
}
$PSESS[$pkgid][$tourtype][$catid]['itineraries'][$itinerary][$typeAlpha] = $tempArr;
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = (float) $PSESS[$pkgid][$tourtype][$catid]['others']['price'] + (float) $price; // update price here in session
}
} else if (($typeAlpha == 'activity')) {
$masterDataArray = $this->objHelperGeneral->getMasterData($pkgid, $type); // get master data for price calculation
$tempArr = [];
$IsIncluded = '';
foreach ($PSESS[$pkgid][$tourtype][$catid]['itineraries'][$itinerary][$typeAlpha] as $key => $value) {
if ($value['itemid'] == $itemid) {
$IsIncludedNew = true;
} else {
$IsIncludedNew = false;
}
// this is case only in remove action
if (($myaction === 'remove') && ($value['itemid'] == $itemid)) {
$IsIncludedNew = false;
}
$tempArr[] = ['itemid' => $value['itemid'], 'IsIncluded' => $value['IsIncluded'], 'IsIncludedNew' => $IsIncludedNew];
}
$price = $masterDataArray[$param['itemid']]['priceaditionals']['netCost']; // get price from master data array
// if markup type is % than add here
if ((array_key_exists('MarkType', $markupDetialsArray)) && ($markupDetialsArray['MarkType'] == 2)) {
$price = $this->objHelperGeneral->calculateMarkupOnPrice($markupDetialsArray, $price, 1);
}
$PSESS[$pkgid][$tourtype][$catid]['itineraries'][$itinerary][$typeAlpha] = $tempArr;
if ($myaction === 'remove')
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = $PSESS[$pkgid][$tourtype][$catid]['others']['price'] - ($price); // update price here in session
else
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = $PSESS[$pkgid][$tourtype][$catid]['others']['price'] + ($price); // update price here in session
} else if (($typeAlpha == 'services')) {
$masterDataArray = $this->objHelperGeneral->getMasterData($pkgid, $type); // get master data for price calculation
$tempArr = [];
$recentChecked = [];
$recentPrice = $currentPrice = 0;
foreach ($PSESS[$pkgid][$tourtype][$catid]['others']['services'] as $key => $value) {
$tempArr[] = [
'itemid' => $value['itemid'],
'IsIncluded' => $value['IsIncluded'],
'IsIncludedNew' => (in_array($value['itemid'], explode(',', $itemid))) ? true : false
];
if ($value['IsIncludedNew']) {
$recentChecked[] = $value['itemid'];
$recentPrice += $masterDataArray[$value['itemid']]['cost'];
}
if (in_array($value['itemid'], explode(',', $itemid))) {
$currentPrice += $masterDataArray[$value['itemid']]['cost'];
}
}
$price = $currentPrice - $recentPrice;
$PSESS[$pkgid][$tourtype][$catid]['others']['services'] = $tempArr;
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = $PSESS[$pkgid][$tourtype][$catid]['others']['price'] + ($price); // update price here in session
} else if (($typeAlpha == 'transfers')) {
// echo"<pre>";print_r($PSESS[$pkgid][$tourtype][$catid]);die('ss');
if ($group == 'yes') {
$tempArr = [];
foreach ($PSESS[$pkgid][$tourtype][$catid] as $keyO => $valueO) {
if ($keyO === 'itineraries') {
$tempArr1 = [];
foreach ($valueO as $keyH => $valueH) {
if (is_array($valueH['transfers']) && count($valueH['transfers'])) {
$innerArr = [];
$MasterIntSysId = $itemidID = 0;
$IsIncluded = false;
$NewIsIncluded = false;
foreach ($valueH['transfers'] as $key => $value) {
if ($keyH == $itinerary) {
$IsIncluded = $value['IsIncluded'];
// $price = 0;
$NewIsIncluded = $value['NewIsIncluded'] ? $value['NewIsIncluded'] : '0';
unset($PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$day]);
// if(!empty($myactionArray)){}
foreach ($myactionArray as $acKey => $acValue) {
$itemid = $itemidArray[$acKey];
$RouteSysId = (isset($param['RouteSysId'])) ? $param['RouteSysId'] : ' ';
// echo"<pre>";print_r($valueH['transfers']);die('ss');
if ($value['RouteSysId'] == $RouteSysId) {
if ($acValue === 'add') {
if ($param['vehiclesysid'] == $value['VehSysId']) {
$IsIncluded = 1;
$price = $priceArray[$acKey];
$vehiclesysid = (isset($param['vehiclesysid'])) ? $param['vehiclesysid'] : '';
$vehicletypesysid = (isset($param['vehicletypesysid'])) ? $param['vehicletypesysid'] : '';
$vehicletypename = (isset($param['vehicletypename'])) ? $param['vehicletypename'] : ' ';
$pickup = (isset($param['pickup'])) ? $param['pickup'] : 0;
$droplocation = (isset($param['droplocation'])) ? $param['droplocation'] : ' ';
$capacity = (isset($param['capacity'])) ? $param['capacity'] : ' ';
$vehiclename = (isset($param['vehiclename'])) ? $param['vehiclename'] : ' ';
$quantity = (isset($param['quantity'])) ? $param['quantity'] : '1';
$SubCategory = (isset($param['SubCategory'])) ? $param['SubCategory'] : ' ';
$TransportSubType = (isset($param['TransportSubType'])) ? $param['TransportSubType'] : ' ';
$carsuppliersysid = (isset($param['carsuppliersysid'])) ? $param['carsuppliersysid'] : ' ';
foreach ($resultData as $categoryVl) {
$category = $categoryVl['category'];
$dataArray = Zend_Json::decode($category);
foreach ($dataArray as $transfersprice) {
if ($transfersprice['RouteVechSysId'] == $itemid) {
$Pricesess = $transfersprice['Cost'];
}
}
}
$PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$day][$itemid] += $Pricesess;
} else {
$IsIncluded = 0;
// $optionAVL = $RouteSysId;
$vehiclesysid = (isset($value['VehSysId'])) ? $value['VehSysId'] : '';
$vehicletypesysid = (isset($value['VehicleTypeSysId'])) ? $value['VehicleTypeSysId'] : '';
// $vehicletypename = (isset($value['vehicletypename'])) ? $value['vehicletypename'] : ' ';
$pickup = (isset($value['FromPlace'])) ? $value['FromPlace'] : 0;
$droplocation = (isset($value['ToPlace'])) ? $value['ToPlace'] : ' ';
$capacity = (isset($value['Capacity'])) ? $value['Capacity'] : ' ';
$vehiclename = (isset($value['VehName'])) ? $value['VehName'] : ' ';
$quantity = (isset($value['Qty'])) ? $value['Qty'] : '1';
$SubCategory = (isset($value['SubCategory'])) ? $value['SubCategory'] : ' ';
$TransportSubType = (isset($value['TransportSubType'])) ? $value['TransportSubType'] : ' ';
$carsuppliersysid = (isset($value['carsuppliersysid'])) ? $value['carsuppliersysid'] : ' ';
// echo"<pre>";print_r($value);die('data');
}
} else if ($acValue === 'remove') {
$IsIncluded = 0;
$optionAVL = $RouteSysId;
$vehiclesysid = (isset($value['VehSysId'])) ? $value['VehSysId'] : '';
// $RouteSysId = '';
}
}
}
$itemidID = $value['itemid'];
$type = $value['type'];
$innerArr = ['itemid' => $itemidID, 'RouteVechSysId' => $itemid, 'RouteSysId' => $RouteSysId, 'VehSysId' => $vehiclesysid, 'VehicleTypeSysId ' => $vehicletypesysid, 'RouteSysId' => $RouteSysId, 'TransType' => '', 'FromPlace' => $pickup, 'ToPlace' => $droplocation, 'Capacity' => $capacity, 'VehName' => $vehiclename, 'SupplierSysId' => $carsuppliersysid, 'Qty' => $quantity, 'SubCategory' => $SubCategory, 'TransportSubType' => $TransportSubType, 'optionAVL' => $optionAVL, 'IsIncluded' => $IsIncluded];
// echo "<pre>";print_r($innerArr);die;
$PSESS[$pkgid][$tourtype][$catid]['itineraries'][$keyH][$typeAlpha][$key] = $innerArr; // rewrite the session here
}
}
}
}
}
}
// $PSESS[$pkgid][$tourtype][$catid]['others']['price'] = (int)$PSESS[$pkgid][$tourtype][$catid]['others']['price'] + ($price); // update price here in session
}
} else if (($typeAlpha == 'sightSeeing')) {
if ($group == 'yes') {
$tempArr = [];
foreach ($PSESS[$pkgid][$tourtype][$catid] as $keyO => $valueO) {
if ($keyO === 'itineraries') {
$tempArr1 = [];
foreach ($valueO as $keyH => $valueH) {
if (is_array($valueH['sightSeeing']) && count($valueH['sightSeeing'])) {
$innerArr = [];
$MasterIntSysId = $itemidID = 0;
$IsIncluded = false;
$NewIsIncluded = false;
foreach ($valueH['sightSeeing'] as $key => $value) {
// $price = 0;
if ($keyH == $itinerary) {
$IsIncluded = $value['IsIncluded'];
// $price = 0;
$NewIsIncluded = $value['NewIsIncluded'] ? $value['NewIsIncluded'] : '0';
foreach ($myactionArray as $acKey => $acValue) {
$itemid = $itemidArray[$acKey];
if ($value['itemid'] == $itemid) {
if ($acValue === 'add') {
$IsIncluded = 1;
$NewIsIncluded = 1;
$price = $priceArray[$acKey];
$quantity = 1;
foreach ($resultData['finalArray'] as $valsitval) {
foreach ($valsitval['SightSeeing'] as $findpra) {
if ($findpra['RefSSId'] == $itemid) {
if ($findpra['priceaditionals']['RouteVechSysId'] > 0) {
if ($TotalPax > $findpra['priceaditionals']['Capacity']) {
$quantity = $TotalPax / $findpra['priceaditionals']['Capacity'];
if (is_float($quantity)) {
$quantity = intval($quantity) + 1;
}
}
$Pricesight = ($findpra['priceaditionals']['netCost'] * $quantity);
} else {
$Pricesight = ($findpra['priceaditionals']['adultCost'] * $adults + $findpra['priceaditionals']['kidsCost'] * $child);
}
}
}
}
$PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$day][$itemid] += $Pricesight;
} else if ($acValue === 'remove') {
$IsIncluded = 0;
$NewIsIncluded = 0;
unset($PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$day][$itemid]);
}
}
}
// echo "<pre>";print_r( $price);die;
$itemidID = $value['itemid'];
$type = $value['type'];
$innerArr = ['itemid' => $itemidID, 'NewIsIncluded' => $NewIsIncluded, 'IsIncluded' => $IsIncluded];
$PSESS[$pkgid][$tourtype][$catid]['itineraries'][$keyH][$typeAlpha][$key] = $innerArr; // rewrite the session here
}
}
}
}
}
}
// echo "<pre>";print_r( $price);die;
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = (int) $PSESS[$pkgid][$tourtype][$catid]['others']['price'] + (float) ($price); // update price here in session
} else {
foreach ($PSESS[$pkgid][$tourtype][$catid]['itineraries'][$itinerary][$typeAlpha] as $key => $value) {
$tempArr[] = ['itemid' => $value['itemid'], 'MasterIntSysId' => $value['MasterIntSysId'], 'IsIncluded' => ($value['itemid'] == $itemid) ? true : false];
}
$PSESS[$pkgid][$tourtype][$catid]['itineraries'][$itinerary][$typeAlpha] = $tempArr;
$PSESS[$pkgid][$tourtype][$catid]['others']['price'] = $PSESS[$pkgid][$tourtype][$catid]['others']['price'] + ($price); // update price here in session
}
}
// write a variable here to check whether the package is modified or not
$PSESS[$pkgid][$tourtype][$catid]['others']['modified'] = 1;
}
}
}
// echo '<pre>'; print_r($preitemid); die;
if ($preitemid > 0) {
unset($PSESS[$pkgid][$tourtype][$catid]['Price'][$typeAlpha][$preitemid]);
unset($PSESS[$pkgid][$tourtype][$catid]['Markup'][$typeAlpha][$preitemid]);
}
$this->_storage->packageSession = $PSESS;
// echo '<pre>';
// print_r($PSESS);
// die;
echo Zend_Json::encode(['status' => 'success', 'price' => $price]);
}
public function flushSessionAction() {
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
/*
if(Zend_Session::namespaceUnset($this->SESSION_NAMESPACE) !== null)
{
echo 'Flushed all session.';
}
else {
echo 'Already Flushed.';
}
*/
$this->objHelperGeneral->flushSession();
echo 'Flushed';
exit;
}
public function showSessionAction() {
echo "<pre>";
print_r($this->_storage->packageSession);
exit;
}
public function downloadPackagePdfAction() {
$this->view->layout()->disableLayout();
$this->view->CONST_PACKAGE_TRAVELER_MAX_ROOM = CONST_PACKAGE_TRAVELER_MAX_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_ADULT_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_CHILD_IN_ROOM;
$this->view->CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM = CONST_PACKAGE_TRAVELER_MAX_INFANT_IN_ROOM;
$this->view->modulename = $this->modulename;
$param = $this->getRequest()->getParams();
$catId = isset($param['catid']) ? (int) $param['catid'] : '';
$gtxId = isset($param['gtxid']) ? (int) $param['gtxid'] : '';
$packageId = isset($param['pkgid']) ? (int) $param['pkgid'] : '';
$tourtype = isset($param['tourtype']) ? (int) $param['tourtype'] : 1;
$mealplantype = 0;
$keywords = $param['destname'];
$customize = (isset($param['customize'])) ? $param['customize'] : 0; // for customization [ 1 , 0]
$this->view->mealplantype = $mealplantype;
$model = new Detail_Model_PackageMapper();
// check package for inactive case
$checkPackaageSysID = $model->checkPackaageSysID($gtxId);
if (!empty($checkPackaageSysID)) {
$packageId = $checkPackaageSysID['PkgSysId'];
}
$isModified = 0;
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2B'); // 4th optional parameter [ B2B | B2C ]
} else {
$getDetail = $model->fetchDetails($catId, $gtxId, $packageId, 'B2C'); // 4th optional parameter [ B2B | B2C ]
}
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
$MPType = $CONST_MEAL_PLAN_ARR[$mealplantype]; // get package meal plan type
if (isset($_SESSION['TravelAgent']['session']) && !empty($_SESSION['TravelAgent']['session'])) {
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], 'B2B', $getDetail['PackageType'], $getDetail['PackageSubType']);
} else {
$priceJsonViewFile = $this->objHelperGeneral->getCategoryAndPriceArrayJSON($getDetail['tourTypeFull'], 'B2C', $getDetail['PackageType'], $getDetail['PackageSubType']);
}
$priceArrJson = $priceJsonViewFile['priceArrJson'];
$tourTypeChar = ($tourtype == 1) ? 'P' : 'G'; // if private than P else G for Group tour type
$pkgprice = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype, true); // Param 4: true ( if calculate discounted price )
$pkgpriceDiscount = $this->objHelperGeneral->getPackagePriceV3(Catabatic_Helper::getPackageType($catId), $tourTypeChar, $priceArrJson, $mealplantype); // Param 4: true ( if calculate discounted price )
$currencyTypeArray = Zend_Controller_Action_HelperBroker::getStaticHelper('General')->getCurrencyData();
$getCurrencyType = $currencyTypeArray[$priceArrJson[$tourTypeChar][Catabatic_Helper::getPackageType($catId)]['price'][0]['Currency']];
$this->view->getCurrencyType = ($getCurrencyType) ? $getCurrencyType : 'INR';
$this->view->pkgprice = round($pkgprice);
$this->view->pkgpriceDiscount = $pkgpriceDiscount;
$PackageSubType = $getDetail['PackageSubType'];
$CONST_MEAL_PLAN_ARR = unserialize(CONST_MEAL_PLAN_ARR);
$objHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('General');
$masterDataHotel = $objHelper->getMasterData($packageId, 'h');
$hotels_array_included_only = $getDetail['hotels_array_included_only'];
$inner_hotels = $temparray = $hotels_array_included_only_view = [];
foreach ($hotels_array_included_only as $key => $value_hotel) {
$inner_hotels = $value_hotel[Catabatic_Helper::getPackageType($catId)];
$hotel_id = '';
foreach ($inner_hotels as $k => $val) {
if ($PackageSubType == 1) {
if ($CONST_MEAL_PLAN_ARR[$val['mp']] == $getDetail['MPType']) {
$hotel_id = $val['id'];
}
} else {
$hotel_id = $val['id'];
}
}
$value = ($hotel_id) ? $masterDataHotel[$hotel_id] : [];
if (array_key_exists('RefHotelId', $value) && !in_array($hotel_id, $temparray)) {
$hotels_array_included_only_view[] = $value;
}
$temparray[] = $hotel_id;
}
$hotelHotelArrayU = $hotels_array_included_only_view;
$pdfArray = array();
$pdfArray['PackageName'] = $getDetail['itementries']['Name'];
$pdfArray['InclusionsT'] = $getDetail['itementries']['Inclusions'];
$pdfArray['Inclusions'] = $getDetail['itementries']['Terms']['Inclusion'];
$pdfArray['Exclusions'] = $getDetail['itementries']['Terms']['Exclusions'];
$pdfArray['TermsConditions'] = $getDetail['itementries']['Terms']['Conditions'];
$pdfArray['TravelBasics'] = $getDetail['itementries']['Terms']['TravelBasics'];
$pdfArray['BookingTerm'] = $getDetail['itementries']['Terms']['BookingTerms'];
$pdfArray['WhyChooseUs'] = $getDetail['itementries']['Terms']['WhyUseUs'];
$pdfArray['CancellationPolicy'] = $getDetail['itementries']['Terms']['CancellationPolicy'];
foreach ($getDetail['dayView'] as $itinerariesKey => $itineraries) {
$count = count($itineraries['day']);
$pdfArray['Itinerary'][$itinerariesKey]['Title'] = $itineraries['day'][$count - 2];
$pdfArray['Itinerary'][$itinerariesKey]['Program'] = $itineraries['day'][$count - 1];
foreach ($itineraries['Hotel'] as $itinerariesItem) {
foreach ($itinerariesItem['Items'] as $hotelKey => $hotelVal1) {
if ($hotelVal1['Id'] == $catId) {
foreach ($hotelVal1['Item'] as $hotelVal2) {
if (($PackageType == $packageTypeStatic)) {
if ($CONST_MEAL_PLAN_ARR[$hotelVal2['MealPlanId']] == $MPType) {
$isMealplanType = true;
} else {
$isMealplanType = false;
}
} else {
$isMealplanType = true;
}
if ($hotelVal2['IsIncluded'] == true && $isMealplanType) {
foreach ($hotelHotelArrayU as $hotelId) {
if ($hotelId['RefHotelId'] == $hotelVal2['Id']) {
$pdfArray['Itinerary'][$itinerariesKey]['Hotel'][] = $masterDataHotel[$hotelVal2['Id']]['Name'];
}
}
}
}
}
}
}
foreach ($itineraries['SightSeeings'] as $itinerariesItems) {
if (!empty($itinerariesItems['Items'][0]['Item'])) {
foreach ($itinerariesItems['Items'][0]['Item'] as $itinerariesActivitys) {
if ($itinerariesActivitys['IsIncluded'] == true) {
if ($itinerariesItems['Type'] == 'SIGHTSEEING') {
foreach ($getDetail['finalArray']['SightSeeings'] as $finalSightSeeing => $valfinalSightSeeing) {
if (isset($valfinalSightSeeing['SightSeeing'])) {
foreach ($valfinalSightSeeing['SightSeeing'] as $keySightSeeing => $valSightSeeing) {
if ($itinerariesActivitys['Id'] == $valSightSeeing['RefSSId']) {
$pdfArray['Itinerary'][$itinerariesKey]['SIGHTSEEING'][] = trim($valSightSeeing['Title']);
}
}
}
}
}
}
}
}
}
}
// echo "<pre>";
// print_r($pdfArray);
// exit;
// $finalArray = array();
// if (!empty($getDetail)) {
//
// $i = 0;
// foreach ($getDetail['itementries']['Itineraries']['Itinerary'] as $value) {
// $finalArray['Itinerary'][$value['Day']]['Title'][] = $value['Title'];
// $finalArray['Itinerary'][$value['Day']]['Program'][] = $value['Program'];
// $i++;
// }
// }
// echo "<pre>";
// print_r($finalArray);
// exit;
if ($PackageType == 2) {
if ($tourtype == 1) {
$sizeT = $getDetail['itementries']['AllowMinPax'];
} else {
$sizeT = $getDetail['itementries']['GroupSize'];
}
$perperson = "Per Person For a Group Size of $sizeT Pax";
} else {
$perperson = 'Per Person twin sharing';
}
$this->view->perperson = $perperson;
$this->view->pdfArray = $pdfArray;
$this->view->baseUrl = $this->baseUrl;
}
public function saveChangeHotelDataAction() {
$this->_helper->layout()->disableLayout();
if ($this->getRequest()->isXmlHttpRequest()) {
if ($this->getRequest()->isPost()) {
$param = $this->getRequest()->getParams();
echo "<pre>";
print_r($param);
die;
}
}
}
}