Move customer support options

This commit is contained in:
Abhishek Kumar
2024-02-09 15:01:01 +05:30
parent 5fbe7d5881
commit e02e45b8e2
4 changed files with 36 additions and 48 deletions

View File

@@ -149,6 +149,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'type' => 'text',
'isCleanHtml' => true,
'class' => 'fixed-width-xxl',
'required' => true,
),
'WK_HOTEL_GLOBAL_CONTACT_NUMBER' => array(
'title' => $this->l('Main Branch Phone Number'),
@@ -156,12 +157,26 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
'type' => 'text',
'validation' => 'isPhoneNumber',
'class' => 'fixed-width-xxl',
'required' => true,
),
'WK_HOTEL_GLOBAL_CONTACT_EMAIL' => array(
'title' => $this->l('Main Branch Email'),
'hint' => $this->l('The email address of the main branch. It will be shown on Contact Us page.'),
'type' => 'text',
'class' => 'fixed-width-xxl',
'required' => true,
),
'WK_CUSTOMER_SUPPORT_PHONE_NUMBER' => array(
'title' => $this->l('Support Phone Number'),
'type' => 'text',
'hint' => $this->l('The phone number used for customer service. It will be shown on navigation bar.'),
'class' => 'fixed-width-xxl',
),
'WK_CUSTOMER_SUPPORT_EMAIL' => array(
'title' => $this->l('Support Email'),
'type' => 'text',
'hint' => $this->l('The email used for customer service. It will be shown on navigation bar.'),
'class' => 'fixed-width-xxl',
),
),
'submit' => array(
@@ -384,6 +399,16 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController
} elseif (!Validate::isEmail(Tools::getValue('WK_HOTEL_GLOBAL_CONTACT_EMAIL'))) {
$this->errors[] = $this->l('Hotel global contact email field is invalid');
}
if (trim(Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER')) != '') {
if (!Validate::isPhoneNumber(trim(Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER')))) {
$this->errors[] = $this->l('Support Phone Number is invalid.');
}
}
if (trim(Tools::getValue('WK_CUSTOMER_SUPPORT_EMAIL')) != '') {
if (!Validate::isEmail(trim(Tools::getValue('WK_CUSTOMER_SUPPORT_EMAIL')))) {
$this->errors[] = $this->l('Support Email is invalid.');
}
}
if (!count($this->errors)) {
$objHotelInfo = new HotelBranchInformation();

View File

@@ -103,7 +103,12 @@ class HotelReservationSystem extends Module
public function hookActionFrontControllerSetMedia()
{
$this->context->controller->addCSS($this->getPathUri().'views/css/hook/display-nav.css');
if (Configuration::get('WK_CUSTOMER_SUPPORT_PHONE_NUMBER') != ''
|| Configuration::get('WK_CUSTOMER_SUPPORT_EMAIL') != ''
) {
$this->context->controller->addCSS($this->getPathUri().'views/css/hook/display-nav.css');
}
}
public function hookDisplayNav()
@@ -126,46 +131,6 @@ class HotelReservationSystem extends Module
return $this->display(__FILE__, 'external-navigation-hook.tpl');
}
public function hookActionAdminHotelGeneralSettingsOptionsModifier($params)
{
$params['options']['contactdetail']['fields'] = array_merge(
$params['options']['contactdetail']['fields'],
array(
'WK_CUSTOMER_SUPPORT_PHONE_NUMBER' => array(
'title' => $this->l('Support Phone Number'),
'type' => 'text',
'hint' => $this->l('The phone number used for customer service. It will be shown on navigation bar.'),
'class' => 'fixed-width-xxl',
),
'WK_CUSTOMER_SUPPORT_EMAIL' => array(
'title' => $this->l('Support Email'),
'type' => 'text',
'hint' => $this->l('The email used for customer service. It will be shown on navigation bar.'),
'class' => 'fixed-width-xxl',
),
)
);
}
public function hookActionAdminHotelGeneralSettingsControllerUpdate_optionsBefore()
{
$phone = Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER');
$email = Tools::getValue('WK_CUSTOMER_SUPPORT_EMAIL');
if ($phone != '' && !Validate::isPhoneNumber($phone)) {
$this->context->controller->errors[] = $this->l('Support Phone Number is invalid.');
}
if ($email != '' && !Validate::isEmail($email)) {
$this->context->controller->errors[] = $this->l('Support Email is invalid.');
}
if (!count($this->context->controller->errors)) {
Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', $phone);
Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', $email);
}
}
public function cartBookingDataForMail($order)
{
$result = array();
@@ -703,8 +668,6 @@ class HotelReservationSystem extends Module
'actionFrontControllerSetMedia',
'displayNav',
'displayExternalNavigationHook',
'actionAdminHotelGeneralSettingsOptionsModifier',
'actionAdminHotelGeneralSettingsControllerUpdate_optionsBefore',
)
);
}

View File

@@ -17,13 +17,13 @@
* @license LICENSE.txt
*}
{if $email}
{if $email != ''}
<div class="contact-item">
<i class="icon-envelope-o"></i>
<a href="mailto:{$email}">{$email}</a>
</div>
{/if}
{if $phone}
{if $phone != ''}
<div class="contact-item">
<i class="icon-phone"></i>
<a href="tel:{$phone}">{$phone}</a>

View File

@@ -17,9 +17,9 @@
* @license LICENSE.txt
*}
{if $email || $phone}
{if ($email != '') || ($phone != '')}
<ul class="nav nav-pills nav-stacked visible-xs wk-nav-style">
{if $email}
{if $email != ''}
<li>
<a href="mailto:{$email}">
<i class="icon-envelope-o"></i>
@@ -27,7 +27,7 @@
</a>
</li>
{/if}
{if $phone}
{if $phone != ''}
<li>
<a href="tel:{$phone}">
<i class="icon-phone"></i>