Jump to content

jak dodac drugi nr telefonu do Block Contact module


gibon93

Recommended Posts

Witam serdecznie szukam rozwiazania na dodanie drugiego nr telefonu do Block Contact module jeden tel ma byc dla PL a drugi dla EN jezyka i pytanko czy ktos jzu modyfikowal ten modul aby wlasnie takie rozwiazanie zrobic ?

 

oba telefony moga sie wyswietlac w jednej i drugiej wersji jezykowej nie musze sie wyswietlac w zaleznosci od wybranego jezyka .

Link to comment
Share on other sites

wydytuj ręcznie plik blockcontact/blockcontact.tpl

 

(sprawdź czy czasami go nie masz w template, jeżeli tam jest - wyedytuj go tam)

 

 

w pliku masz coś takiego:

{if $telnumber != ''}<p class="tel"><span class="label">{l s='Phone:' mod='blockcontact'}</span>{$telnumber|escape:'htmlall':'UTF-8'}</p>{/if}

 

zduplikuj to, podmień wartość {$telnumber|escape:'htmlall':'UTF-8'} na dodatkowy numer i będzie ok ;)

Link to comment
Share on other sites

WIiam

 

tak dobrze zrozumiałeś :)

 

dodaliśmy kilka linijek do bloku kontaktu w modułach

 

w php i tpl

 

oraz do bazy danych drugą zmienną

 

jeżeli zmienna nie pasuje do nazewnictwa mysql to sorki jestem programista C# :)

 

mam nadzieje że nie złamaliśmy licencji ??

 

 

pozdrawiam

post-592642-0-25229200-1371073361_thumb.png

Link to comment
Share on other sites

to dobrze :)

 

jak by ktoś potrzebował :)

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_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 1:').'</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('Telephone number 2:').'</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 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'),
'email' => Configuration::get('blockcontact_email')
  ));
 return $this->display(__FILE__, 'blockcontact.tpl', $this->getCacheId());
}

public function hookDisplayLeftColumn()
{
 return $this->hookDisplayRightColumn();
}
}
?>

 

modules/blockcontact/blockcontact.tpl oraz themes/NAZWA _SZABLONU/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">
<h4 class="title_block">{l s='Contact us' mod='blockcontact'}</h4>
<div class="block_content clearfix">
  <p>{l s='Our support 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='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 expert support team!' mod='blockcontact'}</a>{/if}
</div>
</div>

 

w bazie danych dodana zmienna typu string czy text nie wiem jak to się nazywa w mysqlu :)

o nazwie 'blockcontact_telnumber2'

 

pozdrawiam

Edited by gibon93 (see edit history)
  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...