[Prestashop development] Lesson 1: How to create a New module for Prestashop?

In this post, Buy-addons team will take you how to create a new prestashop module. Our example is named buyaddonsexam module.

Step 1: Go to PRESTASHOP_ROOT\modules, create a new directory that is name_of_your_module. for our an example, we have created a directory: buyaddonsexam, now path to your module is PRESTASHOP_ROOT\modules\buyaddonsexam

create-new-module-1

Step 2: Create a PHP file that must be named name_of_your_module.php within PRESTASHOP_ROOT\modules\name_of_your_module. Now path to this PHP file is PRESTASHOP_ROOT\modules\name_of_your_module\name_of_your_module.php. The content of this file like our sample buyaddonsexam.php file.

Our sample PHP file: modules\buyaddonsexam\buyaddonsexam.php

You should download our sample PHP file for our prestashop module and modify it to your information.

buyaddonsexam.php.txt

Note: you must rename buyaddonsexam.php.txt filename to name_of_your_module.php  and move it to PRESTASHOP_ROOT\modules\name_of_your_module after downloaded it.

Change information of this file to information of your module

  • class BuyaddonsExam: change to class name_of_your_module (not case sensitive)
  • add logo.png file into PRESTASHOP_ROOT\modules\name_of_your_module, this picture will be displayed in Prestashop backoffice.
  • $this->name = “buyaddonsexam”: change to $this->name = “name_of_your_module
  • $this->tab = “front_office_features”: change front_office_features to other tab name that you want display your prestashop module at there in Prestashop Backoffice. View all tabs at here:
“Tab” name Module section
administration Administration
advertising_marketing Advertising & Marketing
analytics_stats Analytics & Stats
billing_invoicing Billing & Invoices
checkout Checkout
content_management Content Management
dashboard Dashboard
emailing E-mailing
export Export
front_office_features Front Office Features
i18n_localization I18n & Localization
market_place Market Place
merchandizing Merchandizing
migration_tools Migration Tools
mobile Mobile
others Other Modules
payments_gateways Payments & Gateways
payment_security Payment Security
pricing_promotion Pricing & Promotion
quick_bulk_update Quick / Bulk update
search_filter Search & Filter
seo SEO
shipping_logistics Shipping & Logistics
slideshows Slideshows
smart_shopping Smart Shopping
social_networks Social Networks
  •  $this->version = “1.0.0”: change 1.0.0 to version of your module. it started from 1.0.0 -> 1.0.1 -> 1.0.x -> 1.1.0…
  • $this->author = “buy-addons”: change buy-addons to your company name
  • $this->displayName, $this->description: change to your module. there text will display in Prestashop Backoffice > Modules

create-new-module-2

Step 3: Go to Prestashop Backoffice > Modules > Module Catalog (In Prestashop 1.7) or Prestashop Backoffice > Modules & Services (In Prestashop 1.6), find your prestashop module and install it.

create-new-module-3

Now you already created and installed successfully a prestashop module. you can learn more to develop module for Prestashop order to extend Prestashop’s functions for your website.

Our FULL demo for prestashop module buyaddonsexam.zip

Read more our posts for Prestashop developer: https://buy-addons.com/blog/topics/prestashop/developement/

Related Articles

Leave a reply

You must be logged in to post a comment.