nickjhn Posted August 23, 2012 Share Posted August 23, 2012 Hi, I want to add another phone number to the contact module block on the new prestashop theme. How do I do it so that it still has the phone icon next to it? Thanks! Link to comment Share on other sites More sharing options...
nickjhn Posted August 24, 2012 Author Share Posted August 24, 2012 can anyone help? Link to comment Share on other sites More sharing options...
adelnaser Posted July 27, 2013 Share Posted July 27, 2013 up Link to comment Share on other sites More sharing options...
PascalVG Posted July 27, 2013 Share Posted July 27, 2013 Hi Adelnaser, Hope you mean the module with the woman telephoning: (blockcontact): here we go: Edit file: /modules/blockcontact/bockcontact.php: (N.B. Backup file first!) Add red code: (N.B. Easily done. Mostly copy code piece of original phone number( number 1) and add a '2' behind it) public function install() { return parent::install() && Configuration::updateValue('blockcontact_telnumber', '') && Configuration::updateValue('blockcontact_telnumber2', '') && Configuration::updateValue('blockcontact_email', '') && $this->registerHook('displayRightColumn') && $this->registerHook('displayHeader'); } public function uninstall() { // Delete configuration return Configuration::deleteByName('blockcontact_telnumber') && Configuration::deleteByName('blockcontact_telnumber2') && Configuration::deleteByName('blockcontact_email') && parent::uninstall(); } public function getContent() { $html = ''; // If we try to update the settings if (Tools::isSubmit('submitModule')) { Configuration::updateValue('blockcontact_telnumber', Tools::getValue('telnumber')); Configuration::updateValue('blockcontact_telnumber2', Tools::getValue('telnumber2')); Configuration::updateValue('blockcontact_email', Tools::getValue('email')); $this->_clearCache('blockcontact.tpl'); $html .= '<div class="conf confirm">'.$this->l('Configuration updated').'</div>'; } $html .= ' <h2>'.$this->displayName.'</h2> <form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post"> <fieldset> <label for="telnumber">'.$this->l('Telephone number:').'</label> <input type="text" id="telnumber" name="telnumber" value="'.((Configuration::get('blockcontact_telnumber') != '') ? Tools::safeOutput(Configuration::get('blockcontact_telnumber')) : '').'" /> <div class="clear"> </div> <label for="telnumber2">'.$this->l('2nd telephone number:').'</label> <input type="text" id="telnumber2" name="telnumber2" value="'.((Configuration::get('blockcontact_telnumber2') != '') ? Tools::safeOutput(Configuration::get('blockcontact_telnumber2')) : '').'" /> <div class="clear"> </div> <label for="email">'.$this->l('Email').'</label> <input type="text" id="email" name="email" value="'.((Configuration::get('blockcontact_email') != '') ? Tools::safeOutput(Configuration::get('blockcontact_email')) : '').'" /> <div class="clear"> </div> <div class="margin-form"> <input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center> </div> </fieldset> </form>'; return $html; } public function hookDisplayRightColumn() { global $smarty; if (!$this->isCached('blockcontact.tpl', $this->getCacheId())) $smarty->assign(array( 'telnumber' => Configuration::get('blockcontact_telnumber'), 'telnumber2' => Configuration::get('blockcontact_telnumber2'), 'email' => Configuration::get('blockcontact_email') )); return $this->display(__FILE__, 'blockcontact.tpl', $this->getCacheId()); } --------------------------------------------------------------------------------- Then edit file: /themes/<your theme folder>/modules/blockcontact/blockcontact.tpl. (N.B. If you don't have this file, COPY it to this place from /modules/blockcontact/blockcontact.tpl) (N.B. Backup file first!) Add red code: (N.B. Easily done again. Mostly copy code piece of original phone number( number 1) and add a '2' behind it) <div id="contact_block" class="block"> <p class="title_block">{l s='Contact us' mod='blockcontact'}</p> <div class="block_content clearfix"> <p>{l s='Our hotline is available 24/7' mod='blockcontact'}</p> {if $telnumber != ''}<p class="tel"><span class="label">{l s='Phone:' mod='blockcontact'}</span>{$telnumber|escape:'htmlall':'UTF-8'}</p>{/if} {if $telnumber2 != ''}<p class="tel"><span class="label">{l s='2nd phone:' mod='blockcontact'}</span>{$telnumber2|escape:'htmlall':'UTF-8'}</p>{/if} {if $email != ''}<a href="mailto:{$email|escape:'htmlall':'UTF-8'}">{l s='Contact our hotline' mod='blockcontact'}</a>{/if} </div> </div> (N.B. As you can see, we DON'T change the code piece <p class="tel">. We just reuse the tel class css code) ------------------------------------------------------------------------------------------------ Finally, the lady will be a little too low when adding a 2nd phone number, so we move the background picture up a little. Edit file: modules/blockcontact/blockcontact.css (N.B. Backup file first!) Add red code: #contact_block .block_content { padding:10px 0 15px 0; background: url(images/block_contact_bg.jpg) no-repeat left bottom transparent; background-position-y: 60px; } save all files and go to modules->modules - filter on "Front office modules" on the left to easily find the block contact module. - Click 'Reset' link. The module will be reinstalled, adding the 2nd tel number field to the configuration screen. - Click 'configuration' link and add both tel numbers. - Click Update values to store the new phone number. - Go to your shop and reload the front page. See if it works (if no change, go to Back office->Advanced parameters->Performance and change the 'Template cache' to "Recompile templates when the files have been updated" and turn cache to OFF. then reload shop page again. (When everything shows ok, turn cache to ON again!) Hope this does the trick. pascal Link to comment Share on other sites More sharing options...
PascalVG Posted July 27, 2013 Share Posted July 27, 2013 N.B. The module block contact info also has a phone number. You can easily do the same trick here, by just copying the code of phone number 1. Let me know if you need help with this one as well. pascal Link to comment Share on other sites More sharing options...
vekia Posted July 27, 2013 Share Posted July 27, 2013 you can also add it manually in the module .tpl file, it's simplest method than Pascals, but in my opinion it is better to follow his suggestions, you will be able to edit it in BO Link to comment Share on other sites More sharing options...
adelnaser Posted July 27, 2013 Share Posted July 27, 2013 Hi guys, First of all GOD BLESS YOU!!! I've been 6 hours on this thing and finally a solution!!! @ vekia: I already tried that way but I couldn't add a logo to the numbers, I have 3 phone networks in my country and want to add a logo in front of each number, dont know why but I couldnt add one, it just didnt show. @ Pascal: You`re a life saver!!!! Everything worked fine BUT, it seems something is wrong after I press Update Settings... The 3rd field numer (I added 2 more fields) goes at top in the 1st number position and thats the only number that shows on the block.. what did I miss? Also, for me to add 3 logo's I added p.tel2 and p.tel3 sections in the css file and assigned telnumber2 to p.tel2 and so on.. I think this is ok and didnt mess anything up Can you please tell me what to modify for the savings to take effect? Screens attached Link to comment Share on other sites More sharing options...
PascalVG Posted July 28, 2013 Share Posted July 28, 2013 Looks like you missed some change from telnumber to telnumber2 or telnumber3 So please double/triple check if you added all changes correctly. To give some reference/comparison option for three phone numbers, here My files in total, adjusted for three phone numbers (modified files of Prestashop Version 1.5.4.1): FILE: /modules/blockcontact/blockcontact.php: <?php /* * 2007-2013 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 [email protected] 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 <[email protected]> * @copyright 2007-2013 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('_CAN_LOAD_FILES_')) exit; class Blockcontact extends Module { public function __construct() { $this->name = 'blockcontact'; $this->tab = 'front_office_features'; $this->version = '1.0'; parent::__construct(); $this->displayName = $this->l('Contact Block'); $this->description = $this->l('Allows you to add additional information about your store\'s customer service.'); } public function install() { return parent::install() && Configuration::updateValue('blockcontact_telnumber', '') && Configuration::updateValue('blockcontact_telnumber2', '') && Configuration::updateValue('blockcontact_telnumber3', '') && Configuration::updateValue('blockcontact_email', '') && $this->registerHook('displayRightColumn') && $this->registerHook('displayHeader'); } public function uninstall() { // Delete configuration return Configuration::deleteByName('blockcontact_telnumber') && Configuration::deleteByName('blockcontact_telnumber2') && Configuration::deleteByName('blockcontact_telnumber3') && Configuration::deleteByName('blockcontact_email') && parent::uninstall(); } public function getContent() { $html = ''; // If we try to update the settings if (Tools::isSubmit('submitModule')) { Configuration::updateValue('blockcontact_telnumber', Tools::getValue('telnumber')); Configuration::updateValue('blockcontact_telnumber2', Tools::getValue('telnumber2')); Configuration::updateValue('blockcontact_telnumber3', Tools::getValue('telnumber3')); Configuration::updateValue('blockcontact_email', Tools::getValue('email')); $this->_clearCache('blockcontact.tpl'); $html .= '<div class="conf confirm">'.$this->l('Configuration updated').'</div>'; } $html .= ' <h2>'.$this->displayName.'</h2> <form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post"> <fieldset> <label for="telnumber">'.$this->l('Telephone number:').'</label> <input type="text" id="telnumber" name="telnumber" value="'.((Configuration::get('blockcontact_telnumber') != '') ? Tools::safeOutput(Configuration::get('blockcontact_telnumber')) : '').'" /> <div class="clear"> </div> <label for="telnumber2">'.$this->l('2nd telephone number:').'</label> <input type="text" id="telnumber2" name="telnumber2" value="'.((Configuration::get('blockcontact_telnumber2') != '') ? Tools::safeOutput(Configuration::get('blockcontact_telnumber2')) : '').'" /> <div class="clear"> </div> <label for="telnumber3">'.$this->l('3rd telephone number:').'</label> <input type="text" id="telnumber3" name="telnumber3" value="'.((Configuration::get('blockcontact_telnumber3') != '') ? Tools::safeOutput(Configuration::get('blockcontact_telnumber3')) : '').'" /> <div class="clear"> </div> <label for="email">'.$this->l('Email').'</label> <input type="text" id="email" name="email" value="'.((Configuration::get('blockcontact_email') != '') ? Tools::safeOutput(Configuration::get('blockcontact_email')) : '').'" /> <div class="clear"> </div> <div class="margin-form"> <input type="submit" name="submitModule" value="'.$this->l('Update settings').'" class="button" /></center> </div> </fieldset> </form>'; return $html; } public function hookDisplayHeader() { $this->context->controller->addCSS(($this->_path).'blockcontact.css', 'all'); } public function hookDisplayRightColumn() { global $smarty; if (!$this->isCached('blockcontact.tpl', $this->getCacheId())) $smarty->assign(array( 'telnumber' => Configuration::get('blockcontact_telnumber'), 'telnumber2' => Configuration::get('blockcontact_telnumber2'), 'telnumber3' => Configuration::get('blockcontact_telnumber3'), 'email' => Configuration::get('blockcontact_email') )); return $this->display(__FILE__, 'blockcontact.tpl', $this->getCacheId()); } public function hookDisplayLeftColumn() { return $this->hookDisplayRightColumn(); } } ?> FILE: themes/<YOUR THEME FOLDER>/modules/blockcontact/blockcontact.tpl {* * 2007-2013 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 [email protected] 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 <[email protected]> * @copyright 2007-2013 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_block" class="block"> <p class="title_block">{l s='Contact us' mod='blockcontact'}</p> <div class="block_content clearfix"> <p>{l s='Our hotline is available 24/7' mod='blockcontact'}</p> {if $telnumber != ''}<p class="tel"><span class="label">{l s='Phone:' mod='blockcontact'}</span>{$telnumber|escape:'htmlall':'UTF-8'}</p>{/if} {if $telnumber2 != ''}<p class="tel"><span class="label">{l s='2nd phone:' mod='blockcontact'}</span>{$telnumber2|escape:'htmlall':'UTF-8'}</p>{/if} {if $telnumber3 != ''}<p class="tel"><span class="label">{l s='3rd phone:' mod='blockcontact'}</span>{$telnumber3|escape:'htmlall':'UTF-8'}</p>{/if} {if $email != ''}<a href="mailto:{$email|escape:'htmlall':'UTF-8'}">{l s='Contact our hotline' mod='blockcontact'}</a>{/if} </div> </div> Hope this helps. Let me know, pascal Link to comment Share on other sites More sharing options...
adelnaser Posted July 28, 2013 Share Posted July 28, 2013 I must've probably missed something... THANK YOU VERY MUCH Pascal!!!!!!!!! Result: Link to comment Share on other sites More sharing options...
PascalVG Posted July 28, 2013 Share Posted July 28, 2013 You're welcome. Glad it worked! I'll mark the tropic as solved :-) Pascal Link to comment Share on other sites More sharing options...
klara_galaxee Posted March 5, 2014 Share Posted March 5, 2014 Hello!I followed all the steps above, copied the code in the section where PascaVG wrote this Looks like you missed some change from telnumber to telnumber2 or telnumber3 So please double/triple check if you added all changes correctly. in my .tpl and .php files and the inputs and labels were added in my admin panel but in my browser it didn't applied yet. What did I do wrong? I attached a photo of my admin panel how it looks but the extra numbers didn't applied yet. What should I do? Link to comment Share on other sites More sharing options...
vekia Posted March 5, 2014 Share Posted March 5, 2014 have you tried to clear shop cache? Link to comment Share on other sites More sharing options...
klara_galaxee Posted March 6, 2014 Share Posted March 6, 2014 yes, I cleared cache but it still shows me one phone number on my page http://www.scbn.ro/index.php? Link to comment Share on other sites More sharing options...
klara_galaxee Posted March 6, 2014 Share Posted March 6, 2014 What should I do? Where can the problem be? Link to comment Share on other sites More sharing options...
vekia Posted March 6, 2014 Share Posted March 6, 2014 strange, maybe you modified tpl file located in /modules/ dir, and you've got it also under /themes/ directory? Link to comment Share on other sites More sharing options...
klara_galaxee Posted March 6, 2014 Share Posted March 6, 2014 yes! I didn't modified it in my theme folder. it works for right column now but I still need to show the other two phone nrs. in my footer http://www.scbn.ro/index.php (3'd column Tel: ) one below each other. Thank you so much! Link to comment Share on other sites More sharing options...
PascalVG Posted March 9, 2014 Share Posted March 9, 2014 Hi Klara, Here some sample files from 1.5.6.2 version, where three telephone numbers are defined in the block contact info(s) module: blockcontactinfos.php: backup your own file /modules/blockcontactinfos/blockcontactinfos.php If you use 1.5.6.2, you can copy the file over the backupped one. If not, but you use a recent 1.5.x version, you can still try to copy the file over the old one, but there may be some complications. if you encounter problems, copy an original version back again, and instead compare the original and my file and check for lines with the text 'phone1', 'phone2', 'phone3'. Replace the original lines with only 'phone' for these phone1,phone2,phone3 ones. blockcontactinfos.tpl: backup your own file themes/<your theme folder>/modules/blockcontactinfos/blockcontactinfos.tpl If you use 1.5.6.2, you can copy the file over the backupped one. If not, but you use a recent 1.5.x version, you can still try to copy the file over the old one, but there may be some complications. if you encounter problems, copy an original version back again, and instead compare the original and my fileand check for lines with the text 'phone1', 'phone2', 'phone3'. Replace the original lines with only 'phone' for these phone1,phone2,phone3 ones. blockcontactinfos_adjusted_files_Ps1562.zip Hope this helps. pascal Link to comment Share on other sites More sharing options...
klara_galaxee Posted March 10, 2014 Share Posted March 10, 2014 Thank you ! I copied the php and tpl files where you mentioned, then only add my three numbers in contact block info module and it works for footer aswell now. Link to comment Share on other sites More sharing options...
itiago50 Posted July 24, 2014 Share Posted July 24, 2014 Hello, I need your help, please. Can you please help me adding another phone2 and phone3 to contact module? I tryed this Pascal option but is not working for me. I use Prestashop 1.6 Thank you in advance. 1 Link to comment Share on other sites More sharing options...
gius3pp3 Posted November 21, 2014 Share Posted November 21, 2014 Hi, I have the same question for PS 1.6. What I can do to add others telephons and email fields? Thank You Link to comment Share on other sites More sharing options...
artcuda Posted July 21, 2015 Share Posted July 21, 2015 Up. I have the same question for PS 1.6. How to add more telephons? I tryed this Pascal option but is not working for me. Link to comment Share on other sites More sharing options...
Dennis Spaan Posted May 8, 2017 Share Posted May 8, 2017 I know this is a very old topic but i'm struggling with this in Prestashop 1.7. In the footer of the store it shows the default information you can store in Shop Settings>Contact>Stores>Contact Details. (i had to struggle where to enter this information by the way, it's very strange to me the general contact information has to be entered on a Stores page, since we don't have stores) We want to show our company registration number as an extra line under the general company address, e-mail address and phone number. The strange thing is that there is a Registration field but whatever you enter there is not displayed in the contact information block. The documentation says: http://doc.prestashop.com/display/PS16/Store+Contacts+Preferences Registration. Indicate your company's legal registration numbers, which depends on your country's legal system (Duns number in the USA, SIRET number in France, CNPJ number in Brazil, etc.). This shows that you are a fully registered business, thus giving a more reassuring opinion of your shop to your potential customers. But why is this number not displayed in that block?? It doesn't make sense to me. I tried searching for a .tpl file i can edit to add this information but can't find it. It seems to be very different from older Prestashop versions. Please help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now