Skip to content

Added: Our properties controller in the front office, and updated the store detail flow in the back office. #1411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions classes/controller/FrontController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@ public function initHeader()
'token' => Tools::getToken(),
'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_,
'content_only' => (int)Tools::getValue('content_only'),
'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => Configuration::get('WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER'),
));

$this->context->smarty->assign($this->initLogoAndFavicon());
Expand Down
1 change: 1 addition & 0 deletions controllers/admin/AdminStoresController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class AdminStoresControllerCore extends AdminController
{
public function __construct()
{
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminDashboard'));
$this->bootstrap = true;
$this->table = 'store';
$this->className = 'Store';
Expand Down
25 changes: 17 additions & 8 deletions controllers/front/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,17 @@ public function initContent()
}
$this->context->smarty->assign('customerThread', $customer_thread);
}
// Send Hotel location information
$gblHtlAddress = Configuration::get('WK_HOTEL_GLOBAL_ADDRESS');
$gblHtlPhone = Configuration::get('WK_HOTEL_GLOBAL_CONTACT_NUMBER');
$gblHtlEmail = Configuration::get('WK_HOTEL_GLOBAL_CONTACT_EMAIL');

$objShop = new Shop();
$shopAddress = '';
$shopAddress_obj = $objShop->getAddress();
if (isset($shopAddress_obj) && $shopAddress_obj instanceof Address) {
$shopAddress = AddressFormat::generateAddress($shopAddress_obj, array(), ' - ', ' ');
}

$gblHtlAddress = $shopAddress;
$gblHtlPhone = Configuration::get('PS_SHOP_PHONE');
$gblHtlEmail = Configuration::get('PS_SHOP_EMAIL');
$objHotelInfo = new HotelBranchInformation();
if ($hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1, 1)) {
foreach ($hotelsInfo as &$hotel) {
Expand All @@ -310,12 +317,15 @@ public function initContent()

$contactKey = md5(uniqid(microtime(), true));
$this->context->cookie->__set('contactFormKey', $contactKey);
$displayHotelMap = Configuration::get('WK_CONTACT_DISPLAY_HOTEL_MAP');
$this->context->smarty->assign(
array(
'hotelsInfo' => $hotelsInfo,
'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
'displayHotels' => Configuration::get('WK_CONTACT_DISPLAY_HOTEL_LIST'),
'gblHtlPhone' => $gblHtlPhone,
'gblHtlEmail' => $gblHtlEmail,
'displayHotelMap' => $displayHotelMap,
'gblHtlAddress' => $gblHtlAddress,
'contacts' => Contact::getContacts($this->context->language->id),
'message' => html_entity_decode(Tools::getValue('message')),
Expand All @@ -324,10 +334,9 @@ public function initContent()
);

//By webkul to send hotels Map Informations for google Map.
if (Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
$hotelLocationArray = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'));
if ($hotelLocationArray) {
$this->context->smarty->assign('hotelLocationArray', json_encode($hotelLocationArray));
if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
if ($hotelLocationArray = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'))) {
$this->context->smarty->assign('hotelLocationArray', str_replace(array('\n', '\r'), '', json_encode($hotelLocationArray)));
}
}
//End
Expand Down
161 changes: 161 additions & 0 deletions controllers/front/PropertiesController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a newer
* versions in the future. If you wish to customize this module for your needs
* please refer to https://store.webkul.com/customisation-guidelines for more information.
*
* @author Webkul IN
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*/

class PropertiesControllerCore extends FrontController
{
public $php_self = 'properties';

/**
* Assign template vars related to page content
* @see FrontController::initContent()
*/
public function initContent()
{
$this->display_column_left = false;
$this->display_column_right = false;

parent::initContent();
$hotelsInfo = array();
$hotelLocationArray = 0;
$pageLimit = 0;
$displayHotelMap = Configuration::get('WK_PROPERTIES_DISPLAY_HOTEL_MAP');
if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) {
$objModule = Module::getInstanceByName('hotelreservationsystem');
$objHotelInfo = new HotelBranchInformation();
if ($hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1, 1)) {
foreach ($hotelsInfo as &$hotel) {
if (isset($hotel['id_cover_img'])
&& $hotel['id_cover_img']
&& Validate::isLoadedObject(
$objHotelImage = new HotelImage($hotel['id_cover_img'])
)
) {
$htlImgLink = $this->context->link->getMediaLink($objHotelImage->getImageLink($hotel['id_cover_img'], ImageType::getFormatedName('medium')));
if ((bool)Tools::file_get_contents($htlImgLink)) {
$hotel['image_url'] = $htlImgLink;
} else {
$hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png');
}
} else {
$hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png');
}

$hotel['view_rooms_link'] = $this->context->link->getCategoryLink(
new Category($hotel['id_category'], $this->context->language->id),
null,
$this->context->language->id
);
}

// To store max number pages.
$pageLimit = ceil(count($hotelsInfo)/10);

if (!($page = Tools::getValue('pagination'))) {
$page = 1;
} else if (!$pageLimit || ($page > $pageLimit)) {
$page = 1;
}

$pagination = array();
if ($pageLimit) {
$pageNumber = $page - 2;
if ($pageNumber < 1) {
$pageNumber = 1;
}

while ($page + 4 >= $pageNumber && count($pagination) < 5) {
if ($pageNumber > $pageLimit) {
$firstItem = reset($pagination) - 1;
if ($firstItem > 0) {
$pagination[$firstItem] = $firstItem;
}
} else {
$pagination[$pageNumber] = $pageNumber;
}

$pageNumber++;
}
}

ksort($pagination);

$this->context->smarty->assign(
array(
'pagination' => $pagination,
'currentPage' => $page,
'pageLimit' => $pageLimit,
'currentPageUrl' => $this->context->link->getPageLink($this->php_self)
)
);

$page--;
// To show 10 Hotel per page
$hotelsInfo = array_slice($hotelsInfo, $page * 10, 10);
}

if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
if ($hotelLocations = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'))) {
$hotelLocationArray = str_replace(array('\n', '\r'), '', json_encode($hotelLocations));
}
}
}

Media::addJsDef(
array(
'hotelLocationArray' => $hotelLocationArray
)
);

$this->context->smarty->assign(
array(
'hotelsInfo' => $hotelsInfo,
'hotelLocationArray' => $hotelLocationArray,
'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'),
'displayHotelMap' => $displayHotelMap,
'WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id),
'currentIndex' => $this->context->link->getPageLink('properties')
)
);

$this->setTemplate(_PS_THEME_DIR_.'properties.tpl');
}

public function setMedia()
{
parent::setMedia();
$this->addJS(_THEME_JS_DIR_.'properties.js');
$this->addCSS(_THEME_CSS_DIR_.'properties.css');
// GOOGLE MAP
if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) {
Media::addJsDef(
array(
'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')),
)
);
$this->addJS(
'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY.
'&libraries=places&language='.$this->context->language->iso_code.'&region='.$this->context->country->iso_code
);
}
}
}
5 changes: 5 additions & 0 deletions controllers/front/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ class SitemapControllerCore extends FrontController
{
public $php_self = 'sitemap';

public function init()
{
Tools::redirect($this->context->link->getPageLink('index'));
}

public function setMedia()
{
parent::setMedia();
Expand Down
4 changes: 4 additions & 0 deletions install/data/xml/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<page>sitemap</page>
<configurable>1</configurable>
</meta>
<meta id="properties">
<page>properties</page>
<configurable>1</configurable>
</meta>
<meta id="supplier">
<page>supplier</page>
<configurable>1</configurable>
Expand Down
4 changes: 2 additions & 2 deletions install/data/xml/tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@
<tab id="Images" id_parent="Preferences" active="1" hide_host_mode="0">
<class_name>AdminImages</class_name>
</tab>
<tab id="Store_Contacts" id_parent="Preferences" active="1" hide_host_mode="0">
<!-- <tab id="Store_Contacts" id_parent="Preferences" active="1" hide_host_mode="0">
<class_name>AdminStores</class_name>
</tab>
</tab> -->
<tab id="Search_1" id_parent="Preferences" active="1" hide_host_mode="0">
<class_name>AdminSearchConf</class_name>
</tab>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/bg/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>order-follow</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Our Properties</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id="order-slip" id_shop="1">
<title>Credit slip</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/bn/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@
<keywords/>
<url_rewrite>order-slip</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>আমাদের সম্পত্তি</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id='order' id_shop='1'>
<title>অর্ডার </title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/br/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>acompanhar-meu-pedido</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Hon tiez</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id='order-slip' id_shop='1'>
<title>Nota do pedido</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/cs/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>order-follow</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Naše nemovitosti</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id="order-slip" id_shop="1">
<title>Dobropis</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/de/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>bestellungsverfolgung</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Unsere Immobilien</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id="order-slip" id_shop="1">
<title>Bestellschein</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/en/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>order-follow</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Our Properties</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id="order-slip" id_shop="1">
<title>Credit slip</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/es/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>seguimiento-pedido</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Nuestras propiedades</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id='order-slip' id_shop='1'>
<title>Albarán</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/fa/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>order-follow</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>املاک ما</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id="order-slip" id_shop="1">
<title>رسید سفارش</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/fr/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>suivi-commande</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>Nos propriétés</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id='order-slip' id_shop='1'>
<title>Avoirs</title>
<description/>
Expand Down
6 changes: 6 additions & 0 deletions install/langs/he/data/meta.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<keywords/>
<url_rewrite>מעקב-הזמנות</url_rewrite>
</meta>
<meta id='properties' id_shop='1'>
<title>הנכסים שלנו</title>
<description/>
<keywords/>
<url_rewrite>properties</url_rewrite>
</meta>
<meta id="order-slip" id_shop="1">
<title>שוברי הזמנה</title>
<description/>
Expand Down
Loading