PrestaShop Forums: how to create a new module? any kind! - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


how to create a new module? any kind!


how to create a new module? any kind!

#1 FireDog

    PrestaShop Apprentice

  • 22 Jan 2008
  • Members
  • PipPip
  • 43 posts
  • Location:Sao Paulo

Posted 09 February 2008 - 09:06 PM

Hi if anybody there know how to create a new module for prestashop please explain here or leave a tutorial adress...

i want to create a new payment module, cause in brazil, prestashop payments modules doesn't work, paypal doesn't have our currency. :/

waiting for suggestions.

thx

#2 By Kuhi

    PrestaShop Apprentice

  • 13 Aug 2008
  • Members
  • PipPip
  • 86 posts
  • Location:Ankara

Posted 30 October 2008 - 05:08 AM

Are Oscommerce modulles to adjust Prestashop ?

Please ....?
www.presta-tr.com

#3 Paul C

    PrestaShop Fanatic

  • 02 Aug 2008
  • Members
  • PipPipPipPip
  • 1003 posts
  • Location:Dundee, Scotland, United Kingdom

Posted 02 November 2008 - 11:59 PM

The answer is that it's either very easy to do (if you're used to programming in PHP using objects and classes) or very difficult!

The best way to learn is to take one of the simpler modules and play with the basic code until you understand the basics of how it works. You don;t need much code for a "minimal" implementation.

It terms of porting osCommerce code..... it's almost entirely a different thing, except in terms of payment modules where certain blocks of code could be easily re-used.

Paul
Free Prestashop modules and developer resources

Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2

Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net

#4 davadda

    PrestaShop Newbie

  • 08 Oct 2008
  • Members
  • Pip
  • 5 posts
  • Location:Bochum/Wesel Germany

Posted 26 November 2008 - 03:12 PM

And if I don't want to re-use any existent module but create an own one from the scratch?
What are the basics for creating modules? What do I have to mind to, if I create a module?

Are there any Tutorials or faqs regarding to that that topic?

Thanks for your help.
davadda

#5 Paul C

    PrestaShop Fanatic

  • 02 Aug 2008
  • Members
  • PipPipPipPip
  • 1003 posts
  • Location:Dundee, Scotland, United Kingdom

Posted 26 November 2008 - 03:25 PM

Well the most basic one (non payment):


<?php

class mymodule extends Module {


}

?>


Not sure what you're asking apart from that?? :)

Paul
Free Prestashop modules and developer resources

Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2

Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net

#6 davadda

    PrestaShop Newbie

  • 08 Oct 2008
  • Members
  • Pip
  • 5 posts
  • Location:Bochum/Wesel Germany

Posted 26 November 2008 - 03:35 PM

Thanks for your quick answer. The code you submitted was my first idea, but it does not work.


class test extends Module
{
public function __construct()
{
$this->name = 'test';
$this->tab = 'Tools';
$this->version = "0.1";

parent::__construct();

/* The parent construct is required for translations */
$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('Test');
$this->description = $this->l('Just a test!');
}
}


Thats my code, but it does not get listed in the modules list. Any idea?

(If I change the name of the google adsense Module for example it works - the name changes in the modules list - but if I change the folder name it is not listed anymore. Is there any Config that I have to edit?)

#7 Paul C

    PrestaShop Fanatic

  • 02 Aug 2008
  • Members
  • PipPipPipPip
  • 1003 posts
  • Location:Dundee, Scotland, United Kingdom

Posted 26 November 2008 - 04:03 PM

OK, create a file containing the following, and call it test.php.


<?php
class test extends Module
{
public function __construct()
{
$this->name = 'test';
$this->tab = 'Tools';
$this->version = "0.1";

parent::__construct();

/* The parent construct is required for translations */
$this->page = basename(__FILE__, '.php');
$this->displayName = $this->l('Test');
$this->description = $this->l('Just a test!');
}

function install()
{
if (!parent::install())
return false;

return true;
}

}
?>


Make a directory /modules/test and put the above file in it, and it should show up in the back office :)

The $this->name member variable must match the directory and filename (case sensitive). The Class name must also match, but isn't case sensitive.

Paul
Free Prestashop modules and developer resources

Latest Prestashop Developer articles:
* 1.4 Plugins Revisited – Part 1
* 1.4 Plugins Revisited – Part 2

Latest News:
Prestashop Module and Theme Developers can now Advertise on eCartService.net

#8 davadda

    PrestaShop Newbie

  • 08 Oct 2008
  • Members
  • Pip
  • 5 posts
  • Location:Bochum/Wesel Germany

Posted 26 November 2008 - 04:13 PM

Thank you very much. I found that out about some minutes ago.
A short faq about that would make it easier to create the first module :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users