Vote to Improve PrestaShop

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

 
Photo

Free [Module] Google Adsense Right for Prestashop

Google adsense google adsesnse prestashop google adsense

  • Please log in to reply
18 replies to this topic
MackStores.Com

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 15 October 2013 - 08:54 AM

Here is a free module by us download here
Attached File  advertiseright.zip   8.41KB   912 downloads

 

and please do see the video section there to see How it is installed and how it works .
 
Thanks.

 

 

 


Edited by MackStores.Com, 26 October 2013 - 10:53 AM.

Mack Stores  

Www.MackStores.com . Prestashop Modules.


vekia

    PrestaShop Legend

  • US Moderators
  • 47313 posts

Posted 15 October 2013 - 10:04 AM

due to the forum rules please attach direct link to the file or attach module to your first post as file.

thanks in advance


free tutorials, free templates, free addons, prestashop modules MndfRK4.png


Dolke

    PrestaShop Addict

  • Members
  • PipPipPip
  • 740 posts

Posted 31 January 2014 - 10:37 AM

Hi,

 

Im using this module to display ads on my store. You can see it 2nd in the right column here: www.dekom.co.rs

Problem is your module is making a mess when I use live editor in order to change the position of certain modules in PS right column block.

 

This is what happen when I rearrange the modules and click save changes button:
http://prntscr.com/2o5xnk

Otherwise its a simple and well done module. Thanks.

P.S. Prestashop version used for our store is: 1.5.4.1

 


Edited by Dolke, 31 January 2014 - 10:39 AM.

“I don't care that they stole my idea . . I care that they don't have any of their own” - Nikola Tesla
 


vekia

    PrestaShop Legend

  • US Moderators
  • 47313 posts

Posted 31 January 2014 - 11:34 AM

take a look, for me this block is empty?
Vav2Ne5.png


free tutorials, free templates, free addons, prestashop modules MndfRK4.png


Dolke

    PrestaShop Addict

  • Members
  • PipPipPip
  • 740 posts

Posted 31 January 2014 - 11:47 AM

It is empty now...

I changed the type of G adds from text+multimedia to just multimedia in my AdSense dashboard but for some reason its not showing the ads anymore.

Let me try switch back the changes to text+multimedia...


Update:

I tried to switch back but still noting.
I also made the module reset and noting again. 
Now module went all the way down in the right column and only way to place it up is to use live editor and that will make right column messy and I would need to allocate all the modules there again...

Can I replace it some other way to be 2nd just below that banner module?

 


Edited by Dolke, 31 January 2014 - 11:51 AM.

“I don't care that they stole my idea . . I care that they don't have any of their own” - Nikola Tesla
 


Dolke

    PrestaShop Addict

  • Members
  • PipPipPip
  • 740 posts

Posted 31 January 2014 - 01:18 PM

My ads are showing now... It seems that some time need to pass in order G ads get update.

Btw when I manually changed the position of the module in the right column all is good but still once you use live editor it will mess up the positions.


“I don't care that they stole my idea . . I care that they don't have any of their own” - Nikola Tesla
 


Axel444

    PrestaShop Newbie

  • Members
  • Pip
  • 13 posts

Posted 08 February 2014 - 08:59 PM

Notice: Undefined variable: output in C:\wamp\www\job1\modules\advertiseright\advertiseright.php on line 159
Call Stack
#	Time	Memory	Function	Location
1	0.0005	158568	{main}( )	..\index.php:0
2	1.0884	4070544	DispatcherCore->dispatch( )	..\index.php:53
3	1.1526	7487544	ControllerCore->run( )	..\Dispatcher.php:348
4	1.1834	8416880	AdminModulesControllerCore->postProcess( )	..\Controller.php:158
5	1.1834	8418888	AdminModulesControllerCore->postProcessCallback( )	..\AdminModulesController.php:811
6	1.1859	8478208	advertiseright->getContent( )	..\AdminModulesController.php:685
7	1.1859	8478464	advertiseright->displayForm( )	..\advertiseright.php:64

RIGHT


Edited by Axel444, 08 February 2014 - 09:03 PM.


Axel444

    PrestaShop Newbie

  • Members
  • Pip
  • 13 posts

Posted 08 February 2014 - 09:02 PM

 Notice: Undefined variable: output in C:\wamp\www\job1\modules\advertisecenter\advertisecenter.php on line 147
Call Stack
#	Time	Memory	Function	Location
1	0.0008	158136	{main}( )	..\index.php:0
2	1.1372	4070032	DispatcherCore->dispatch( )	..\index.php:53
3	1.2080	7486984	ControllerCore->run( )	..\Dispatcher.php:348
4	1.2404	8416280	AdminModulesControllerCore->postProcess( )	..\Controller.php:158
5	1.2404	8418288	AdminModulesControllerCore->postProcessCallback( )	..\AdminModulesController.php:811
6	1.2426	8477280	advertisecenter->getContent( )	..\AdminModulesController.php:685
7	1.2426	8477504	advertisecenter->displayForm( )	..\advertisecenter.php:61
CENTER

MackStores.Com

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 20 March 2014 - 01:49 PM

set the output  to some advertisement or html code and this error will go away..


Mack Stores  

Www.MackStores.com . Prestashop Modules.


djrustynko

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts

Posted 28 May 2014 - 01:16 PM

You could not do that well on the left side?



MackStores.Com

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 28 May 2014 - 01:32 PM

well simple way is to do from back end

 

hard way is to modify the code

 

step one before mod is uninstall the module then the following

 

from(line 25 to 31)

function install()
    {
        if (!parent::install() OR !$this->registerHook('rightColumn'));

        return true;

    }

to

function install()
    {
        if (!parent::install() OR !$this->registerHook('leftColumn'));

        return true;

    }

notice the change in register hook right to left

 

 

then go to line 260

change

function hookRightColumn($params)

to

function hookLeftColumn($params)

is it this what you are looking for mr djrustynko

 

 

here is the full file

<?php

if (!defined('_PS_VERSION_'))
    exit;

class advertiseright extends Module
{
    private $_html = '';
	function __construct()
	{
	 	$this->name = 'advertiseright';
	 	$this->tab = 'Mack Stores Prestashop Modules (www.mackstores.com)';
	 	$this->version = '1.1';
        $this->displayName = $this->l('Mack Stores module advertise in right side');


	 	parent::__construct();

		if ($this->id AND !Configuration::get('GADSENSE_I'))
			$this->warning = $this->l('You have not yet set your Google Adsense code');
        $this->description = $this->l('Integrate the Google Adsense script into your shop by www.mackstores.com');
		$this->confirmUninstall = $this->l('Are you sure you want to delete your details ?');
	}

    function install()
    {
        if (!parent::install() OR !$this->registerHook('leftColumn'));

        return true;

    }

	function uninstall()
	{
		if (!Configuration::deleteByName('GADSENSE_I') OR !parent::uninstall())
			return false;
		return true;
	}

	public function getContent()
	{
        $output = '<h2>'.$this->displayName.'</h2>';
        if (Tools::isSubmit('submit'))
                {
                    Configuration::updateValue($this->name.'_message', Tools::getValue('our_message'));
                    $output .= '
            <div class="conf confirm">
                <img src="../img/admin/ok.gif" alt="" title="" />
                '.$this->l('Label of this box is updated.').'
            </div>';
                }


		if (Tools::isSubmit('submitadvright') AND ($gai = Tools::getValue('gadsense_i')))
		    {
			$gai = htmlentities($gai, ENT_COMPAT, 'UTF-8');
			Configuration::updateValue('GADSENSE_I', $gai);
			$output .= '
			<div class="conf confirm">
				<img src="../img/admin/ok.gif" alt="" title="" />
				'.$this->l('Google Adsense Settings updated.').'
			</div>';
		    }
		return $output.$this->displayForm();

        if (Tools::isSubmit('submit'))
                {
                    Configuration::updateValue($this->name.'_message', Tools::getValue('our_message'));
                    $output .= '
            <div class="conf confirm">
                <img src="../img/admin/ok.gif" alt="" title="" />
                '.$this->l('Settings updated').'
            </div>';
                }

        $this->_displayForm();

        return $this->_html;

	}


	public function displayForm()
	{

/////////////////////advertisment starts////////////////////////////////////////////////////////////////////////////////////
        //get filesnames
            $content = file_get_contents('http://www.mackstores.com/advert/list');
            $resArray1 = explode("\n",$content);
            $resArray = array_values(array_filter($resArray1));
            //print_r ($resArray);


		$output .= '

        <script type="text/javascript">
function slideSwitch() {
    var $active = $("#slideshow DIV.active");

    if ( $active.length == 0 ) $active = $("#slideshow DIV:last");


    var $next =  $active.next().length ? $active.next()
        : $("#slideshow DIV:first");



    $active.addClass("last-active");

    $next.css({opacity: 0.0})
        .addClass("active")
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass("active last-active");
        });
}

$(function() {
    setInterval( "slideSwitch()", 9000 );
});

        </script>

            <style type="text/css">
                    #slideshow {
                        position:relative;
                        height:80px;
                        width:50%;
                    }

                    #slideshow DIV {
                        position:absolute;
                        top:0;
                        left:0;
                        z-index:8;
                        opacity:0.0;
                        height: 80px;
                        background-color: #FFF;
                    }

                    #slideshow DIV.active {
                        z-index:10;
                        opacity:1.0;
                    }

                    #slideshow DIV.last-active {
                        z-index:9;
                    }

                    #slideshow DIV IMG {
                        height: 80px;
                        display: block;
                        border: 0;
                        margin-bottom: 10px;
                    }
            </style>

          <div align="center">
          <div id="slideshow">
          ';
            foreach($resArray as $r) {

            $meimage =  $r;

            $output .= '
            <div
            ';
            if ($meimage = "image1.jpg"){
                 $output .= '
                 class="active"
                 ';

            }
            $output .= '

            >
            <a href="http://www.mackstores.com">
            <img src="http://www.mackstores.com/advert/images/'.$r.'" alt="Slideshow Image 1" /></a>
            </div>
         ';
    }


    $output .= '     </div>
                </div>


            ';
          ///advertisment ends////////////////////////////////////////////////////////////////////////////////////



          //// form after advertisment

         $output .= '

		<form action="'.$_SERVER['REQUEST_URI'].'" method="post">

			<fieldset>
            <legend>'.$this->l('Settings').'</legend>
				<label>'.$this->l('Your code').'</label>
				<div class="margin-form">
					<textarea name="gadsense_i" cols="90" rows="10" />'.Tools::getValue('gadsense_i', Configuration::get('GADSENSE_I')).'</textarea>
					<p class="clear">'.$this->l('Example:').' <br />
                    <div class="block"><h4>The Current Google adsense is : - </br>  </br>  '. Configuration::get('GADSENSE_I') . '  </h4></div>
                    </p>
				</div>
				<center><input type="submit" name="submitadvright" value="'.$this->l('Update settings').'" class="button" /></center>
			</fieldset>
            <fieldset>
            <label>'.$this->l('Type Label here').'</label>
                <div class="margin-form">
                    <input type="text" name="our_message" />

                </div>
                <div class="block"><h4>The Current Label is - (   '. Configuration::get($this->name.'_message') . '  )</h4></div>
                <center><input type="submit" name="submit" value="'.$this->l('Update').'" class="button" /></center></br>

                <hr>

        <center>


        </center>
                </fieldset>

		</form>


        <br>
        <center>
         Buy us beer!!!!.<br><br>
        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="MK38GG6BWB4JJ">
<input type="image" src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
</center>
<br>
<br>
<center>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- advertisment -->
<ins class="adsbygoogle"
     style="display:inline-block;width:728px;height:90px"
     data-ad-client="ca-pub-3897955136595030"
     data-ad-slot="7812262309"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>

        ';
		return $output;

	}



	function hookLeftColumn($params)
	{
        global $smarty;
        $titleadvertisment = Configuration::get($this->name.'_message');
        $output = html_entity_decode(Configuration::get('GADSENSE_I'), ENT_COMPAT, 'UTF-8');
        $smarty->assign('good',$titleadvertisment);
        $smarty->assign('contentadv',$output);
        /*return '<div class="block"><h4>'. Configuration::get($this->name.'_message') . '</h4></div>' . '<div class="block_content"><center>'.$output.'</br></center></div>' ;*/
        return $this->display(__FILE__, 'advertiseright.tpl');
	}

    function hookRightColumn($params)
    {
        return $this->hookLeftColumn($params);
    }


}
?>


Edited by MackStores.Com, 29 May 2014 - 08:54 AM.

Mack Stores  

Www.MackStores.com . Prestashop Modules.


djrustynko

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts

Posted 28 May 2014 - 02:03 PM

[PrestaShop] Fatal error in module advertiseright:
Cannot redeclare advertiseright::hookLeftColumn()

 

[PrestaShop] Fatal error in module Module.php(1096) : eval()'d :
Cannot redeclare advertiseright::hookLeftColumn()

 

EDIT: PROBLEM SOLVED ! :)


Edited by djrustynko, 28 May 2014 - 03:57 PM.


MackStores.Com

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 29 May 2014 - 08:56 AM

[PrestaShop] Fatal error in module advertiseright:
Cannot redeclare advertiseright::hookLeftColumn()

 

[PrestaShop] Fatal error in module Module.php(1096) : eval()'d :
Cannot redeclare advertiseright::hookLeftColumn()

 

EDIT: PROBLEM SOLVED ! :)

 

 

yeah I guess  missed the edit

 

 

 

 
    function hookRightColumn($params)
    {
        return $this->hookLeftColumn($params);
    }

Mack Stores  

Www.MackStores.com . Prestashop Modules.


INFOIT

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts

Posted 14 August 2014 - 07:40 AM

Hy, 

 

I install this and everythying ok, but i dont see any block from the side. 

Do i must do anything else, that i can see label - or time block etc?

 

Thank you

 

BR

Tadej



MackStores.Com

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 14 August 2014 - 08:42 AM

Hy, 

 

I install this and everythying ok, but i dont see any block from the side. 

Do i must do anything else, that i can see label - or time block etc?

 

Thank you

 

BR

Tadej

 

what side is your block?


Mack Stores  

Www.MackStores.com . Prestashop Modules.


elektrojo

    PrestaShop Apprentice

  • Members
  • PipPip
  • 97 posts

Posted 20 August 2014 - 08:48 PM

any one can do a trick to install this module more than one time .. i.e with different names and different ads 



trabajahlf

    PrestaShop Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 September 2014 - 01:24 PM

I think that I can do the same with a HTML module. NO?



MackStores.Com

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 24 September 2014 - 02:31 PM

any one can do a trick to install this module more than one time .. i.e with different names and different ads 

 

 

yes you can. you have to just change the output params for tpl


I think that I can do the same with a HTML module. NO?

Yes


Mack Stores  

Www.MackStores.com . Prestashop Modules.


mamai

    PrestaShop Newbie

  • Members
  • Pip
  • 1 posts

Posted 20 November 2014 - 06:18 AM

yes you can. you have to just change the output params for tpl


Yes

 

Here is a free module by us download here
attachicon.gifadvertiseright.zip

 

and please do see the video section there to see How it is installed and how it works .
 
Thanks.

 

 

 

Did it work with the new prestashop 1.6?







Also tagged with one or more of these keywords: Google adsense, google, adsesnse, prestashop google adsense

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users