public function hookDisplayLeftColumn() { if ($this->context->controller->php_self == 'category') { $this->context->controller->addJS(_PS_MODULE_DIR_ . $this->name . '/views/js/wkhotelfilterblock.js'); $this->context->controller->addCSS(_PS_MODULE_DIR_ . $this->name . '/views/css/wkhotelfilterblock.css'); $all_feat = FeatureCore::getFeatures($this->context->language->id); $htl_id_category = Tools::getValue('id_category'); $id_hotel = HotelBranchInformation::getHotelIdByIdCategory($htl_id_category); $max_adult = HotelRoomType::getMaxAdults($id_hotel); $max_child = HotelRoomType::getMaxChild($id_hotel); $category = new Category($htl_id_category); if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); $date_to = date('Y-m-d', strtotime($date_from) + 86400); } if (!($date_to = Tools::getValue('date_to'))) { $date_to = date('Y-m-d', strtotime($date_from) + 86400); } $obj_rm_type = new HotelRoomType(); $room_types = $obj_rm_type->getIdProductByHotelId($id_hotel); $prod_price = array(); if ($room_types) { foreach ($room_types as $key => $value) { $prod_price[] = Product::getPriceStatic($value['id_product']); } } if (Configuration::get('PS_REWRITING_SETTINGS')) { $cat_link = $this->context->link->getCategoryLink($category) . '?date_from=' . $date_from . '&date_to=' . $date_to; } else { $cat_link = $this->context->link->getCategoryLink($category) . '&date_from=' . $date_from . '&date_to=' . $date_to; } $currency = $this->context->currency; $config = $this->getConfigFieldsValues(); $obj_booking_detail = new HotelBookingDetail(); $num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to); $ratting_img = _MODULE_DIR_ . $this->name . '/views/img/stars-sprite-image.png'; $this->context->smarty->assign(array('all_feat' => $all_feat, 'max_adult' => $max_adult, 'max_child' => $max_child, 'cat_link' => $cat_link, 'ratting_img' => $ratting_img, 'currency' => $currency, 'date_from' => $date_from, 'date_to' => $date_to, 'num_days' => $num_days, 'config' => $config, 'min_price' => $prod_price ? min($prod_price) : 0, 'max_price' => $prod_price ? max($prod_price) : 0)); return $this->display(__FILE__, 'htlfilterblock.tpl'); } }
public function cartBookingDataForMail($order) { $customer = new Customer($order->id_customer); //by webkul to show order details properly on order history page $products = $order->getProducts(); if (Module::isInstalled('hotelreservationsystem')) { require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php'; $obj_cart_bk_data = new HotelCartBookingData(); $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); if (!empty($products)) { $cart_htl_data = array(); foreach ($products as $type_key => $type_value) { $product = new Product($type_value['product_id'], false, $this->context->language->id); $cover_image_arr = $product->getCover($type_value['product_id']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default'); } $unit_price = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); if (isset($customer->id)) { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, (new Cart($order->id_cart))->id_guest, $type_value['product_id'], $customer->id); } else { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, $customer->id_guest, $type_value['product_id']); } $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; $cart_htl_data[$type_key]['cover_img'] = $cover_img; $cart_htl_data[$type_key]['name'] = $product->name; $cart_htl_data[$type_key]['unit_price'] = $unit_price; $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult']; $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; foreach ($cart_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']); if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } } } } } return $cart_htl_data; }
/** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if (!$this->errors) { if (Pack::isPack((int) $this->product->id) && !Pack::isInStock((int) $this->product->id)) { $this->product->quantity = 0; } $this->product->description = $this->transformDescriptionWithImg($this->product->description); // Assign to the template the id of the virtual product. "0" if the product is not downloadable. $this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int) $this->product->id)); $this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI']))); if (Tools::isSubmit('submitCustomizedDatas')) { // If cart has not been saved, we need to do it so that customization fields can have an id_cart // We check that the cookie exists first to avoid ghost carts if (!$this->context->cart->id && isset($_COOKIE[$this->context->cookie->getName()])) { $this->context->cart->add(); $this->context->cookie->id_cart = (int) $this->context->cart->id; } $this->pictureUpload(); $this->textRecord(); $this->formTargetFormat(); } elseif (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture'))) { $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture.'); } $pictures = array(); $text_fields = array(); if ($this->product->customizable) { $files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true); foreach ($files as $file) { $pictures['pictures_' . $this->product->id . '_' . $file['index']] = $file['value']; } $texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true); foreach ($texts as $text_field) { $text_fields['textFields_' . $this->product->id . '_' . $text_field['index']] = str_replace('<br />', "\n", $text_field['value']); } } $this->context->smarty->assign(array('pictures' => $pictures, 'textFields' => $text_fields)); $this->product->customization_required = false; $customization_fields = $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false; if (is_array($customization_fields)) { foreach ($customization_fields as $customization_field) { if ($this->product->customization_required = $customization_field['required']) { break; } } } // Assign template vars related to the category + execute hooks related to the category $this->assignCategory(); // Assign template vars related to the price and tax $this->assignPriceAndTax(); // Assign template vars related to the images $this->assignImages(); // Assign attribute groups to the template $this->assignAttributesGroups(); // Assign attributes combinations to the template $this->assignAttributesCombinations(); // Pack management $pack_items = Pack::isPack($this->product->id) ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array(); $this->context->smarty->assign('packItems', $pack_items); $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1)); if (isset($this->category->id) && $this->category->id) { $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category)); } else { $return_link = 'javascript: history.back();'; } $accessories = $this->product->getAccessories($this->context->language->id); if ($this->product->cache_is_pack || count($accessories)) { $this->context->controller->addCSS(_THEME_CSS_DIR_ . 'product_list.css'); } if ($this->product->customizable) { $customization_datas = $this->context->cart->getProductCustomization($this->product->id, null, true); } // by webkul $htl_features = array(); $obj_hotel_room_type = new HotelRoomType(); $room_info_by_product_id = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($this->product->id); $hotel_id = $room_info_by_product_id['id_hotel']; if (isset($hotel_id) && $hotel_id) { $obj_hotel_branch = new HotelBranchInformation(); $hotel_info_by_id = $obj_hotel_branch->hotelBranchInfoById($hotel_id); $hotel_policies = $hotel_info_by_id['policies']; $hotel_name = $hotel_info_by_id['hotel_name']; $country = Country::getNameById($this->context->language->id, $hotel_info_by_id['country_id']); $state = State::getNameById($hotel_info_by_id['state_id']); $hotel_location = $hotel_info_by_id['city'] . ', ' . $state . ', ' . $country; $obj_hotel_feaures_ids = $obj_hotel_branch->getFeaturesOfHotelByHotelId($hotel_id); if (isset($obj_hotel_feaures_ids) && $obj_hotel_feaures_ids) { foreach ($obj_hotel_feaures_ids as $key => $value) { $obj_htl_ftr = new HotelFeatures(); $htl_info = $obj_htl_ftr->getFeatureInfoById($value['feature_id']); $htl_features[] = $htl_info['name']; } } } $date_from = Tools::getValue('date_from'); $date_to = Tools::getValue('date_to'); if (!($date_from = Tools::getValue('date_from'))) { $date_from = date('Y-m-d'); $date_to = date('Y-m-d', strtotime($date_from) + 86400); } if (!($date_to = Tools::getValue('date_to'))) { $date_to = date('Y-m-d', strtotime($date_from) + 86400); } $obj_booking_detail = new HotelBookingDetail(); $num_days = $obj_booking_detail->getNumberOfDays($date_from, $date_to); $priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id); if (!$priceDisplay || $priceDisplay == 2) { $price_tax = true; } elseif ($priceDisplay == 1) { $price_tax = false; } $price_tax_incl = Product::getPriceStatic($this->product->id, $price_tax); $total_price = $price_tax_incl * $num_days; $obj_booking_dtl = new HotelBookingDetail(); $hotel_room_data = $obj_booking_dtl->DataForFrontSearch($date_from, $date_to, $hotel_id, $this->product->id, 1); $obj_htl_cart_booking_data = new HotelCartBookingData(); $num_cart_rooms = $obj_htl_cart_booking_data->getCountRoomsByIdCartIdProduct($this->context->cart->id, $this->product->id, $date_from, $date_to); if ($hotel_room_data) { $total_available_rooms = $hotel_room_data['stats']['num_avail'] - $num_cart_rooms; } //end $location_enable = Configuration::get('WK_HOTEL_LOCATION_ENABLE'); $hotel_branch_obj = new HotelBranchInformation(); $hotel_info = $hotel_branch_obj->getActiveHotelBranchesInfo(); $search_data['date_from'] = $date_from; $search_data['date_to'] = $date_to; $search_data['htl_dtl'] = $hotel_branch_obj->hotelBranchInfoById($hotel_id); if (Tools::getValue('error')) { $this->context->smarty->assign('error', Tools::getValue('error')); } $this->context->smarty->assign(array('stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $customization_fields, 'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'], 'accessories' => $accessories, 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int) $this->product->id_manufacturer, $this->context->language->id), 'token' => Tools::getToken(false), 'ratting_img_path' => _MODULE_DIR_ . 'hotelreservationsystem/views/img/Slices/icons-sprite.png', 'num_reviews' => ProductComment::getCommentNumber($this->product->id), 'ratting' => ProductComment::getAverageGrade($this->product->id)['grade'], 'total_available_rooms' => $total_available_rooms, 'all_hotels_info' => $hotel_info, 'location_enable' => $location_enable, 'total_price' => $total_price, 'product_controller_url' => $this->context->link->getPageLink('product'), 'num_days' => $num_days, 'date_from' => $date_from, 'date_to' => $date_to, 'hotel_location' => $hotel_location, 'hotel_name' => $hotel_name, 'hotel_policies' => $hotel_policies, 'hotel_features' => $htl_features, 'ftr_img_src' => _PS_IMG_ . 'rf/', 'features' => $this->product->getFrontFeatures($this->context->language->id), 'attachments' => $this->product->cache_has_attachments ? $this->product->getAttachments($this->context->language->id) : array(), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int) $this->product->out_of_stock), 'last_qties' => (int) Configuration::get('PS_LAST_QTIES'), 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)), 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)), 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)), 'HOOK_PRODUCT_CONTENT' => Hook::exec('displayProductContent', array('product' => $this->product)), 'display_qties' => (int) Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'), 'ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'errors' => $this->errors, 'body_classes' => array($this->php_self . '-' . $this->product->id, $this->php_self . '-' . $this->product->link_rewrite, 'category-' . (isset($this->category) ? $this->category->id : ''), 'category-' . (isset($this->category) ? $this->category->getFieldByLang('link_rewrite') : '')), 'display_discount_price' => Configuration::get('PS_DISPLAY_DISCOUNT_PRICE'), 'search_data' => $search_data)); } $this->setTemplate(_PS_THEME_DIR_ . 'product.tpl'); }
public function createDummyDataForProject() { //delete privious products of prestashop $all_products = Product::getSimpleProducts(Configuration::get('PS_LANG_DEFAULT')); foreach ($all_products as $key_pro => $value_pro) { $obj_product = new Product($value_pro['id_product']); $obj_product->delete(); } // first add a hotel................. $def_cont_id = Country::getDefaultCountryId(); $obj_hotel_info = new HotelBranchInformation(); $obj_hotel_info->active = 1; $obj_hotel_info->hotel_name = "The Hotel Prime"; $obj_hotel_info->phone = 01234567; $obj_hotel_info->email = "*****@*****.**"; $obj_hotel_info->check_in = '12:00'; $obj_hotel_info->check_out = '12:00'; $obj_hotel_info->short_description = $this->l('Nice place to stay'); $obj_hotel_info->description = $this->l('Nice place to stay'); $obj_hotel_info->rating = 3; $obj_hotel_info->city = 'Nainital'; $states = State::getStatesByIdCountry($def_cont_id); $state_id = $states[0]['id_state']; $obj_hotel_info->state_id = $state_id; $obj_hotel_info->country_id = $def_cont_id; $obj_hotel_info->zipcode = 263001; $obj_hotel_info->policies = $this->l('1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred. 2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred. 3. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred. 4. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.'); $obj_hotel_info->address = 'Near post office, Mallital, Nainital'; $obj_hotel_info->save(); $htl_id = $obj_hotel_info->id; $grp_ids = array(); $obj_grp = new Group(); $data_grp_ids = $obj_grp->getGroups(1, $id_shop = false); foreach ($data_grp_ids as $key => $value) { $grp_ids[] = $value['id_group']; } $country_name = (new Country())->getNameById(Configuration::get('PS_LANG_DEFAULT'), $def_cont_id); $cat_country = $this->addCategory($country_name, false, $grp_ids); if ($cat_country) { $states = State::getStatesByIdCountry($def_cont_id); $state_name = $states[0]['name']; $cat_state = $this->addCategory($state_name, $cat_country, $grp_ids); } if ($cat_state) { $cat_city = $this->addCategory('DefCity', $cat_state, $grp_ids); } if ($cat_city) { $cat_hotel = $this->addCategory('The Hotel Prime', $cat_city, $grp_ids, 1, $htl_id); } if ($cat_hotel) { $obj_hotel_info = new HotelBranchInformation($htl_id); $obj_hotel_info->id_category = $cat_hotel; $obj_hotel_info->save(); } $branch_ftr_ids = array(1, 2, 4, 7, 8, 9, 11, 12, 14, 16, 17, 18, 21); foreach ($branch_ftr_ids as $key_ftr => $value_ftr) { $htl_ftr_obj = new HotelBranchFeatures(); $htl_ftr_obj->id_hotel = $htl_id; $htl_ftr_obj->feature_id = $value_ftr; $htl_ftr_obj->save(); } $prod_arr = array('Delux Rooms', 'Executive Rooms', 'luxury Rooms'); $img_num = 1; foreach ($prod_arr as $key_prod => $value_prod) { // Add Product $product = new Product(); $product->name = array(); $product->description = array(); $product->description_short = array(); $product->link_rewrite = array(); foreach (Language::getLanguages(true) as $lang) { $product->name[$lang['id_lang']] = $value_prod; $product->description[$lang['id_lang']] = $this->l('Fashion axe kogi yuccie, ramps shabby chic direct trade before they sold out distillery bicycle rights. Slow-carb +1 quinoa VHS. +1 brunch trust fund, meggings chartreuse sustainable everyday carry tumblr hoodie tacos tilde ramps post-ironic fixie.'); $product->description_short[$lang['id_lang']] = $this->l('Fashion axe kogi yuccie, ramps shabby chic direct trade before they sold out distillery bicycle rights. Slow-carb +1 quinoa VHS. +1 brunch trust fund, meggings chartreuse sustainable everyday carry tumblr hoodie tacos tilde ramps post-ironic fixie.'); $product->link_rewrite[$lang['id_lang']] = Tools::link_rewrite('Super Delux Rooms'); } $product->id_shop_default = Context::getContext()->shop->id; $product->id_category_default = 2; $product->price = 1000; $product->active = 1; $product->quantity = 99999999; $product->is_virtual = 1; $product->indexed = 1; $product->save(); $product_id = $product->id; Search::indexation(Tools::link_rewrite($value_prod), $product_id); $product->addToCategories(2); StockAvailable::updateQuantity($product_id, null, 99999999); //image upload for products $count = 0; $have_cover = false; $old_path = _PS_MODULE_DIR_ . $this->name . '/views/img/prod_imgs/' . $img_num . '.png'; $image_obj = new Image(); $image_obj->id_product = $product_id; $image_obj->position = Image::getHighestPosition($product_id) + 1; if ($count == 0) { if (!$have_cover) { $image_obj->cover = 1; } } else { $image_obj->cover = 0; } $image_obj->add(); $new_path = $image_obj->getPathForCreation(); $imagesTypes = ImageType::getImagesTypes('products'); foreach ($imagesTypes as $image_type) { ImageManager::resize($old_path, $new_path . '-' . $image_type['name'] . '.jpg', $image_type['width'], $image_type['height']); } ImageManager::resize($old_path, $new_path . '.jpg'); for ($k = 1; $k <= 5; $k++) { $htl_room_info_obj = new HotelRoomInformation(); $htl_room_info_obj->id_product = $product_id; $htl_room_info_obj->id_hotel = $htl_id; $htl_room_info_obj->room_num = 'A' . $i . '-10' . $k; $htl_room_info_obj->id_status = 1; $htl_room_info_obj->floor = 'first'; $htl_room_info_obj->save(); } $htl_rm_type = new HotelRoomType(); $htl_rm_type->id_product = $product_id; $htl_rm_type->id_hotel = $htl_id; $htl_rm_type->adult = 2; $htl_rm_type->children = 2; $htl_rm_type->save(); $img_num++; // Add features to the product $ftr_arr = array(0 => 8, 1 => 9, 2 => 10, 3 => 11); $ftr_val_arr = array(0 => 34, 1 => 35, 2 => 36, 3 => 37); foreach ($ftr_arr as $key_htl_ftr => $val_htl_ftr) { $product->addFeaturesToDB($val_htl_ftr, $ftr_val_arr[$key_htl_ftr]); } } return true; }
$roomsCount = array(); foreach (Common::createDateRangeArray($_REQUEST['check_in_date'], $_REQUEST['check_out_date']) as $key => $value) { $roomData = $roomcontrol->getAvailableRoomCountForRoomForDate($value, $hotelRoomType->roomTypeId()); if (count($roomData) > 0) { if ($roomData[0]['available_rooms'] > 0) { array_push($roomsCount, $roomData[0]['available_rooms']); } else { array_push($roomsCount, 0); } } else { array_push($roomsCount, 0); } } if (count($roomsCount) > 0 && min($roomsCount) > 0) { $room_count_empty++; $roomType = new HotelRoomType(); $roomTypeData = $roomType->getHotelRoomTypeFromHotelRoomtypeId($hotelRoomType->roomTypeHotelId(), $hotelRoomType->roomTypeId()); $roomType->extractor($roomTypeData); ?> <!--INFO: Modal Popup --> <div class="basic-modal-content" id="basic-modal-content<?php echo $hotelRoomType->roomTypeId(); ?> "> <div class="content"> <div class="left-col"> <h4>Room Type: <?php echo $hotelRoomType->roomTypeName(); ?> </h4>
/** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */ if (empty($this->context->cart->id_carrier)) { $checked = $this->context->cart->simulateCarrierSelectedOutput(); $checked = (int) Cart::desintifier($checked); $this->context->cart->id_carrier = $checked; $this->context->cart->update(); CartRule::autoRemoveFromCart($this->context); CartRule::autoAddToCart($this->context); } // SHOPPING CART $this->_assignSummaryInformations(); // WRAPPING AND TOS $this->_assignWrappingAndTOS(); if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) { $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); } else { $countries = Country::getCountries($this->context->language->id, true); } // If a rule offer free-shipping, force hidding shipping prices $free_shipping = false; foreach ($this->context->cart->getCartRules() as $rule) { if ($rule['free_shipping'] && !$rule['carrier_restriction']) { $free_shipping = true; break; } } $this->context->smarty->assign(array('free_shipping' => $free_shipping, 'isGuest' => isset($this->context->cookie->is_guest) ? $this->context->cookie->is_guest : 0, 'countries' => $countries, 'sl_country' => (int) Tools::getCountry(), 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'errorCarrier' => Tools::displayError('You must choose a carrier.', false), 'errorTOS' => Tools::displayError('You must accept the Terms of Service.', false), 'isPaymentStep' => isset($_GET['isPaymentStep']) && $_GET['isPaymentStep'], 'genders' => Gender::getGenders(), 'one_phone_at_least' => (int) Configuration::get('PS_ONE_PHONE_AT_LEAST'), 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop'))); $years = Tools::dateYears(); $months = Tools::dateMonths(); $days = Tools::dateDays(); $this->context->smarty->assign(array('years' => $years, 'months' => $months, 'days' => $days)); /* Load guest informations */ if ($this->isLogged && $this->context->cookie->is_guest) { $this->context->smarty->assign('guestInformations', $this->_getGuestInformations()); } // ADDRESS if ($this->isLogged) { $this->_assignAddress(); } // CARRIER $this->_assignCarrier(); // PAYMENT $this->_assignPayment(); Tools::safePostVars(); $newsletter = Configuration::get('PS_CUSTOMER_NWSL') || Module::isInstalled('blocknewsletter') && Module::getInstanceByName('blocknewsletter')->active; $this->context->smarty->assign('newsletter', $newsletter); $this->context->smarty->assign('optin', (bool) Configuration::get('PS_CUSTOMER_OPTIN')); $this->context->smarty->assign('field_required', $this->context->customer->validateFieldsRequiredDatabase()); $this->_processAddressFormat(); $link = new Link(); if (Tools::getValue('deleteFromOrderLine')) { $id_product = Tools::getValue('id_product'); $date_from = Tools::getValue('date_from'); $date_to = Tools::getValue('date_to'); $obj_cart_bk_data = new HotelCartBookingData(); $cart_data_dlt = $obj_cart_bk_data->deleteRoomDataFromOrderLine($this->context->cart->id, $this->context->cart->id_guest, $id_product, $date_from, $date_to); if ($cart_data_dlt) { Tools::redirect($link->getPageLink('order', null, $this->context->language->id)); } } if ((bool) Configuration::get('PS_ADVANCED_PAYMENT_API')) { $this->addJS(_THEME_JS_DIR_ . 'advanced-payment-api.js'); $this->setTemplate(_PS_THEME_DIR_ . 'order-opc-advanced.tpl'); } else { if (Module::isInstalled('hotelreservationsystem')) { require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php'; $obj_cart_bk_data = new HotelCartBookingData(); $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); $htl_rm_types = $this->context->cart->getProducts(); if (!empty($htl_rm_types)) { foreach ($htl_rm_types as $type_key => $type_value) { $product = new Product($type_value['id_product'], false, $this->context->language->id); $cover_image_arr = $product->getCover($type_value['id_product']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default'); } $unit_price = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1); if (isset($this->context->customer->id)) { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']); } else { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']); } $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['id_product']); $cart_htl_data[$type_key]['id_product'] = $type_value['id_product']; $cart_htl_data[$type_key]['cover_img'] = $cover_img; $cart_htl_data[$type_key]['name'] = $product->name; $cart_htl_data[$type_key]['unit_price'] = $unit_price; $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult']; $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; foreach ($cart_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']); if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days; $amount = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1); $amount *= $vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $amount = Product::getPriceStatic($type_value['id_product'], true, null, 6, null, false, true, 1); $amount *= $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; $cart_htl_data[$type_key]['date_diff'][$date_join]['link'] = $link->getPageLink('order', null, $this->context->language->id, "id_product=" . $type_value['id_product'] . "&deleteFromOrderLine=1&date_from=" . $data_v['date_from'] . "&date_to=" . $data_v['date_to']); } } } $this->context->smarty->assign('cart_htl_data', $cart_htl_data); } } $this->setTemplate(_PS_THEME_DIR_ . 'order-opc.tpl'); } }
<?php define('_MEXEC', 'OK'); require_once "../../../system/load.php"; //error_reporting(E_ALL); //Mail Controllers require_once '../../../smtpmailclass/class.phpmailer.php'; require_once '../../../smtpmailclass/class.smtp.php'; // optional, gets called from within class.phpmailer.php if not $hotels = new Hotels(); $session = new Sessions(); $reservations = new Reservations(); $bookingclient = new BookingClient(); $bookingclient = new BookingClient(); $rooms = new HotelRoomType(); $client; $merchantReferenceNo = $_REQUEST['resid']; //$session->getMerchantReferenceNo(); $reservations->setReservationId($merchantReferenceNo); $pay_data = $reservations->getReservationsFromId(); $reservations->extractor($pay_data); $reservation_link_id = $reservations->reservationFromBookingLink(); $reservations_status = $reservations->reservationPaymentStatus(); if ($reservations->reservationFromBookingLink()) { $client = new BookingClient(); $client->setId($reservations->reservationClientId()); $client->extractor($client->getClientsFromId()); $client_name = $client->name(); $client_email = $client->email(); } else { $client = new Clients();
public function ajaxProcessGetRoomType() { $hotel_id = Tools::getValue('hotel_id'); $obj_room_type = new HotelRoomType(); $room_type_info = $obj_room_type->getRoomTypeByHotelId($hotel_id); die(Tools::jsonEncode($room_type_info)); }
function loadHotelsWithOffers() { $from_date = date('Y-m-d'); $hotel_id = $_REQUEST['hotel_id']; $offers = new Offers(); $offerArr = $offers->loadOffersForHotel($from_date, $hotel_id); $offerContent = ""; $offerAvailable = false; if (count($offerArr) > 0) { $offerAvailable = true; $offerContent = "\n <div>\n <div class='group-set' style='width: 100%;'>\n <div class='front-offers'>"; foreach ($offerArr as $offer) { $offerContent = $offerContent . "\n <div class='offers'>\n <h4>"; $room = new HotelRoomType(); $room->setRoomTypeId($offer['room_type']); $room->extractor($room->getHotelRoomTypeFromId()); $offerContent = $offerContent . "Room: " . $room->roomTypeName() . " | " . $offer['title']; $room = null; $offerContent = $offerContent . "</h4>\n <div class='desc clearfix'>" . $offer['des'] . "</div>\n <div class='offer-image clearfix'>"; if ($offer['image'] != '' && file_exists(DOC_ROOT . 'uploads/special_offers/' . $offer['image'])) { $offerContent = $offerContent . "<img style='max-width: 100%; max-height: 100%;' src='" . HTTP_PATH . "uploads/special_offers/" . $offer['image'] . "' />"; } $offerContent = $offerContent . "</div>\n <div class='clearfix detail'>\n <ul class='offerFe'>\n <li>Offer type : "; if ($offer['dis_type'] == 0) { $offerContent = $offerContent . "Fixed Price"; } elseif ($offer['dis_type'] == 1) { $offerContent = $offerContent . "Percentage Discount"; } elseif ($offer['dis_type'] == 2) { $offerContent = $offerContent . "Free Nights"; } elseif ($offer['dis_type'] == 3) { $offerContent = $offerContent . "Custom"; } $offerContent = $offerContent . "</li>\n <li>"; if ($offer['date_validity'] == 'on') { $offerContent = $offerContent . "Only for "; } else { $offerContent = $offerContent . "For "; } $offerContent = $offerContent . "bookings between " . $offer['from_date'] . " & " . $offer['to_date'] . "</li>\n <li>Offer available for\n <ul>\n <li>Beds:"; $beds = Libs::get('bed_type'); foreach (array_filter(explode(':', $offer['bed_type'])) as $bed) { $offerContent = $offerContent . $beds[$bed] . "/ "; if ($offerContent != "") { $offerContent = $offerContent . $beds[$bed] . "/ "; } else { $offerContent = $offerContent . $beds[$bed]; } } $offerContent = $offerContent . "</li>\n <li>Meals:"; $meals = Libs::get('meal_type'); foreach (array_filter(explode(':', $offer['meal_type'])) as $meal) { $offerContent = $offerContent . $meals[$meal] . "/ "; } $offerContent = $offerContent . "</li>\n </ul>\n </li>\n </ul>\n </div>\n <div class='clearfix'></div>\n </div>"; } $offerContent = $offerContent . "</div>\n </div>\n </div>"; } else { $offerAvailable = false; } $offerArray = array("offerAvailable" => $offerAvailable, "offerContent" => $offerContent); echo json_encode($offerArray); }
function updateHotelsStep_6() { $hotelroomtype = new HotelRoomType(); $hotelroomtype->setValues($_REQUEST); if ($hotelroomtype->updateHotelRoomType()) { $complete = new ProfileCompletion(); $complete->setHotelStepId($_REQUEST['hotel_step_id']); $complete->setHotelStep1(1); $complete->updateProfileCompletionStep('7'); echo $_REQUEST['hotel_step_id']; Common::jsonSuccess(""); } else { Common::jsonError("Error"); } }
public function DataForFrontSearch($date_from, $date_to, $id_hotel, $id_product = 0, $for_room_type = 0, $adult = 0, $children = 0, $ratting = -1, $amenities = 0, $price = 0, $id_cart = 0, $id_guest = 0) { require_once _PS_MODULE_DIR_ . 'productcomments/ProductComment.php'; $this->context = Context::getContext(); $booking_data = $this->getBookingData($date_from, $date_to, $id_hotel, $id_product, $adult, $children, 0, 0, 1, 0, 0, 0, $id_cart, $id_guest); // ddd($booking_data); if (!$for_room_type) { if (!empty($booking_data)) { $obj_rm_type = new HotelRoomType(); foreach ($booking_data['rm_data'] as $key => $value) { if (empty($value['data']['available'])) { unset($booking_data['rm_data'][$key]); } else { $prod_ratting = ProductComment::getAverageGrade($value['id_product'])['grade']; if ($prod_ratting === NULL) { $prod_ratting = 0; } if ($prod_ratting < $ratting && $ratting != -1) { unset($booking_data['rm_data'][$key]); } else { $product = new Product($value['id_product'], false, $this->context->language->id); $product_feature = $product->getFrontFeaturesStatic($this->context->language->id, $value['id_product']); $prod_amen = array(); if (!empty($amenities) && $amenities) { $prod_amen = $amenities; foreach ($product_feature as $a_key => $a_val) { if (($pa_key = array_search($a_val['id_feature'], $prod_amen)) !== false) { unset($prod_amen[$pa_key]); if (empty($prod_amen)) { break; } } } if (!empty($prod_amen)) { unset($booking_data['rm_data'][$key]); } } if (empty($prod_amen)) { $prod_price = Product::getPriceStatic($value['id_product']); if (empty($price) || $price['from'] <= $prod_price && $price['to'] >= $prod_price) { $cover_image_arr = $product->getCover($value['id_product']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'home_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'home_default'); } $room_left = count($booking_data['rm_data'][$key]['data']['available']); $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($value['id_product']); $booking_data['rm_data'][$key]['name'] = $product->name; $booking_data['rm_data'][$key]['image'] = $cover_img; $booking_data['rm_data'][$key]['description'] = $product->description_short; $booking_data['rm_data'][$key]['feature'] = $product_feature; $booking_data['rm_data'][$key]['price'] = $prod_price; if ($room_left <= (int) Configuration::get('WK_ROOM_LEFT_WARNING_NUMBER')) { $booking_data['rm_data'][$key]['room_left'] = $room_left; } $booking_data['rm_data'][$key]['adult'] = $rm_dtl['adult']; $booking_data['rm_data'][$key]['children'] = $rm_dtl['children']; $booking_data['rm_data'][$key]['ratting'] = $prod_ratting; $booking_data['rm_data'][$key]['num_review'] = ProductComment::getCommentNumber($value['id_product']); if (Configuration::get('PS_REWRITING_SETTINGS')) { $booking_data['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($product) . '?date_from=' . $date_from . '&date_to=' . $date_to; } else { $booking_data['rm_data'][$key]['product_link'] = $this->context->link->getProductLink($product) . '&date_from=' . $date_from . '&date_to=' . $date_to; } } else { unset($booking_data['rm_data'][$key]); } } } } } } } return $booking_data; }
public function processStatus() { if (Validate::isLoadedObject($object = $this->loadObject())) { if ($object->id && $object->active) { $obj_htl_rm_info = new HotelRoomType(); $ids_product = $obj_htl_rm_info->getIdProductByHotelId($object->id); if (isset($ids_product) && $ids_product) { foreach ($ids_product as $key_prod => $value_prod) { $obj_product = new Product($value_prod['id_product']); if ($obj_product->active) { $obj_product->toggleStatus(); } } } } } else { $this->errors[] = Tools::displayError('An error occurred while updating the status for an object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)'); } parent::processStatus(); }
public function getHotelCartBookingData() { $total_rooms = 0; $cart_htl_data = array(); $priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id); if (!$priceDisplay || $priceDisplay == 2) { $price_tax = true; } elseif ($priceDisplay == 1) { $price_tax = false; } if (Module::isInstalled('hotelreservationsystem')) { require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php'; $obj_cart_bk_data = new HotelCartBookingData(); $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); $htl_rm_types = $this->context->cart->getProducts(); if (!empty($htl_rm_types)) { foreach ($htl_rm_types as $type_key => $type_value) { $product = new Product($type_value['id_product'], false, $this->context->language->id); $cover_image_arr = $product->getCover($type_value['id_product']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default'); } $unit_price = Product::getPriceStatic($type_value['id_product'], $price_tax, null, 6, null, false, true, 1); if (isset($this->context->customer->id)) { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']); } else { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->context->cart->id, $this->context->cart->id_guest, $type_value['id_product']); } $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['id_product']); $cart_htl_data[$type_key]['total_num_rooms'] = 0; $cart_htl_data[$type_key]['id_product'] = $type_value['id_product']; $cart_htl_data[$type_key]['cover_img'] = $cover_img; $cart_htl_data[$type_key]['name'] = $product->name; $cart_htl_data[$type_key]['unit_price'] = $unit_price; $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult']; $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; if (isset($cart_bk_data) && $cart_bk_data) { foreach ($cart_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']); if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; $total_rooms += 1; $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days; $amount = Product::getPriceStatic($type_value['id_product'], $price_tax, null, 6, null, false, true, 1); $amount *= $vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $total_rooms += 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $amount = Product::getPriceStatic($type_value['id_product'], $price_tax, null, 6, null, false, true, 1); $amount *= $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } } foreach ($cart_htl_data[$type_key]['date_diff'] as $key => $value) { $cart_htl_data[$type_key]['total_num_rooms'] += $value['num_rm']; } } } } } return array('cart_htl_data' => $cart_htl_data, 'total_rooms_in_cart' => $total_rooms); }
function onlinePayment() { $reservation = new Reservations(); $reservation->setReservationClientId(Sessions::getClientId()); $reservation->setReservationHotelId(Sessions::getOnlinePaymentHotelId()); $reservation->setReservationHotelRoomTypeId(Sessions::getOnlinePaymentRoomTypeId()); $reservation->setReservationBedType(Sessions::getOnlinePaymentBedType()); $reservation->setReservationMealType(Sessions::getOnlinePaymentMealType()); $reservation->setReservationNoOfRoom(Sessions::getOnlinePaymentRoomCount()); $reservation->setReservationTotalPrice(Sessions::getOnlinePaymentRate()); //$reservation->setCurrencyType(Sessions::currSuffix()); $reservation->setCurrencyType(Sessions::getDisplayRatesIn()); $reservation->setReservationCheckInDate(Sessions::getOnlinePaymentCheckin()); $reservation->setReservationCheckOutDate(Sessions::getOnlinePaymentCheckout()); $reservation->setReservationOfferAvailable(Sessions::getOnlinePaymentOfferAvailable()); $reservation->setReservationOfferData(Sessions::getOnlinePaymentOfferData()); //$reservation_id = $reservation->newReservations(); if ($reservation->newReservations()) { $reservation_id = mysql_insert_id(); Sessions::setOnlinePaymentReservationId($reservation_id); $client_name = ""; $client_email = ""; $client_contact = ""; $client = new Clients(); $client->setClientId(Sessions::getClientId()); $client->extractor($client->getClientFromId()); $client_name = $client->clientFirstName() . ' ' . $client->clientLastName(); $client_email = $client->clientEmail(); $client_contact = $client->clientPhoneFixed(); $hotels_name = ""; $hotels = new Hotels(); $hotels->setHotelId(Sessions::getOnlinePaymentHotelId()); $hotels->extractor($hotels->getHotelFromId()); $hotels_name = $hotels->hotelName(); $hotel_room_type = ""; $room = new HotelRoomType(); $room->setRoomTypeId(Sessions::getOnlinePaymentRoomTypeId()); $room->extractor($room->getHotelRoomTypeFromId()); $hotel_room_type = $room->roomTypeName(); $bed_type = Sessions::getOnlinePaymentBedType(); $meal_type = Sessions::getOnlinePaymentMealType(); $room_count = Sessions::getOnlinePaymentRoomCount(); $room_rate = Sessions::getOnlinePaymentRate() . ' ' . Sessions::currSuffix(); $check_in = Sessions::getOnlinePaymentCheckin(); $check_out = Sessions::getOnlinePaymentCheckout(); $mail_tmp = '<table width="560" border="0" align="center"> <tr> <td width="173" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Reservation Id </td> <td width="377" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $reservation_id . ' </td> </tr> <tr> <td width="173" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Hotel </td> <td width="377" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $hotels_name . ' </td> </tr> <tr> <td width="173" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Customer’ Name </td> <td width="377" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $client_name . ' </td> </tr> <tr> <td width="173" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Customer’ E-mail </td> <td width="377" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $client_email . ' </td> </tr> <tr> <td width="173" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Customer’ Contact </td> <td width="377" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $client_contact . ' </td> </tr> <tr> <td style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Room Type </td> <td style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $hotel_room_type . ' </td> </tr> <tr> <td style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Bed Type</td> <td style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> :' . $bed_type . ' </td> </tr> <tr> <td height="26" valign="top" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Meal Type </td> <td valign="top" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px; height:auto !important; min-height:10px; height:auto;"> :' . $meal_type . ' </td> </tr> <tr> <td height="26" valign="top" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> No of Rooms </td> <td valign="top" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px; height:auto !important; min-height:10px; height:auto;"> :' . $room_count . ' </td> </tr> <tr> <td height="26" valign="top" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Total </td> <td valign="top" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px; height:auto !important; min-height:10px; height:auto;"> :' . $room_rate . ' </td> </tr> <tr> <td height="26" valign="top" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Check In </td> <td valign="top" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px; height:auto !important; min-height:10px; height:auto;"> :' . $check_in . ' </td> </tr> <tr> <td height="26" valign="top" style="font-weight:bold; font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px;"> Check Out </td> <td valign="top" style="font-size:12px; text-align: left; font-family: Arial, Helvetica, sans-serif; color:#60919f; line-height: 19px; margin: 0 0 12px; padding: 4px 3px; height:auto !important; min-height:10px; height:auto;"> :' . $check_out . ' </td> </tr> </table>'; $subject = "Reservation Details Roomista.com"; $random_hash = md5(time()); $headers = ""; $headers .= "\r\nContent-Type:text/html; charset=iso-8859-1\n boundary=\"PHP-alt-" . $random_hash . "\""; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-Type:text/html; charset=iso-8859-1\n"; $headers .= "From:reservation@roomista.com \n"; $headers .= "Return-Path:{$client_email}\n"; //mail('*****@*****.**',$subject,$mail_tmp,$headers); //mail('*****@*****.**',$subject,$mail_tmp,$headers); mail('booking@roomista.com,info@roomista.com', $subject, $mail_tmp, $headers); Common::jsonSuccess("payment registered"); } else { Common::jsonError("Error"); } }
/** * Assign template vars related to page content * @see FrontController::initContent() */ public function initContent() { parent::initContent(); if (!($id_order = (int) Tools::getValue('id_order')) || !Validate::isUnsignedId($id_order)) { $this->errors[] = Tools::displayError('Order ID required'); } else { $order = new Order($id_order); if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) { $id_order_state = (int) $order->getCurrentState(); $carrier = new Carrier((int) $order->id_carrier, (int) $order->id_lang); $addressInvoice = new Address((int) $order->id_address_invoice); $addressDelivery = new Address((int) $order->id_address_delivery); $inv_adr_fields = AddressFormat::getOrderedAddressFields($addressInvoice->id_country); $dlv_adr_fields = AddressFormat::getOrderedAddressFields($addressDelivery->id_country); $invoiceAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressInvoice, $inv_adr_fields); $deliveryAddressFormatedValues = AddressFormat::getFormattedAddressFieldsValues($addressDelivery, $dlv_adr_fields); if ($order->total_discounts > 0) { $this->context->smarty->assign('total_old', (double) $order->total_paid - $order->total_discounts); } $products = $order->getProducts(); /* DEPRECATED: customizedDatas @since 1.5 */ $customizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart); Product::addCustomizationPrice($products, $customizedDatas); OrderReturn::addReturnedQuantity($products, $order->id); $order_status = new OrderState((int) $id_order_state, (int) $order->id_lang); $customer = new Customer($order->id_customer); //by webkul to show order details properly on order history page if (Module::isInstalled('hotelreservationsystem')) { require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php'; $obj_cart_bk_data = new HotelCartBookingData(); $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); if (!empty($products)) { foreach ($products as $type_key => $type_value) { $product = new Product($type_value['product_id'], false, $this->context->language->id); $cover_image_arr = $product->getCover($type_value['product_id']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default'); } $unit_price = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); if (isset($customer->id)) { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, (new Cart($order->id_cart))->id_guest, $type_value['product_id'], $customer->id); } else { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($order->id_cart, $customer->id_guest, $type_value['product_id']); } $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; $cart_htl_data[$type_key]['cover_img'] = $cover_img; $cart_htl_data[$type_key]['name'] = $product->name; $cart_htl_data[$type_key]['unit_price'] = $unit_price; $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult']; $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; foreach ($cart_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']); if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $amount; } } } $this->context->smarty->assign('cart_htl_data', $cart_htl_data); } } //end $this->context->smarty->assign(array('shop_name' => strval(Configuration::get('PS_SHOP_NAME')), 'order' => $order, 'return_allowed' => (int) $order->isReturnable(), 'currency' => new Currency($order->id_currency), 'order_state' => (int) $id_order_state, 'invoiceAllowed' => (int) Configuration::get('PS_INVOICE'), 'invoice' => OrderState::invoiceAvailable($id_order_state) && count($order->getInvoicesCollection()), 'logable' => (bool) $order_status->logable, 'order_history' => $order->getHistory($this->context->language->id, false, true), 'products' => $products, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, 'invoiceState' => Validate::isLoadedObject($addressInvoice) && $addressInvoice->id_state ? new State($addressInvoice->id_state) : false, 'address_delivery' => $addressDelivery, 'inv_adr_fields' => $inv_adr_fields, 'dlv_adr_fields' => $dlv_adr_fields, 'invoiceAddressFormatedValues' => $invoiceAddressFormatedValues, 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues, 'deliveryState' => Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state ? new State($addressDelivery->id_state) : false, 'is_guest' => false, 'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false), 'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE, 'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD, 'isRecyclable' => Configuration::get('PS_RECYCLABLE_PACK'), 'use_tax' => Configuration::get('PS_TAX'), 'group_use_tax' => Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC, 'customizedDatas' => $customizedDatas, 'reorderingAllowed' => !(bool) Configuration::get('PS_DISALLOW_HISTORY_REORDERING'))); if ($carrier->url && $order->shipping_number) { $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); } $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('displayOrderDetail', array('order' => $order))); Hook::exec('actionOrderDetail', array('carrier' => $carrier, 'order' => $order)); unset($carrier, $addressInvoice, $addressDelivery); } else { $this->errors[] = Tools::displayError('This order cannot be found.'); } unset($order); } $this->setTemplate(_PS_THEME_DIR_ . 'order-detail.tpl'); }
function deleteRoom() { $hotelroomtype = new HotelRoomType(); $hotelroomtype->setRoomTypeId($_REQUEST['room_type_id']); //INFO: Log //$temp_room_type1 = new HotelRoomType(); //$temp_room_type1->setRoomTypeId($_REQUEST['room_type_id']); //$temp_room_type1=(array)$temp_room_type1->getHotelRoomTypeFromId(); //INFO: Log// if ($hotelroomtype->deleteHotelRoomType()) { //INFO: Log //$TransactionLog=new TransactionLog($temp_room_type1[0]['room_type_hotel_id'],Libs::getKey('hotel_sections','Room Types - Delete'),'Delete',Sessions::getMemberId(),'hotel_room_types',$temp_room_type1[0],''); //$TransactionLog->log(); //INFO: Log// Common::jsonSuccess(""); } else { Common::jsonError("Error"); } //INFO: Log //$temp_room_type1=null; //INFO: Log// }
} } else { die(Tools::jsonEncode(array('status' => 'unavailable_quantity', 'avail_rooms' => $total_available_rooms))); } } else { die(Tools::jsonEncode(array('status' => 'failed2'))); } } else { die(Tools::jsonEncode(array('status' => 'failed3'))); } } else { die(Tools::jsonEncode(array('status' => 'failed4'))); } } if (isset($delete) && $delete) { $obj_room_type = new HotelRoomType(); $room_info_by_id_product = $obj_room_type->getRoomTypeInfoByIdProduct($id_product); if ($room_info_by_id_product) { $id_hotel = $room_info_by_id_product['id_hotel']; if ($id_hotel) { $obj_booking_dtl = new HotelBookingDetail(); $hotel_room_data = $obj_booking_dtl->DataForFrontSearch($date_from, $date_to, $id_hotel, $id_product, 1); if ($hotel_room_data) { $total_available_rooms = $hotel_room_data['stats']['num_avail']; } } } $obj_htl_cart_booking_data = new HotelCartBookingData(); $result = $obj_htl_cart_booking_data->deleteCartBookingDataOnRemoveFromBlockCart($id_cart, $id_product); if ($result) { die(Tools::jsonEncode(array('status' => 'success', 'avail_rooms' => $total_available_rooms)));
/** * Returns the template's HTML content * * @return string HTML content */ public function getContent() { $invoiceAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_INVOICE_ADDR_RULES'), true); $deliveryAddressPatternRules = Tools::jsonDecode(Configuration::get('PS_INVCE_DELIVERY_ADDR_RULES'), true); $invoice_address = new Address((int) $this->order->id_address_invoice); $country = new Country((int) $invoice_address->id_country); if ($this->order_invoice->invoice_address) { $formatted_invoice_address = $this->order_invoice->invoice_address; } else { $formatted_invoice_address = AddressFormat::generateAddress($invoice_address, $invoiceAddressPatternRules, '<br />', ' '); } $delivery_address = null; $formatted_delivery_address = ''; if (isset($this->order->id_address_delivery) && $this->order->id_address_delivery) { if ($this->order_invoice->delivery_address) { $formatted_delivery_address = $this->order_invoice->delivery_address; } else { $delivery_address = new Address((int) $this->order->id_address_delivery); $formatted_delivery_address = AddressFormat::generateAddress($delivery_address, $deliveryAddressPatternRules, '<br />', ' '); } } $customer = new Customer((int) $this->order->id_customer); $order_details = $this->order_invoice->getProducts(); $has_discount = false; foreach ($order_details as $id => &$order_detail) { // Find out if column 'price before discount' is required if ($order_detail['reduction_amount_tax_excl'] > 0) { $has_discount = true; $order_detail['unit_price_tax_excl_before_specific_price'] = $order_detail['unit_price_tax_excl_including_ecotax'] + $order_detail['reduction_amount_tax_excl']; } elseif ($order_detail['reduction_percent'] > 0) { $has_discount = true; $order_detail['unit_price_tax_excl_before_specific_price'] = 100 * $order_detail['unit_price_tax_excl_including_ecotax'] / (100 - 15); } // Set tax_code $taxes = OrderDetail::getTaxListStatic($id); $tax_temp = array(); foreach ($taxes as $tax) { $obj = new Tax($tax['id_tax']); $tax_temp[] = sprintf($this->l('%1$s%2$s%%'), $obj->rate + 0, ' '); } $order_detail['order_detail_tax'] = $taxes; $order_detail['order_detail_tax_label'] = implode(', ', $tax_temp); } unset($tax_temp); unset($order_detail); if (Configuration::get('PS_PDF_IMG_INVOICE')) { foreach ($order_details as &$order_detail) { if ($order_detail['image'] != null) { $name = 'product_mini_' . (int) $order_detail['product_id'] . (isset($order_detail['product_attribute_id']) ? '_' . (int) $order_detail['product_attribute_id'] : '') . '.jpg'; $path = _PS_PROD_IMG_DIR_ . $order_detail['image']->getExistingImgPath() . '.jpg'; $order_detail['image_tag'] = preg_replace('/\\.*' . preg_quote(__PS_BASE_URI__, '/') . '/', _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR, ImageManager::thumbnail($path, $name, 45, 'jpg', false), 1); if (file_exists(_PS_TMP_IMG_DIR_ . $name)) { $order_detail['image_size'] = getimagesize(_PS_TMP_IMG_DIR_ . $name); } else { $order_detail['image_size'] = false; } } } unset($order_detail); // don't overwrite the last order_detail later } $cart_rules = $this->order->getCartRules($this->order_invoice->id); $free_shipping = false; foreach ($cart_rules as $key => $cart_rule) { if ($cart_rule['free_shipping']) { $free_shipping = true; /** * Adjust cart rule value to remove the amount of the shipping. * We're not interested in displaying the shipping discount as it is already shown as "Free Shipping". */ $cart_rules[$key]['value_tax_excl'] -= $this->order_invoice->total_shipping_tax_excl; $cart_rules[$key]['value'] -= $this->order_invoice->total_shipping_tax_incl; /** * Don't display cart rules that are only about free shipping and don't create * a discount on products. */ if ($cart_rules[$key]['value'] == 0) { unset($cart_rules[$key]); } } } $product_taxes = 0; foreach ($this->order_invoice->getProductTaxesBreakdown($this->order) as $details) { $product_taxes += $details['total_amount']; } $product_discounts_tax_excl = $this->order_invoice->total_discount_tax_excl; $product_discounts_tax_incl = $this->order_invoice->total_discount_tax_incl; if ($free_shipping) { $product_discounts_tax_excl -= $this->order_invoice->total_shipping_tax_excl; $product_discounts_tax_incl -= $this->order_invoice->total_shipping_tax_incl; } $products_after_discounts_tax_excl = $this->order_invoice->total_products - $product_discounts_tax_excl; $products_after_discounts_tax_incl = $this->order_invoice->total_products_wt - $product_discounts_tax_incl; $shipping_tax_excl = $free_shipping ? 0 : $this->order_invoice->total_shipping_tax_excl; $shipping_tax_incl = $free_shipping ? 0 : $this->order_invoice->total_shipping_tax_incl; $shipping_taxes = $shipping_tax_incl - $shipping_tax_excl; $wrapping_taxes = $this->order_invoice->total_wrapping_tax_incl - $this->order_invoice->total_wrapping_tax_excl; $total_taxes = $this->order_invoice->total_paid_tax_incl - $this->order_invoice->total_paid_tax_excl; $footer = array('products_before_discounts_tax_excl' => $this->order_invoice->total_products, 'product_discounts_tax_excl' => $product_discounts_tax_excl, 'products_after_discounts_tax_excl' => $products_after_discounts_tax_excl, 'products_before_discounts_tax_incl' => $this->order_invoice->total_products_wt, 'product_discounts_tax_incl' => $product_discounts_tax_incl, 'products_after_discounts_tax_incl' => $products_after_discounts_tax_incl, 'product_taxes' => $product_taxes, 'shipping_tax_excl' => $shipping_tax_excl, 'shipping_taxes' => $shipping_taxes, 'shipping_tax_incl' => $shipping_tax_incl, 'wrapping_tax_excl' => $this->order_invoice->total_wrapping_tax_excl, 'wrapping_taxes' => $wrapping_taxes, 'wrapping_tax_incl' => $this->order_invoice->total_wrapping_tax_incl, 'ecotax_taxes' => $total_taxes - $product_taxes - $wrapping_taxes - $shipping_taxes, 'total_taxes' => $total_taxes, 'total_paid_tax_excl' => $this->order_invoice->total_paid_tax_excl, 'total_paid_tax_incl' => $this->order_invoice->total_paid_tax_incl); foreach ($footer as $key => $value) { $footer[$key] = Tools::ps_round($value, _PS_PRICE_COMPUTE_PRECISION_, $this->order->round_mode); } /** * Need the $round_mode for the tests. */ $round_type = null; switch ($this->order->round_type) { case Order::ROUND_TOTAL: $round_type = 'total'; break; case Order::ROUND_LINE: $round_type = 'line'; break; case Order::ROUND_ITEM: $round_type = 'item'; break; default: $round_type = 'line'; break; } $display_product_images = Configuration::get('PS_PDF_IMG_INVOICE'); $tax_excluded_display = Group::getPriceDisplayMethod($customer->id_default_group); $layout = $this->computeLayout(array('has_discount' => $has_discount)); $legal_free_text = Hook::exec('displayInvoiceLegalFreeText', array('order' => $this->order)); if (!$legal_free_text) { $legal_free_text = Configuration::get('PS_INVOICE_LEGAL_FREE_TEXT', (int) Context::getContext()->language->id, null, (int) $this->order->id_shop); } $order_obj = new Order($this->order->id); $this->context = Context::getContext(); $products = $order_obj->getProducts(); if (Module::isInstalled('hotelreservationsystem')) { require_once _PS_MODULE_DIR_ . 'hotelreservationsystem/define.php'; $obj_cart_bk_data = new HotelCartBookingData(); $obj_htl_bk_dtl = new HotelBookingDetail(); $obj_rm_type = new HotelRoomType(); $customer = new Customer($this->order->id_customer); if (!empty($products)) { $cart_bk_data = array(); foreach ($products as $type_key => $type_value) { $product = new Product($type_value['product_id'], false, $this->context->language->id); $unit_price = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $cover_image_arr = $product->getCover($type_value['product_id']); if (!empty($cover_image_arr)) { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . $cover_image_arr['id_image'], 'small_default'); } else { $cover_img = $this->context->link->getImageLink($product->link_rewrite, $this->context->language->iso_code . "-default", 'small_default'); } if (isset($customer->id)) { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->order->id_cart, (new Cart($this->order->id_cart))->id_guest, $type_value['product_id'], $customer->id); } else { $cart_bk_data = $obj_cart_bk_data->getOnlyCartBookingData($this->order->id_cart, $customer->id_guest, $type_value['product_id']); } $rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']); $cart_htl_data[$type_key]['id_product'] = $type_value['product_id']; $cart_htl_data[$type_key]['cover_img'] = $cover_img; $cart_htl_data[$type_key]['name'] = $product->name; $cart_htl_data[$type_key]['unit_price'] = Tools::convertPrice($unit_price, $this->order->id_currency); $cart_htl_data[$type_key]['adult'] = $rm_dtl['adult']; $cart_htl_data[$type_key]['children'] = $rm_dtl['children']; foreach ($cart_bk_data as $data_k => $data_v) { $date_join = strtotime($data_v['date_from']) . strtotime($data_v['date_to']); if (isset($cart_htl_data[$type_key]['date_diff'][$date_join])) { $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] += 1; $num_days = $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days']; $vart_quant = (int) $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] * $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $vart_quant; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = Tools::convertPrice($amount, $this->order->id_currency); } else { $num_days = $obj_htl_bk_dtl->getNumberOfDays($data_v['date_from'], $data_v['date_to']); $cart_htl_data[$type_key]['date_diff'][$date_join]['num_rm'] = 1; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_form'] = $data_v['date_from']; $cart_htl_data[$type_key]['date_diff'][$date_join]['data_to'] = $data_v['date_to']; $cart_htl_data[$type_key]['date_diff'][$date_join]['num_days'] = $num_days; $amount = Product::getPriceStatic($type_value['product_id'], true, null, 6, null, false, true, 1); $amount *= $num_days; $cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = Tools::convertPrice($amount, $this->order->id_currency); } } } } } $data = array('cart_htl_data' => $cart_htl_data, 'order' => $this->order, 'order_invoice' => $this->order_invoice, 'order_details' => $order_details, 'cart_rules' => $cart_rules, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'display_product_images' => $display_product_images, 'layout' => $layout, 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer, 'footer' => $footer, 'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_, 'round_type' => $round_type, 'legal_free_text' => $legal_free_text); if (Tools::getValue('debug')) { die(json_encode($data)); } $this->smarty->assign($data); $tpls = array('style_tab' => $this->smarty->fetch($this->getTemplate('invoice.style-tab')), 'addresses_tab' => $this->smarty->fetch($this->getTemplate('invoice.addresses-tab')), 'summary_tab' => $this->smarty->fetch($this->getTemplate('invoice.summary-tab')), 'product_tab' => $this->smarty->fetch($this->getTemplate('invoice.product-tab')), 'tax_tab' => $this->getTaxTabContent(), 'payment_tab' => $this->smarty->fetch($this->getTemplate('invoice.payment-tab')), 'total_tab' => $this->smarty->fetch($this->getTemplate('invoice.total-tab'))); $this->smarty->assign($tpls); return $this->smarty->fetch($this->getTemplateByCountry($country->iso_code)); }
$_SESSION['room_meal_type'] = $_REQUEST['room_meal_type']; $no_of_room = $_REQUEST['no_of_room']; $_SESSION['no_of_room'] = $no_of_room; $room_type_id = $_REQUEST['room_type_id']; print(" <script type='text/javascript'> var check_in_date='" . $check_in_date . "'; var check_out_date='" . $check_out_date . "'; var room_type_id='" . $room_type_id . "'; var room_bed_type='" . $room_bed_type . "'; var room_meal_type='" . $_SESSION['room_meal_type'] . "'; var num_rooms='" . $no_of_room . "'; </script> "); $hotel_room_type = new HotelRoomType(); $hotel = new Hotels(); $country = new country(); $hotel->setHotelId($hotels_id); $hotel->extractor($hotel->getHotelFromId()); $country->setCountryId($_SESSION['country_id']); $hotel_room_type->setRoomTypeId($room_type_id); $hotel_room_type->extractor($hotel_room_type->getHotelRoomTypeFromId()); if ($hotels_id != $hotel_room_type->roomTypeHotelId()) { echo "Error"; die();
</ul> </div> </div> <div class="booking-side-wrapper"> <div class="booking-side clearfix"> <h4 class="title-style4">Your Reservation<span class="title-block"></span></h4> <ul> <li><span>Client Name: </span> <?php echo $bookingclient->name(); ?></li> <li> <span>Address: </span> <?php echo $bookingclient->address1() . "," . $bookingclient->address2(); ?> </li> <li><span>Email: </span><?php echo $bookingclient->email(); ?></li> <li><span>Contact: </span><?php echo $bookingclient->contactno(); ?></li> <li><span>Room: </span> <?php $rooms = new HotelRoomType(); $rooms->setRoomTypeId($reservations->reservationHotelRoomTypeId()); $rooms->extractor($rooms->getHotelRoomTypeFromId()); echo($rooms->roomTypeName()); ?></li> <li> <span>Check In: </span> <?php echo(str_replace("00:00:00", "", $reservations->reservationCheckInDate())); ?> </li> <li> <span>Check Out: </span><?php echo(str_replace("00:00:00", "", $reservations->reservationCheckOutDate())); ?> </li> <li><span>Bed Type: </span> <?php //echo($reservations->reservationBedType()); ?> <?php if ($reservations->reservationBedType() == "sgl") { echo "Single Bed"; } if ($reservations->reservationBedType() == "dbl") { echo "Double Bed";
/** * @param Product $obj * @throws Exception * @throws PrestaShopException * @throws SmartyException */ public function initFormBooking($obj) { $data = $this->createTemplate($this->tpl_form); if ($obj->id) { if ($this->product_exists_in_shop) { $data->assign(array('product' => $obj)); $date_from = Tools::getValue('date_from'); $date_to = Tools::getValue('date_to'); $obj_rm_type = new HotelRoomType(); $obj_booking_dtl = new HotelBookingDetail(); $rm_info = $obj_rm_type->getRoomTypeInfoByIdProduct($obj->id); if ($rm_info) { if ($date_from && $date_to) { $search_flag = 1; $start_date = $date_from; $last_date = $date_to; } else { $date_from = date('Y-m-d'); $date_to = date('Y-m-d', strtotime($date_from) + 86400); $start_date = date('Y-m-01'); // hard-coded '01' for first day $last_date = date('Y-m-t'); } $booking_data = $obj_booking_dtl->getBookingData($date_from, $date_to, $rm_info['id_hotel'], $obj->id, $rm_info['adult'], $rm_info['children'], 0); while ($start_date <= $last_date) { $cal_date_from = $start_date; $cal_date_to = date('Y-m-d', strtotime($cal_date_from) + 86400); $booking_calendar_data[$cal_date_from] = $obj_booking_dtl->getBookingData($date_from, $date_to, $rm_info['id_hotel'], $obj->id, $rm_info['adult'], $rm_info['children'], 0, 1); $start_date = date('Y-m-d', strtotime($start_date) + 86400); } if (isset($search_flag) && $search_flag) { if ($booking_data['stats']['num_avail'] > 0) { $check_css_condition_var = 'available'; } else { if ($booking_data['stats']['num_part_avai'] > 0) { $check_css_condition_var = 'part_available'; } else { $check_css_condition_var = 'unavailable'; } } } else { if ($booking_data['stats']['num_avail'] > 0) { $check_css_condition_var = 'default_available'; } else { if ($booking_data['stats']['num_part_avai'] > 0) { $check_css_condition_var = 'default_part_available'; } else { $check_css_condition_var = 'default_unavailable'; } } } $data->assign(array('rooms_info' => $rm_info, 'check_calendar_var' => 1, 'date_from' => $date_from, 'date_to' => $date_to, 'booking_data' => $booking_data, 'booking_calendar_data' => $booking_calendar_data, 'htl_config' => 1, 'check_css_condition_var' => $check_css_condition_var)); } else { $this->displayWarning($this->l('First you have to fill Room configuration.')); } } else { $this->displayWarning($this->l('You must save the product in this shop before managing hotel configuration.')); } } else { $this->displayWarning($this->l('You must save this product before managing hotel configuration.')); } $this->tpl_form_vars['custom_form'] = $data->fetch(); }
function viewTable($data, $count) { $hotel_room_type = new HotelRoomType(); $paginations = new Paginations(); $paginations->setLimit(10); $paginations->setPage($_REQUEST['page']); $paginations->setJSCallback("viewHotelRoomTypes"); $paginations->setTotalPages($count); $paginations->makePagination(); ?> <div class="mws-panel-header"> <span class="mws-i-24 i-table-1">View Hotel Room Type</span> </div> <div class="mws-panel-body"> <table cellpadding="0" cellspacing="0" border="0" class="mws-datatable-fn mws-table"> <colgroup> <col class="con0"/> <col class="con1"/> </colgroup> <thead> <tr> <th class="head1">Room Type Name</th> <th class="head0"> </th> <th class="head0"> </th> <th class="head1"> </th> </tr> </thead> <tbody> <?php if (count($data) > 0) { ?> <?php for ($i = 0; $i < count($data); $i++) { $hotel_room_type->extractor($data, $i); ?> <tr id="row_<?php echo $hotel_room_type->roomTypeId(); ?> "> <td class="con1"><?php echo $hotel_room_type->roomTypeName(); ?> </td> <td class="con0"><?php //echo $hotel_room_type->categorySeoName(); ?> </td> <td class="con0"><?php //echo $hotel_room_type->username(); ?> </td> <td class="center"><a onclick="loadGUIContent('hotelroomtype','edit','<?php echo $hotel_room_type->roomTypeId(); ?> ')">Edit</a> <a onclick="deleteHotelRoomType(<?php echo $hotel_room_type->roomTypeId(); ?> )" class="toggle">Delete</a></td> </tr> <?php } ?> <?php } ?> </tbody> </table> </div> <?php $paginations->drawPagination(); }