Jump to content

How can I clone advertisement module


Recommended Posts

All you do is copy the blockadvertising folder & change blockadvertising.php
For example

<?php

class BlockAdvertising2 extends Module
{
   function __construct()
   {
       $this->name = 'blockadvertising2';
       $this->tab = 'Blocks';
       $this->version = 0.1;

       parent::__construct(); // The parent construct is required for translations

       $this->page = basename(__FILE__, '.php');
       $this->displayName = $this->l('Block advertising 2');
       $this->description = $this->l('Adds a block to display advertising');
   }

   function install()
   {
       if (!parent::install())
           return false;
       if (!$this->registerHook('rightColumn') OR !$this->registerHook('leftColumn'))
           return false;
       return true;
   }

   /**
   * Returns module content
   *
   * @param array $params Parameters
   * @return string Content
   */
   function hookRightColumn($params)
   {
       global $smarty;
       $smarty->assign('image', './modules/'.$this->name.'/advertising.jpg');
       return $this->display(__FILE__, 'blockadvertising.tpl');
   }

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

}

?>

Link to comment
Share on other sites

  • 2 weeks later...
All you do is copy the blockadvertising folder & change blockadvertising.php
For example

<?php

class BlockAdvertising2 extends Module
{
   function __construct()
   {
       $this->name = 'blockadvertising2';
       $this->tab = 'Blocks';
       $this->version = 0.1;

       parent::__construct(); // The parent construct is required for translations

       $this->page = basename(__FILE__, '.php');
       $this->displayName = $this->l('Block advertising 2');
       $this->description = $this->l('Adds a block to display advertising');
   }

   function install()
   {
       if (!parent::install())
           return false;
       if (!$this->registerHook('rightColumn') OR !$this->registerHook('leftColumn'))
           return false;
       return true;
   }

   /**
   * Returns module content
   *
   * @param array $params Parameters
   * @return string Content
   */
   function hookRightColumn($params)
   {
       global $smarty;
       $smarty->assign('image', './modules/'.$this->name.'/advertising.jpg');
       return $this->display(__FILE__, 'blockadvertising.tpl');
   }

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

}

?>





and how can we move it to the Left column side?
Link to comment
Share on other sites

It's all in the wiki
http://www.prestashop.com/wiki/Moving_and_Transplanting_Modules/

however if this module is to stay on the left

change:

if (!$this->registerHook('rightColumn') OR !$this->registerHook('leftColumn'))


to:

if (!$this->registerHook('leftColumn'))



and then change:

function hookLeftColumn($params)
   {
       global $smarty;
       $smarty->assign('image', './modules/'.$this->name.'/advertising.jpg');
       return $this->display(__FILE__, 'blockadvertising.tpl');
   }



removing the additonal function hookLeftColumn($params)

Link to comment
Share on other sites

Hi

I cant really get this working :(

I created a blockadvertising folder and named it blockadvertising2
How do I link to the the new folder from the Back Office???

Sif

Link to comment
Share on other sites

You need to copy the folder blockadvertising and name the new copyblockadvertising2. Then rename all the files i the new directory from blockadvertising.php etc. to blockadvertising2.php etc.

Now you edit these renamed files and replace blockadvertising INSIDE them to blockadvertising2.

One you've done these steps you should be able to cick install from within the modules section of admin, and you're done.

Paul

Link to comment
Share on other sites

Hi. I got the module to work, but now it shows on
both sides (left and right column). Strange. Any way I can
remove the advertising from the left? I moved it to display
on the right in the back office, but somehow the left would
not disappear?? :-)

Thanks so much for any help.

Julianna

Link to comment
Share on other sites

Never mind..I did it. :-) I just went to show: blockadvertising2
and a duplicate came up...so I just deleted one.

Ok..but I have one more quick question if you don't mind. I have
an advertisement that is in script form...shown below:

[removed] d=document;s=screen;n=navigator; js_ver="1.0"; nn=(n.appName.substring(0,3)=="Mic")?0:1; req="&"+escape(d.referrer)+ "&"+escape([removed].href); [removed][removed] req+="&"+(n.javaEnabled()?1:0); req+="&"+s.width+'x'+s.height+"&"+((nn)?s.pixelDepth:s.colorDepth); [removed] [removed] d.write("Gift Baskets sites at Top100biz.com"); [removed]Top100biz.com

Can this type of advertising be added? I can't figure out where to put this.

Thanks so much for your help.

Julianna

Link to comment
Share on other sites

  • 1 year later...

Juliana/Gothchiz - you can also use the "Free Block" module in the "Third Party Modules" section as well. In there you can just hit the "html" tab on the editor and copy and paste your code into there.

Another alternative is to use CMS under the "tools" tab in admin and refer back to the page created either using the Links Block or the horizontal menu module.

I have used both of these instead of the advertising block as they give more versitility, for examples of both in operation see my site. The competition on the left side with the facebook code is done using the "free Block" module and the "Competition" link in the top horizontal menu is made using CMS.

http://www.leathergoods.co.nz

Any further info, just ask...
Oh and the competition entry form was made using Coffecup Flash Form Builder (there are a number of free versions of this hanging around in computer magazines and web design magazines)

Link to comment
Share on other sites

  • 2 months later...

Any further info, just ask...


yes, please. copied the freeblock and all works fine, it sits under the regular freeblock on the left side. however, freeblock1 is centered and the new one not, i.e. it is little bit left from block1? where can I find the information that freeblock2 is not centered on the left column and what do I need to do to correct this?

phil
Link to comment
Share on other sites

  • 4 years later...

Hi guys.

 

I recently did same thing, I made 4 clones from Blockadverising module, everything worked. But, I have problems with cache or smth. Some time modules shows same pictures and links. Everytime when I need to change like Blockadverting3 module, then changes appear every module. And at moment, when I sign in with user account, then I see all same pictures.

I named that modules:

blockadvertising

blockadvertising2

blockadvertising3

blockadvertising4

blockadevrtising5

 

Maybe someone had same issue? And how I need figure out?

 

I will try to find this problem at tonight, but perhaps some presta user knows solutions..

Link to comment
Share on other sites

×
×
  • Create New...