Jump to content

[SOLVED] Social Block in DisplayNav Hook?


Recommended Posts

before last closing bracket (in module .php file)

add this:
 

    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

then go to modules > positions

click on transplant button

and transplant social block module to this hook.

  • Like 4
Link to comment
Share on other sites

before last closing bracket (in module .php file)

add this:

 

    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

then go to modules > positions

click on transplant button

and transplant social block module to this hook.

 

Thanks for the reply Vekia, I have done you have say me, but the social block doesnt show the buttons of my networks,

I show you the result in the capture.

Thanks

post-274950-0-20816100-1395933461_thumb.png

Edited by Nando112 (see edit history)
Link to comment
Share on other sites

Thanks for the reply Vekia, I have done you have say me, but the social block doesnt show the buttons of my networks,

I show you the result in the capture.

Thanks

can you share url to your shop, pleasE?

now everytihng depends on css styles.

Link to comment
Share on other sites

use this in your global.css

 nav #social_block {
      float: right;
      width: 33%;
      padding: 6px 15px 0 15px; }
      @media (max-width: 767px) {
         nav #social_block {
          width: 100%;
          float: left;
          padding-top: 5px; } }
       nav #social_block ul {
        float: right; }
        @media (max-width: 767px) {
           nav #social_block ul {
            float: none; } }
         nav #social_block ul li {
          float: left;
          width: 40px;
          text-align: center; }
          @media (min-width: 768px) and (max-width: 991px) {
             nav #social_block ul li {
              width: 30px; } }
           nav #social_block ul li a {
            display: inline-block;
            color: #908f8f;
            font-size: 28px; }
            @media (min-width: 768px) and (max-width: 991px) {
               nav #social_block ul li a {
                font-size: 20px; } }
             nav #social_block ul li a span {
              display: none; }
             nav #social_block ul li a:before {
              display: inline-block;
              font-family: "FontAwesome";
              vertical-align: -5px; }
             nav #social_block ul li a:hover {
              color: white; }
           nav #social_block ul li.facebook a:before {
            content: "\f09a"; }
           nav #social_block ul li.twitter a:before {
            content: "\f099"; }
           nav #social_block ul li.rss a:before {
            content: "\f09e"; }
           nav #social_block ul li.youtube a:before {
            content: "\f167"; }
           nav #social_block ul li.google-plus a:before {
            content: "\f0d5"; }
           nav #social_block ul li.pinterest a:before {
            content: "\f0d2"; }
       nav #social_block h4 {
        float: right;
        margin-bottom: 0;
        font-size: 21px;
        line-height: 25px;
        text-transform: none;
        padding: 0 10px 0 0;
        margin-top:0px;
 }

effect

g6AhC4e.png

  • Like 5
Link to comment
Share on other sites

use this in your global.css

 nav #social_block {
      float: right;
      width: 33%;
      padding: 6px 15px 0 15px; }
      @media (max-width: 767px) {
         nav #social_block {
          width: 100%;
          float: left;
          padding-top: 5px; } }
       nav #social_block ul {
        float: right; }
        @media (max-width: 767px) {
           nav #social_block ul {
            float: none; } }
         nav #social_block ul li {
          float: left;
          width: 40px;
          text-align: center; }
          @media (min-width: 768px) and (max-width: 991px) {
             nav #social_block ul li {
              width: 30px; } }
           nav #social_block ul li a {
            display: inline-block;
            color: #908f8f;
            font-size: 28px; }
            @media (min-width: 768px) and (max-width: 991px) {
               nav #social_block ul li a {
                font-size: 20px; } }
             nav #social_block ul li a span {
              display: none; }
             nav #social_block ul li a:before {
              display: inline-block;
              font-family: "FontAwesome";
              vertical-align: -5px; }
             nav #social_block ul li a:hover {
              color: white; }
           nav #social_block ul li.facebook a:before {
            content: "\f09a"; }
           nav #social_block ul li.twitter a:before {
            content: "\f099"; }
           nav #social_block ul li.rss a:before {
            content: "\f09e"; }
           nav #social_block ul li.youtube a:before {
            content: "\f167"; }
           nav #social_block ul li.google-plus a:before {
            content: "\f0d5"; }
           nav #social_block ul li.pinterest a:before {
            content: "\f0d2"; }
       nav #social_block h4 {
        float: right;
        margin-bottom: 0;
        font-size: 21px;
        line-height: 25px;
        text-transform: none;
        padding: 0 10px 0 0;
        margin-top:0px;
 }

effect

g6AhC4e.png

 

Wow! that have been perfect!

 

Thanks very much!

Best regards.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

before last closing bracket (in module .php file)

add this:

 

    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

then go to modules > positions

click on transplant button

and transplant social block module to this hook.

I tried to add this to my .php file, and now I get a http 500  error in my back office, and my site is the same?

 

Please help

Link to comment
Share on other sites

I tried to add this to my .php file, and now I get a http 500  error in my back office, and my site is the same?

 

Please help

 

hello

it means that you added code in wrong place.

can you show your modified file, please?

  • Like 1
Link to comment
Share on other sites

<?php/** 2007-2014 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-2014 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 blocksocial extends Module{ public function __construct() {  $this->name = 'blocksocial';  $this->tab = 'front_office_features';  $this->version = '1.1';  $this->author = 'PrestaShop';  $this->bootstrap = true;  parent::__construct();   $this->displayName = $this->l('Social networking block');  $this->description = $this->l('Allows you to add information about your brand\'s social networking accounts.');  $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); }  public function install() {  return (parent::install() AND Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', '') &&    Configuration::updateValue('BLOCKSOCIAL_TWITTER', '') &&    Configuration::updateValue('BLOCKSOCIAL_RSS', '') &&    Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', '') &&    Configuration::updateValue('BLOCKSOCIAL_GOOGLE_PLUS', '') &&    Configuration::updateValue('BLOCKSOCIAL_PINTEREST', '') &&    $this->registerHook('displayHeader') &&    $this->registerHook('displayFooter')); }  public function uninstall() {  //Delete configuration  return (Configuration::deleteByName('BLOCKSOCIAL_FACEBOOK') AND    Configuration::deleteByName('BLOCKSOCIAL_TWITTER') AND    Configuration::deleteByName('BLOCKSOCIAL_RSS') AND    Configuration::deleteByName('BLOCKSOCIAL_YOUTUBE') AND    Configuration::deleteByName('BLOCKSOCIAL_GOOGLE_PLUS') AND    Configuration::deleteByName('BLOCKSOCIAL_PINTEREST') AND    parent::uninstall()); }  public function getContent() {  // If we try to update the settings  $output = '';  if (Tools::isSubmit('submitModule'))  {    Configuration::updateValue('BLOCKSOCIAL_FACEBOOK', Tools::getValue('blocksocial_facebook', ''));   Configuration::updateValue('BLOCKSOCIAL_TWITTER', Tools::getValue('blocksocial_twitter', ''));   Configuration::updateValue('BLOCKSOCIAL_RSS', Tools::getValue('blocksocial_rss', ''));   Configuration::updateValue('BLOCKSOCIAL_YOUTUBE', Tools::getValue('blocksocial_youtube', ''));   Configuration::updateValue('BLOCKSOCIAL_GOOGLE_PLUS', Tools::getValue('blocksocial_google_plus', ''));   Configuration::updateValue('BLOCKSOCIAL_PINTEREST', Tools::getValue('blocksocial_pinterest', ''));   $this->_clearCache('blocksocial.tpl');   Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.'&conf=4&module_name='.$this->name);  }    return $output.$this->renderForm(); }  public function hookDisplayHeader() {  $this->context->controller->addCSS(($this->_path).'blocksocial.css', 'all'); }   public function hookDisplayFooter() {  if (!$this->isCached('blocksocial.tpl', $this->getCacheId()))   $this->smarty->assign(array(    'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'),    'twitter_url' => Configuration::get('BLOCKSOCIAL_TWITTER'),    'rss_url' => Configuration::get('BLOCKSOCIAL_RSS'),    'youtube_url' => Configuration::get('BLOCKSOCIAL_YOUTUBE'),    'google_plus_url' => Configuration::get('BLOCKSOCIAL_GOOGLE_PLUS'),    'pinterest_url' => Configuration::get('BLOCKSOCIAL_PINTEREST'),   ));  return $this->display(__FILE__, 'blocksocial.tpl', $this->getCacheId()); }  public function renderForm() {  $fields_form = array(   'form' => array(    'legend' => array(     'title' => $this->l('Settings'),     'icon' => 'icon-cogs'    ),    'input' => array(     array(      'type' => 'text',      'label' => $this->l('Facebook URL'),      'name' => 'blocksocial_facebook',      'desc' => $this->l('Your Facebook fan page.'),     ),     array(      'type' => 'text',      'label' => $this->l('Twitter URL'),      'name' => 'blocksocial_twitter',      'desc' => $this->l('Your official Twitter accounts.'),     ),     array(      'type' => 'text',      'label' => $this->l('RSS URL'),      'name' => 'blocksocial_rss',      'desc' => $this->l('The RSS feed of your choice (your blog, your store, etc.).'),     ),     array(      'type' => 'text',      'label' => $this->l('YouTube URL'),      'name' => 'blocksocial_youtube',      'desc' => $this->l('Your official YouTube account.'),     ),     array(      'type' => 'text',      'label' => $this->l('Google Plus URL:'),      'name' => 'blocksocial_google_plus',      'desc' => $this->l('You official Google Plus page.'),     ),     array(      'type' => 'text',      'label' => $this->l('Pinterest URL:'),      'name' => 'blocksocial_pinterest',      'desc' => $this->l('Your official Pinterest account.'),     ),    ),    'submit' => array(     'title' => $this->l('Save'),    )   ),  );    $helper = new HelperForm();  $helper->show_toolbar = false;  $helper->table =  $this->table;  $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));  $helper->default_form_language = $lang->id;  $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;  $helper->identifier = $this->identifier;  $helper->submit_action = 'submitModule';  $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;  $helper->token = Tools::getAdminTokenLite('AdminModules');  $helper->tpl_vars = array(   'fields_value' => $this->getConfigFieldsValues(),   'languages' => $this->context->controller->getLanguages(),   'id_language' => $this->context->language->id  );  return $helper->generateForm(array($fields_form)); }  public function getConfigFieldsValues() {  return array(   'blocksocial_facebook' => Tools::getValue('blocksocial_facebook', Configuration::get('BLOCKSOCIAL_FACEBOOK')),   'blocksocial_twitter' => Tools::getValue('blocksocial_twitter', Configuration::get('BLOCKSOCIAL_TWITTER')),   'blocksocial_rss' => Tools::getValue('blocksocial_rss', Configuration::get('BLOCKSOCIAL_RSS')),   'blocksocial_youtube' => Tools::getValue('blocksocial_youtube', Configuration::get('BLOCKSOCIAL_YOUTUBE')),   'blocksocial_google_plus' => Tools::getValue('blocksocial_google_plus', Configuration::get('BLOCKSOCIAL_GOOGLE_PLUS')),   'blocksocial_pinterest' => Tools::getValue('blocksocial_pinterest', Configuration::get('BLOCKSOCIAL_PINTEREST')),  ); } public function hookdispalyNav($params){
        return $this->hookDisplayFooter();

   }

Link to comment
Share on other sites

before last closing bracket (in module .php file)

add this:

 

    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

then go to modules > positions

click on transplant button

and transplant social block module to this hook.

 

Every time I try to do this, it gives me a http 500 error...

 

I am not sure what I am doing wrong.

Can anyone help.

Link to comment
Share on other sites

Every time I try to do this, it gives me a http 500 error...

 

I am not sure what I am doing wrong.

Can anyone help.

Where did you insert the code ? You have to insert it in the module path / module.php file ? (i.e. : www/prestashop/blocksocial/blocksocial.php ) and copy it between two other functions.

 

Be carefull to correct the function of vekia, there is an error in the name (hookDisplayNav not hookdispalyNav)

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

Where did you insert the code ? You have to insert it in the module path / module.php file ? (i.e. : www/prestashop/blocksocial/blocksocial.php ) and copy it between two other functions.

 

Be carefull to correct the function of vekia, there is an error in the name (hookDisplayNav not hookdispalyNav)

that is where I put it,, but I will try again, with the corrected  ( hookDisplayNav)

I put it at the end like Vekia said,,,, just before the last }

Link to comment
Share on other sites

Buenas tardes

Estoy trabajando con prestashop 1.6 y la plantilla que trae por defecto. He hecho unas paginas
​de informacion ​
en css y he modificado  en el modulo blockpermanentlinks el archivo
​ ​
blockpermanentlinks-header.tpl
y he añadido el modulo Enlaces Permanentes al bloque displayNav obteniendo esto que te muestro.
 
Como ves sale Servicios Profesionales Partners y Preguntas Frecuentes, Como puedo hacer para ponerle el mismo color y centrarlo igual que Contacto Español e Iniciar Sesion

 
Gracias
 
Jose Luis             
Link to comment
Share on other sites

Hi

 

I didn't understand this part? which hook? can you please help me?

http://i58.tinypic.com/28tgaq0.jpg

 

Also I have added the below code to

modules/blocksocial/blocksocial.tpl

 

After

</ul>
 
public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }
  
</section>
 
Is this correct?
 
I want to show the social icons at the top of the page.
example:
 
website:

bit.ly/1pzlXoW

 

Thanks

###################################################################

 

before last closing bracket (in module .php file)

add this:
 


    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

then go to modules > positions

click on transplant button

and transplant social block module to this hook.

Edited by ashadweb (see edit history)
Link to comment
Share on other sites

i just thought that you already included:
 


    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

to module .php file before last closing bracket }

if not, do this, it's necessary

Link to comment
Share on other sites

i hae no idea how he changed it but it can be solved with guide that i released: http://mypresta.eu/en/art/prestashop-16/block-top-menu-displaynav.html

 

then with css styles you can change size of the menu

.sf-menu > li > a {
font: 600 18px/22px "Open Sans", sans-serif;
text-transform: uppercase;
color: #484848;
display: block;
padding: 2px;
border-bottom: 3px solid #e9e9e9;
}

(i changed padding to 2px;)

 

you can also remove backgrunds etc.

 

then you will need to transplant also block cart module there

 

 

.... a lot of small customizations related to each module in displayNav

Link to comment
Share on other sites

i hae no idea how he changed it but it can be solved with guide that i released: http://mypresta.eu/en/art/prestashop-16/block-top-menu-displaynav.html

 

then with css styles you can change size of the menu

.sf-menu > li > a {
font: 600 18px/22px "Open Sans", sans-serif;
text-transform: uppercase;
color: #484848;
display: block;
padding: 2px;
border-bottom: 3px solid #e9e9e9;
}

(i changed padding to 2px;)

 

you can also remove backgrunds etc.

 

then you will need to transplant also block cart module there

 

 

.... a lot of small customizations related to each module in displayNav

sorry for the late reply, im already done the suggestion you gave to me.

but i still confused how to align the menu to the center just like nando did.

 

if you have spare of time, please take a look my progress. http://rara-store.com

Link to comment
Share on other sites

Hi

 

Which .module.php? where is it please? even here it says .module.php but where?

 

http://www.prestashop.com/forums/topic/318911-solved-social-block-in-displaynav-hook/?p=1613793

 

 

i just thought that you already included:
 


    public function hookdispalyNav($params){
        return $this->hookDisplayFooter();
    }

to module .php file before last closing bracket }

if not, do this, it's necessary

Link to comment
Share on other sites

I;m confused after reading all these 

 

1. Where should I add this code? module .php means which .php?

2. After above Transplant module

Which module to select?

Hook into what to select?

 

:unsure:  :unsure:  :unsure:

 

 

 

Hi

 

Which .module.php? where is it please? even here it says .module.php but where?

 

http://www.prestashop.com/forums/topic/318911-solved-social-block-in-displaynav-hook/?p=1613793

Link to comment
Share on other sites

  • 2 weeks later...

Hello good morning

I am trying to programmatically change the module position paypal fast purchase and can not

Show me where it goes now in paypal photo

Would be the correct way to put it where I show on the picture paypal_1

thanks

Link to comment
Share on other sites

Hello good morning

 

I am trying to programmatically change the module position paypal fast purchase and can not

 

Show me where it goes now in paypal photo

 

Would be the correct way to put it where I show on the picture paypal_1

 

thanks

you have to transplant module to displayProductActions hook, at the moment it's attached to displayFooterProduct hook.

Link to comment
Share on other sites

okay, so open module .php file and insert there code like:

	public function hookProductActions()
	{
		$content = (!$this->useMobile()) ? $this->renderExpressCheckoutButton('product') : null;
		return $content.$this->renderExpressCheckoutForm('product');
	}

do it before last closing bracket

Link to comment
Share on other sites

okay, so open module .php file and insert there code like:

public function hookProductActions()
{
$content = (!$this->useMobile()) ? $this->renderExpressCheckoutButton('product') : null;
return $content.$this->renderExpressCheckoutForm('product');
}

do it before last closing bracket

which file is to be modified?

Thank you

Edited by aguaycafe (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi Vekia,

 

Thank you for your solution. There is a typo and the code should be

 

public function hookdisplayNav($params){
return $this->hookDisplayFooter();
}

 

instead of 

 

public function hookdispalyNav($params){
return $this->hookDisplayFooter();
}

 

Oops, bburrer77 already pointed out the error.

Edited by sinoland (see edit history)
Link to comment
Share on other sites

  • 1 month later...

http://www.threew.es

 

I have tried changing the line,

public function hookDisplayNav($params){
        return $this->display(__FILE__, 'blocksocial.tpl');
    }

but I cant see the icons, I hope you can help me

Hello all I have tried the above code and I am recieving the following msg from my page

"No template found for module Module: here is the link of my shop

http://www.pandora-web-box.info/avenue-shop/index.php

Could you help me?

Thanks

Marina

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Good morning, I'm trying to position a module (Quick Search Block) in the default theme using the "edit" button but I receive an "Internal server error" (the "unlock" option works).

In the error.log there are no sign of this error and "write-modify" permissions are set.

Could you plese give me any ideas where to search the error or to solve it?

Thank you

Link to comment
Share on other sites

×
×
  • Create New...