Jump to content

Twitter Widget Module In The Footer


Recommended Posts

Hello,

 

Need help... How can we place a Twitter widget module in the footer on the left side. We are using theme http://www.templatemonster.com/demo/52184.html. And we are using this twitter widget  https://mypresta.eu/modules/social-networks/twitter-widget-free.html.

 

Here is are site http://lilyslingerieshop.com/

If any one know how we can fix this please let use know 

 

Thanks

Natebc

 

Link to comment
Share on other sites

You might just want to move it from modules, positions.

And try mine: http://store.nemops.com/free-modules/42-prestashop-twitter-widget-free.html#.VrR2UPk4Hmg :D

 

Hi Nemo1,

 

I will give your module a try. I have tried modules, positions. But it will not line up with Information column in the footer. http://prntscr.com/9zg8va

 

 

Natebc

 

 

Link to comment
Share on other sites

Not to take away from Nemo1 but I had a look.

 

 

Is this what your looking for:  The problem is the Twitter is 100% of footer width.

 

 

 

 

 

Find and edit the .tpl file and add this      class="col-sm-3"

 

 

<div class="col-sm-3" may be other code here.

 

 

I think this will work you may then need to edit other CSS or .tpl to get the rest positioned just the way you want.

Link to comment
Share on other sites

Not sure as I do not use this module, look in the modules folder and see if there is a .tpl file that will most likely be it.

If not a tpl file possibly code that you pasted somewhere not sure how this module works

 

One more note on this you amy also be able to add   class="twitter"  instead of    class="col-sm-3"   then add some CSS to global like this

 

example

.twitter{width:30%; float:left;padding 0px 20px 0px 20px}

 

not sure of the padding, margin may work better, your smarty cache for CSS is on so I can not see the CSS files.

 

 

Not a twitterer LOL, 

Link to comment
Share on other sites

Not sure as I do not use this module, look in the modules folder and see if there is a .tpl file that will most likely be it.

If not a tpl file possibly code that you pasted somewhere not sure how this module works

 

One more note on this you amy also be able to add   class="twitter"  instead of    class="col-sm-3"   then add some CSS to global like this

 

example

.twitter{width:30%; float:left;padding 0px 20px 0px 20px}

 

not sure of the padding, margin may work better, your smarty cache for CSS is on so I can not see the CSS files.

 

 

Not a twitterer LOL, 

 

 

Hi tdr170,

 

I was only able to find: rightcolumn.tpl and twitterwidget.php. But I dont know what one to edit.

 

 

rightcolumn.tpl :

<div style="width:{$twt->twitterwidget_width}px; display:block; margin:auto; margin-top:10px; margin-bottom:10px;"><a class="twitter-timeline" data-dnt="true" href="https://twitter.com/{$twt->twitterwidget_name}" data-widget-id="{$twt->twitterwidget_wid}">Tweets by @{$twt->twitterwidget_name}</a>
 
<script>{literal}!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);[spam-filter](document,"script","twitter-wjs");{/literal}</script></div>
 
twitterwidget.php:
<?php 
 
class twitterwidget extends Module {
 
function __construct(){
 
$this->name = 'twitterwidget';
 
$this->tab = 'social_networks';
 
$this->version = '1.2';
 
        $this->author = 'MyPresta.eu';
 
        $this->dir = '/modules/twitterwidget/';
 
parent::__construct();
 
$this->displayName = $this->l('Twitter Widget Free');
 
$this->description = $this->l('This module adds a twitter widget to your shop.');
 
        $this->mkey="freelicense";       
 
        if (@file_exists('../modules/'.$this->name.'/key.php'))
 
            @require_once ('../modules/'.$this->name.'/key.php');
 
        else if (@file_exists(dirname(__FILE__) . $this->name.'/key.php'))
 
            @require_once (dirname(__FILE__) . $this->name.'/key.php');
 
        else if (@file_exists('modules/'.$this->name.'/key.php'))
 
            @require_once ('modules/'.$this->name.'/key.php');                        
 
        $this->checkforupdates();
 
}
 
        function checkforupdates(){
 
            if (isset($_GET['controller']) OR isset($_GET['tab'])){
 
                if (Configuration::get('update_'.$this->name) < (date("U")>86400)){
 
                    $actual_version = twitterwidgetUpdate::verify($this->name,$this->mkey,$this->version);
 
                }
 
                if (twitterwidgetUpdate::version($this->version)<twitterwidgetUpdate::version(Configuration::get('updatev_'.$this->name))){
 
                    $this->warning=$this->l('New version available, check MyPresta.eu for more informations');
 
                }
 
            }
 
        }       
 
function install(){
 
        if (parent::install() == false 
 
        OR !Configuration::updateValue('update_'.$this->name,'0')
 
   OR $this->registerHook('rightColumn') == false
 
   OR $this->registerHook('leftColumn') == false
 
   OR $this->registerHook('home') == false
 
        OR $this->registerHook('footer') == false
 
   OR Configuration::updateValue('twitterwidget_position', '2') == false
 
        OR Configuration::updateValue('twitterwidget_name', 'hrabja') == false
 
        OR Configuration::updateValue('twitterwidget_wid', '252719104740425728') == false
 
OR Configuration::updateValue('twitterwidget_width', '220') == false       
 
        ){
 
            return false;
 
        }
 
        return true;
 
}
 
    
 
public function getContent(){
 
  $output="";
 
if (Tools::isSubmit('submit_settings')){
 
            Configuration::updateValue('twitterwidget_position', Tools::getValue('new_twitterwidget_position'), true);
 
            Configuration::updateValue('twitterwidget_name', Tools::getValue('new_twitterwidget_name'), true);
 
            Configuration::updateValue('twitterwidget_wid', Tools::getValue('new_twitterwidget_wid'), true);
 
            Configuration::updateValue('twitterwidget_width', Tools::getValue('new_twitterwidget_width'), true);
 
 
 
            $output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>';                                    
 
        }   
 
        $output.="";
 
        return $output.$this->displayForm();
 
}
 
 
 
public function getconf(){
 
$var = new stdClass();
 
$var->twitterwidget_position=Configuration::get('twitterwidget_position');
 
$var->twitterwidget_name=Configuration::get('twitterwidget_name');
 
$var->twitterwidget_wid=Configuration::get('twitterwidget_wid');
 
$var->twitterwidget_width=Configuration::get('twitterwidget_width');
 
return $var;
 
}
 
 
 
public function displayForm(){
 
$var=$this->getconf();
 
$twt_position1=""; $twt_position2=""; $twt_position3=""; $twt_position4="";
 
if ($var->twitterwidget_position==1){$twt_position1="checked=\"yes\"";}
 
if ($var->twitterwidget_position==2){$twt_position2="checked=\"yes\"";}
 
if ($var->twitterwidget_position==3){$twt_position3="checked=\"yes\"";}
 
        if ($var->twitterwidget_position==4){$twt_position4="checked=\"yes\"";}
 
return'
 
        <iframe src="http://mypresta.eu/content/uploads/2012/10/facebook_advertise.html" width="100%" height="130" border="0" style="border:none;"></iframe>
 
<form action="'.$_SERVER['REQUEST_URI'].'" method="post">
 
            <div style="display:block; margin:auto; overflow:hidden; ">
 
                    <div style="clear:both; display:block; ">
 
                        <fieldset>
 
            <legend>'.$this->l('Twitter Widget configuration').'</legend>
 
 
 
               <div style="clear:both;display:block;">
 
   <label>'.$this->l('Left column').':</label>
 
<div class="margin-form" valign="middle">
 
                       <div style="margin-top:7px;">
 
<input type="radio" name="new_twitterwidget_position" value="1" '.$twt_position1.'> '.$this->l('yes').'
 
                       </div>
 
</div>
 
               </div>
 
               <div style="clear:both;display:block;">
 
   <label>'.$this->l('Right column').':</label>
 
<div class="margin-form" valign="middle">
 
                       <div style="margin-top:7px;">
 
<input type="radio" name="new_twitterwidget_position" value="2" '.$twt_position2.'> '.$this->l('yes').'
 
                       </div>
 
</div>
 
               </div>
 
<div style="clear:both;display:block;">
 
   <label>'.$this->l('Home').':</label>
 
<div class="margin-form" valign="middle">
 
                       <div style="margin-top:7px;">
 
<input type="radio" name="new_twitterwidget_position" value="3" '.$twt_position3.'> '.$this->l('yes').'
 
 
 
                       </div>
 
</div>
 
               </div>
 
                            <div style="clear:both;display:block;">
 
   <label>'.$this->l('Footer').':</label>
 
<div class="margin-form" valign="middle">
 
                       <div style="margin-top:7px;">
 
<input type="radio" name="new_twitterwidget_position" value="4" '.$twt_position4.'> '.$this->l('yes').'
 
 
 
                       </div>
 
</div>
 
               </div>
 
               
 
               <label>'.$this->l('Box width').'</label>
 
            <div class="margin-form">
 
            <input type="text" style="width:200px;" value="'.$var->twitterwidget_width.'" id="new_twitterwidget_width" name="new_twitterwidget_width" onchange="">
 
                                    <p class="clear">'.$this->l('The minimum value of the parameter: 220').'</p>
 
                                </div>
 
                           
 
            <label>'.$this->l('Twitter name').'</label>
 
            <div class="margin-form">
 
            <input type="text" style="width:400px;" value="'.$var->twitterwidget_name.'" id="new_twitterwidget_name" name="new_twitterwidget_name" onchange="">
 
                                    <p class="clear">'.$this->l('Your account on Twitter name').'</p>
 
                                </div>
 
                                 
 
            <label>'.$this->l('Twitter widget id').'</label>
 
            <div class="margin-form">
 
            <input type="text" style="width:150px;" value="'.$var->twitterwidget_wid.'" id="new_twitterwidget_wid" name="new_twitterwidget_wid" onchange="">
 
                                    <p class="clear">'.$this->l('The Twitter Widget id').'</p>
 
                                </div> 
 
                                <div align="center">
 
                   <input type="submit" name="submit_settings" value="'.$this->l('Save Settings').'" class="button" />
 
                                </div>
 
                        </fieldset>                    
 
                    </div>
 
            </div>
 
</form>
 
        ';
 
}   
 
   
 
    
 
function hookrightColumn($params){
 
if (Configuration::get('twitterwidget_position')==2){
 
   $cfg=$this->getconf();
 
       global $smarty;
 
       $smarty->assign('twt', $cfg);
 
return $this->display(__FILE__, 'rightcolumn.tpl');
 
}
 
}
 
function hookleftColumn($params){
 
if (Configuration::get('twitterwidget_position')==1){
 
   $cfg=$this->getconf();
 
       global $smarty;
 
       $smarty->assign('twt', $cfg);
 
return $this->display(__FILE__, 'rightcolumn.tpl');
 
}
 
}
 
 
 
function hookhome($params){
 
if (Configuration::get('twitterwidget_position')==3){
 
   $cfg=$this->getconf();
 
       global $smarty;
 
       $smarty->assign('twt', $cfg);
 
return $this->display(__FILE__, 'rightcolumn.tpl');
 
}
 
}
 
    
 
    function hookFooter($params){
 
if (Configuration::get('twitterwidget_position')==4){
 
   $cfg=$this->getconf();
 
       global $smarty;
 
       $smarty->assign('twt', $cfg);
 
return $this->display(__FILE__, 'rightcolumn.tpl');
 
}
 
}
 
}
 
 
 
class twitterwidgetUpdate extends twitterwidget {  
 
    public static function version($version){
 
        $version=(int)str_replace(".","",$version);
 
        if (strlen($version)==3){$version=(int)$version."0";}
 
        if (strlen($version)==2){$version=(int)$version."00";}
 
        if (strlen($version)==1){$version=(int)$version."000";}
 
        if (strlen($version)==0){$version=(int)$version."0000";}
 
        return (int)$version;
 
    }
 
    
 
    public static function encrypt($string){
 
        return base64_encode($string);
 
    }
 
    
 
    public static function verify($module,$key,$version){
 
        if (ini_get("allow_url_fopen")) {
 
             if (function_exists("file_get_contents")){
 
                $actual_version = @file_get_contents('http://dev.mypresta.eu/update/get.php?module='.$module."&version=".self::encrypt($version)."&lic=$key&u=".self::encrypt(_PS_BASE_URL_.__PS_BASE_URI__));
 
             }
 
        }
 
        Configuration::updateValue("update_".$module,date("U"));
 
        Configuration::updateValue("updatev_".$module,$actual_version); 
 
        return $actual_version;
 
    }
 
}
 
?>
Link to comment
Share on other sites

OK I found the module and tested on one of my test sites here is how I got it to work well in the footer.

 

In the  first line of the .tpl file I changed the  <div  tag as below this way I can control the output through CSS.

 

changed this:

<div style="width:{$twt->twitterwidget_width}px; display:block; margin:auto; margin-top:10px; margin-bottom:10px;">

 

To this:

<div class="twitterfeed" display:block;">

 

Then in the global.css I added this: 

 

.twitterfeed{margin-top:40px;float:left;width:300px;margin-right:70px}

 

Then I found the code below and added width 25%

 

.footer-container #footer .footer-block {margin-top: 45px; width:25%}
 
 
Here is how it looked
 
 
I did not spend a lot of time changing each setting to get it perfect so just know that you can change these settings to get it just how you want.
Edited by tdr170 (see edit history)
Link to comment
Share on other sites

OK first issue I see is that when you edited the rightcolumn.tpl you did not replace the code correctly.

 

Was supposed to be

 

change this

<div style="width:{$twt->twitterwidget_width}px; display:block; margin:auto; margin-top:10px; margin-bottom:10px;">

 

to this

<div class="twitterfeed" display:block;">

 

However on second look I see an error in the code and I am going to change it.

Also when you did this somehow you left this   style="width:220px; display:block; margin:auto; margin-top:10px; margin-bottom:10px;">

 

 

Easy way, here is the corrected file rename to .tpl   (i tried .txt to upload and it said failed but uploaded as .php)

 

 

 

 

 

Turn Off the smarty cache for css so I can see the files as it does not look as though it is in the right location.

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

On your site it likes the width at 200, go to where you put the .twitterfeed code and change the 300 to 200.

Not sure what is up but I still could not view the entire css file instead of showing me the css file name it shows your URL.

 

Wait why does it say 300px it was supposed to say 30%

 

Does not matter but a % will work better on mobile devices actual somewhere around 15-18% works best on your site.

I suspect the other blocks widths are wider than the site I tested on.

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

Are you thinking of moving it from footer, this should be hook Home.

You would probably want to undo the changes and start from scratch as that hook might work fine the way it is written in the modules.

Or download the module folder to your hard drive as backup and uninstall, Delete and install fresh.

Edited by tdr170 (see edit history)
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...