first commit
This commit is contained in:
12
modules/ps_contactinfo/config.xml
Normal file
12
modules/ps_contactinfo/config.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>ps_contactinfo</name>
|
||||
<displayName><![CDATA[Contact information]]></displayName>
|
||||
<version><![CDATA[3.3.0]]></version>
|
||||
<description><![CDATA[Allows you to display additional information about your store's customer service.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[front_office_features]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
12
modules/ps_contactinfo/config_pl.xml
Normal file
12
modules/ps_contactinfo/config_pl.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<module>
|
||||
<name>ps_contactinfo</name>
|
||||
<displayName><![CDATA[Informacje kontaktowe]]></displayName>
|
||||
<version><![CDATA[3.3.0]]></version>
|
||||
<description><![CDATA[Pozwala wyświetlić dodatkowe informacje dotyczące Biura obsługi klienta w sklepie.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[]]></tab>
|
||||
<is_configurable>1</is_configurable>
|
||||
<need_instance>1</need_instance>
|
||||
<limited_countries></limited_countries>
|
||||
</module>
|
||||
35
modules/ps_contactinfo/index.php
Normal file
35
modules/ps_contactinfo/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
||||
BIN
modules/ps_contactinfo/logo.png
Normal file
BIN
modules/ps_contactinfo/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
39
modules/ps_contactinfo/nav.tpl
Normal file
39
modules/ps_contactinfo/nav.tpl
Normal file
@@ -0,0 +1,39 @@
|
||||
{*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div id="contact-link">
|
||||
<a href="{$urls.pages.contact}">{l s='Contact us' d='Modules.Contactinfo.Shop'}</a>
|
||||
{if $contact_infos.phone}
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l
|
||||
s='Call us: [1]%phone%[/1]'
|
||||
sprintf=[
|
||||
'[1]' => '<span>',
|
||||
'[/1]' => '</span>',
|
||||
'%phone%' => $contact_infos.phone
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
</div>
|
||||
67
modules/ps_contactinfo/ps_contactinfo-rich.tpl
Normal file
67
modules/ps_contactinfo/ps_contactinfo-rich.tpl
Normal file
@@ -0,0 +1,67 @@
|
||||
{*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div class="block-contact">
|
||||
<h4>{l s='Store information' d='Modules.Contactinfo.Shop'}</h4>
|
||||
{$contact_infos.address.formatted nofilter}
|
||||
{if $contact_infos.phone}
|
||||
<br>
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l s='Call us: [1]%phone%[/1]'
|
||||
sprintf=[
|
||||
'[1]' => '<span>',
|
||||
'[/1]' => '</span>',
|
||||
'%phone%' => $contact_infos.phone
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
{if $contact_infos.fax}
|
||||
<br>
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l
|
||||
s='Fax: [1]%fax%[/1]'
|
||||
sprintf=[
|
||||
'[1]' => '<span>',
|
||||
'[/1]' => '</span>',
|
||||
'%fax%' => $contact_infos.fax
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
{if $contact_infos.email && $display_email}
|
||||
<br>
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l
|
||||
s='Email us: [1]%email%[/1]'
|
||||
sprintf=[
|
||||
'[1]' => '<span>',
|
||||
'[/1]' => '</span>',
|
||||
'%email%' => $contact_infos.email
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
</div>
|
||||
183
modules/ps_contactinfo/ps_contactinfo.php
Normal file
183
modules/ps_contactinfo/ps_contactinfo.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
use PrestaShop\PrestaShop\Core\Module\WidgetInterface;
|
||||
|
||||
class Ps_Contactinfo extends Module implements WidgetInterface
|
||||
{
|
||||
private $templates = array (
|
||||
'light' => 'nav.tpl',
|
||||
'rich' => 'ps_contactinfo-rich.tpl',
|
||||
'default' => 'ps_contactinfo.tpl',
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'ps_contactinfo';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->version = '3.3.0';
|
||||
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->getTranslator()->trans('Contact information', array(), 'Modules.Contactinfo.Admin');
|
||||
$this->description = $this->getTranslator()->trans('Allows you to display additional information about your store\'s customer service.', array(), 'Modules.Contactinfo.Admin');
|
||||
$this->ps_versions_compliancy = array('min' => '1.7.2.0', 'max' => _PS_VERSION_);
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
return parent::install()
|
||||
&& Configuration::updateValue('PS_CONTACT_INFO_DISPLAY_EMAIL', 1)
|
||||
&& $this->registerHook([
|
||||
'displayNav', // Standard hook
|
||||
'displayNav1', // For Classic-inspired themes
|
||||
'displayFooter',
|
||||
'actionAdminStoresControllerUpdate_optionsAfter',
|
||||
]);
|
||||
}
|
||||
|
||||
public function renderWidget($hookName = null, array $configuration = [])
|
||||
{
|
||||
if ($hookName == null && isset($configuration['hook'])) {
|
||||
$hookName = $configuration['hook'];
|
||||
}
|
||||
|
||||
if (preg_match('/^displayNav\d*$/', $hookName)) {
|
||||
$template_file = $this->templates['light'];
|
||||
} elseif ($hookName == 'displayLeftColumn' || $hookName == 'displayRightColumn') {
|
||||
$template_file = $this->templates['rich'];
|
||||
} else {
|
||||
$template_file = $this->templates['default'];
|
||||
}
|
||||
|
||||
$this->smarty->assign($this->getWidgetVariables($hookName, $configuration));
|
||||
|
||||
return $this->fetch('module:'.$this->name.'/'.$template_file);
|
||||
}
|
||||
|
||||
public function getWidgetVariables($hookName = null, array $configuration = [])
|
||||
{
|
||||
$address = $this->context->shop->getAddress();
|
||||
|
||||
$is_state_multilang = !empty(State::$definition['multilang']);
|
||||
$state_name = (new State($address->id_state))->name;
|
||||
|
||||
$contact_infos = [
|
||||
'company' => Configuration::get('PS_SHOP_NAME'),
|
||||
'address' => [
|
||||
'formatted' => AddressFormat::generateAddress($address, array(), '<br />'),
|
||||
'address1' => $address->address1,
|
||||
'address2' => $address->address2,
|
||||
'postcode' => $address->postcode,
|
||||
'city' => $address->city,
|
||||
'state' => $is_state_multilang ? $state_name[$this->context->language->id] : $state_name,
|
||||
'country' => (new Country($address->id_country))->name[$this->context->language->id],
|
||||
],
|
||||
'nip' => Configuration::get('PS_SHOP_DETAILS'),
|
||||
'phone' => Configuration::get('PS_SHOP_PHONE'),
|
||||
'fax' => Configuration::get('PS_SHOP_FAX'),
|
||||
'email' => Configuration::get('PS_SHOP_EMAIL'),
|
||||
|
||||
];
|
||||
|
||||
return [
|
||||
'contact_infos' => $contact_infos,
|
||||
'display_email' => Configuration::get('PS_CONTACT_INFO_DISPLAY_EMAIL'),
|
||||
];
|
||||
}
|
||||
|
||||
public function hookActionAdminStoresControllerUpdate_optionsAfter()
|
||||
{
|
||||
foreach ($this->templates as $template) {
|
||||
$this->_clearCache($template);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = [];
|
||||
|
||||
if (Tools::isSubmit('submitContactInfo')) {
|
||||
Configuration::updateValue('PS_CONTACT_INFO_DISPLAY_EMAIL', (int)Tools::getValue('PS_CONTACT_INFO_DISPLAY_EMAIL'));
|
||||
|
||||
foreach ($this->templates as $template) {
|
||||
$this->_clearCache($template);
|
||||
}
|
||||
|
||||
$output[] = $this->displayConfirmation($this->trans('Settings updated.', array(), 'Admin.Notifications.Success'));
|
||||
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true).'&conf=6&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name);
|
||||
}
|
||||
|
||||
$helper = new HelperForm();
|
||||
$helper->submit_action = 'submitContactInfo';
|
||||
|
||||
$field = array(
|
||||
'type' => 'switch',
|
||||
'label' => $this->trans('Display email address', array(), 'Admin.Actions'),
|
||||
'name' => 'PS_CONTACT_INFO_DISPLAY_EMAIL',
|
||||
'desc' => $this->trans('Your theme needs to be compatible with this feature', array(), 'Modules.Contactinfo.Admin'),
|
||||
'values' => array(
|
||||
array(
|
||||
'id' => 'active_on',
|
||||
'value' => 1,
|
||||
'label' => $this->trans('Yes', array(), 'Admin.Global')
|
||||
),
|
||||
array(
|
||||
'id' => 'active_off',
|
||||
'value' => 0,
|
||||
'label' => $this->trans('No', array(), 'Admin.Global')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$helper->fields_value['PS_CONTACT_INFO_DISPLAY_EMAIL'] = Configuration::get('PS_CONTACT_INFO_DISPLAY_EMAIL');
|
||||
|
||||
$output[] = $helper->generateForm(array(
|
||||
array(
|
||||
'form' => array(
|
||||
'legend' => array(
|
||||
'title' => $this->displayName,
|
||||
'icon' => 'icon-share'
|
||||
),
|
||||
'input' => [$field],
|
||||
'submit' => array(
|
||||
'title' => $this->trans('Save', array(), 'Admin.Actions')
|
||||
)
|
||||
)
|
||||
)
|
||||
));
|
||||
|
||||
return implode($output);
|
||||
}
|
||||
}
|
||||
64
modules/ps_contactinfo/ps_contactinfo.tpl
Normal file
64
modules/ps_contactinfo/ps_contactinfo.tpl
Normal file
@@ -0,0 +1,64 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
<div class="block-contact">
|
||||
<h4>{l s='Contact us' d='Shop.Theme.Global'}</h4>
|
||||
{$contact_infos.address.formatted nofilter}
|
||||
{if $contact_infos.phone}
|
||||
<br>
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l
|
||||
s='Tel: %phone%'
|
||||
sprintf=[
|
||||
'%phone%' => $contact_infos.phone
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
{if $contact_infos.fax}
|
||||
<br>
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l
|
||||
s='Fax: %fax%'
|
||||
sprintf=[
|
||||
'%fax%' => $contact_infos.fax
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
{if $contact_infos.email && $display_email}
|
||||
<br>
|
||||
{* First tag [1][/1] is for a HTML tag. *}
|
||||
{l
|
||||
s='Email: [1]%email%[/1]'
|
||||
sprintf=[
|
||||
'%email%' => $contact_infos.email,
|
||||
'[1]' => '<a href="mailto:'|cat:$contact_infos.email|cat:'">',
|
||||
'[/1]' => '</a>'
|
||||
]
|
||||
d='Modules.Contactinfo.Shop'
|
||||
}
|
||||
{/if}
|
||||
</div>
|
||||
35
modules/ps_contactinfo/translations/index.php
Normal file
35
modules/ps_contactinfo/translations/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
0
modules/ps_contactinfo/translations/pl.php
Normal file
0
modules/ps_contactinfo/translations/pl.php
Normal file
35
modules/ps_contactinfo/upgrade/index.php
Normal file
35
modules/ps_contactinfo/upgrade/index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
10
modules/ps_contactinfo/upgrade/upgrade-from-blockcontact.php
Normal file
10
modules/ps_contactinfo/upgrade/upgrade-from-blockcontact.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_'))
|
||||
exit;
|
||||
|
||||
function upgrade_module_2_0($object)
|
||||
{
|
||||
return Configuration::deleteByName('BLOCKCONTACT_TELNUMBER')
|
||||
&& Configuration::deleteByName('BLOCKCONTACT_EMAIL');
|
||||
}
|
||||
Reference in New Issue
Block a user