Access to PrestaShop corporate website French English Change language
Hello, Guest |
| Register
Remember me Forgot password ?
Site Map Site Map Contact us Contact us
PrestaShop job
 
Forum  >  PrestaShop v1.1  >  Modules  >  Thread

Team members online:


 
Post Reply
New Topic
Creating a new module

offline
Posted: 28 August 2008 09:21 AM   [ Ignore ]
Apprentice
RankRank

Messages :

  • total: 12
  • last 7 days: 0
Joined: 2007-12-20

I want to create a simple module.
But i am not able to get it right: i copyed a simple module from modules directory, renamed that directory, all the files in it and moved back in the modules directory. In back office, in modules tab, the loading page hags up… and i see no module there…

What is the structure of the module?
Were are the all files linked to one simple module, like links module?

Where can i find that kind of information?

thank you.

 Signature 

sex shop adult shop
sex shop ro

 
offline
Posted: 28 August 2008 10:39 AM   [ Ignore ]   [ # 1 ]
Partner
RankRankRankRankRankRankRank
Avatar

Messages :

  • total: 506
  • last 7 days: 25
Joined: 2008-08-03

You also need to change the Class defiinition in the file, in order to create your unique module…. If you were to take the blockadvertising one as an example, at thetop of the file blockadvertising.php you’ll find:

class BlockAdvertising extends Module
{
    
function __construct()
    
{
        $this
->name 'blockadvertising';
        
$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');
        
$this->description $this->l('Adds a block to display an advertising');
       
}

You need to create a new class (a new module), so you’ll have to change the first line at the very least. In order to prevent confusion I suggest you change the other values too, as these are what people will see in their Back Office wink
Example:

class MyBrilliantModule extends Module
{
    
function __construct()
    
{
        $this
->name 'mybrilliantmodule';
        
$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('My Brilliant Module');
        
$this->description $this->l('This is a brilliant module');
       
}

You’ll also need to replace any other references to ‘BlockAdvertising’ in the original module files.

Paul

 Signature 

ukprestaclub_sig.gif
My French is terrible, so feel free to laugh when I attempt to post en français.

 
offline
Posted: 28 August 2008 11:28 AM   [ Ignore ]   [ # 2 ]
Apprentice
RankRank

Messages :

  • total: 12
  • last 7 days: 0
Joined: 2007-12-20

i made everything perfect except i forgot to change the name of the class according to the name of the new module.

it is a romanian module only, you can see it on my prestashop webpage in the signature (Curs bnr ), i will share it on the right forum with romanians.

Thank you

 Signature 

sex shop adult shop
sex shop ro

 
 
 
Fast Reply
New Topic