PrestaShop Forum

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

PrestaShop Forum

Jump to content

 

[SOLVED] How to change settings for Block Advertising?

23 replies to this topic
#1
Paradox

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
How do you change the picture and link for the Block Advertising?

How do you also add more than one with different settings?

Thanks

#2
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
In Prestashop v1.3, you can go to Modules > Blocks section > Block advertising v0.1 > Configure and then select an image and change the URL. In Prestashop v1.2.5 and earlier, you must manually modify modules/blockadvertising/blockadvertising.tpl to change the URL and overwrite modules/blockadvertising/advertising.jpg to change the image.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#3
annunakiwww

    PrestaShop Newbie

  • Members
  • Pip
  • 23 posts
And is it possible to have several (different) advertisements? So basically is it possible to duplicate the advertisement module?
Thanks a lot in advance!

#4
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
Unfortunately, simply transplanting the advertising module in multiple locations will just display the same ad, not different ads. You'll need to copy the blockadvertising module and change the folder name to blockadvertising2 and blockadvertising.php to blockadvertising2.php and in that file, change:


class BlockAdvertising extends Module


to:


class BlockAdvertising2 extends Module


and:


$this->name = 'blockadvertising';


to:

$this->name = 'blockadvertising2';


You can do the same with number 3, for example, if you need three advertising modules.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#5
annunakiwww

    PrestaShop Newbie

  • Members
  • Pip
  • 23 posts
Rocky, I had been struggling with this for hours. Your solution worked like a charm. Thank you very much!

#6
eileensiow

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts

From 1265201690:

Unfortunately, simply transplanting the advertising module in multiple locations will just display the same ad, not different ads. You'll need to copy the blockadvertising module and change the folder name to blockadvertising2 and blockadvertising.php to blockadvertising2.php and in that file, change:


class BlockAdvertising extends Module


to:


class BlockAdvertising2 extends Module


and:


$this->name = 'blockadvertising';


to:

$this->name = 'blockadvertising2';


You can do the same with number 3, for example, if you need three advertising modules.


I tried to follow the process above but there were no new advertising block appear. Am i missing something?

#7
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
It works fine for me. I'll attach the updated module.

Attached Files


Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#8
eileensiow

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts

From 1267953469:

It works fine for me. I'll attach the updated module.


The module you updated,i uploaded the blockadvertising2 folder and it appeared:

"No template found" in my online shop.

What could be wrong?

Thanks

Regards,
Eileen

#9
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
Sorry, my mistake. I've updated the above archive.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#10
matt123

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
I had been struggling with this for hours Thanks for the solution

#11
keiichi

    PrestaShop Apprentice

  • Members
  • PipPip
  • 33 posts
Is it posible to use modules from SP 1.3.1 beta in 1.2.5 like Block advertising v0.1?

#12
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
Yes, but only the simple ones that don't rely on modified core code. The advertising block is one much module.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#13
prestasimo

    PrestaShop Fanatic

  • Members
  • PipPipPipPip
  • 1607 posts
Thank you rocky!

I would also rename:
$this->displayName = $this->l('Block advertising');
to:
$this->displayName = $this->l('Block advertising2');

So you can distinguish them in the BO

Regards.

#14
Emieliooo

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
Hi folks,

I followed the workaround and now I have four different folders:
blockadvertising, blockadvertising2, blockadvertising3, blockadvertising4
so far so good.
All four ads have different pictures but the links are all the same. I cant find a reason why all four ads link to the same site.
What am i doing wrong?

Can anyone help me.
If you need more info, just tell me.
Thanks in advance.

I included blockadvertising"1" and blockadvertising3 (zip folders)

Attached Files



#15
rocky

    PrestaShop Superstar

  • US Moderators
  • 9988 posts
The problem is that you forgot to change the BLOCKADVERT_LINK setting to BLOCKADVERT3_LINK so that they are writing to different database keys. At the moment, both the modules are sharing the same database key and overwriting each other's values.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.

#16
Emieliooo

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
Thanks, why haven't I thought about that.
It's so obvious.

It works fine now, thanks thanks thanks!

#17
SandyW

    PrestaShop Newbie

  • Members
  • Pip
  • 15 posts
Hi,

I have followed the workaround and made blockadvertising02.php. I got the new module kinda working and have it show an image. But same as eileensiow, blockadvertising02 is linked to the same website as the original blockadvertising module, even after I have changed the BLOCKADVERT_LINK setting to BLOCKADVERT02_LINK as rocky instructed. And I checked both of the files which eileensiow and rocky shared, they are quite a bit different from mine, even though mine states as version =0.1 as well.

I have attached my file here. Would someone please give me some hint here. Thanks much!

Attached Files



#18
SandyW

    PrestaShop Newbie

  • Members
  • Pip
  • 15 posts
Sorry, everyone! I have solved my problem now! It was just something stupid that I have done.

The way rocky provided works perfect! Cheers!

#19
webmc

    PrestaShop Newbie

  • Members
  • Pip
  • 8 posts
Before I found this topic I had already cloned this module. It works perfectly on my local host but doesnt show up in the admin section or front page on live site. I also tried downloading this module off this thread and trying it - the same thing happened. Does anyone know what the problem can be?

#20
SandyW

    PrestaShop Newbie

  • Members
  • Pip
  • 15 posts
Hi webmc,

Have you put the cloned module - blockadvertising02 - in your module file? If you do, you should be able to find it in the module page of your admin section.