Child pages
  • Contributing code to PrestaShop

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

Working using Git

In order to make changes to PrestaShop's code, you first need to create a local fork of PrestaShop within Github.This means you , or at least have your own Github repository. When your changes are done, you must send your work to the PrestaShop developers for approval. This means installing a tool to retrieve the PrestaShop code from Github, edit it at will on your machine, and send your changes back on PrestaShop's Github. If all this sounds like a foreign language, you should learn about Git and Github first. Go to the "Understand Git" section of this page.

Contributing to PrestaShop means you must first create an account on Github, and then:

  1. Go to https://github.com/PrestaShop/PrestaShop.
  2. Click on the "Fork" button (top right of the page).

...

  1. Fork the project. If you have a fix for PrestaShop 1.5.x, you should apply this process to the PrestaShop 1.5 project.
  2. Create a branch in your fork for your changes.
  3. Change the files on your branch. Be sure to follow the the coding standards.
  4. Push your branch to your Github account.
  5. Create a pull request for your changes on the PrestaShop project. Be sure to follow the commit message norm in your pull request. If you need some help to make a pull request, read the Github help page about creating pull requests.
  6. Wait for one of the core developers either to include your change in the codebase, or to comment on possible improvements you should make to your code.

Making changes directly in Github

Github makes it possible to edit files directly online. Here is how:

  1. From your fork of PrestaShop, reach the file you intend to edit by clicking through the various folders.
  2. Once the file opened on the screen, four buttons appear at the top of the source code: "Edit", "Raw", "Blame" and "History". Click "Edit".
  3. This opens the file in an online editor. Now you can make your changes directly in that editor.
  4. Once your are done with writing your changes, click the "Preview" button: this will display the file's "diff", which is the difference between your file and the original file. Take the time to check that there is nothing wrong.
  5. Save the file by clicking on the "Commit Changes" button. Do not forget to give it a commit summary and, if needed, an extended description of what your file brings to PrestaShop. This is essential as the PrestaShop developer will use it to get the context of your changes, and therefore to decide whether it should be added to PrestaShop or not.
  6. Now the file is saved on your own fork of PrestaShop. You have to submit thatBrowse to the target file.
  7. Click the "Edit" button.
  8. Make your changes in the editor then click on "Propose File Change".

Github will automatically create a new fork and branch on your own Github account, then suggest to create a pull request to PrestaShop. Once the pull request is submitted, you just have to wait for a core developer to answer you.

You can also easily create a new file directly on Github:

...

Note

Make sure that you are always making changes to the latest version of the original repository. This means that the "Branch" button above the list of file should read "branch: development", and not "branch: master".

The development branch is the one where all current works are pushed to.
The master branch is a snapshot of the development branch which was used to build the previous stable version of PrestaShop.
The release branch is the forthcoming stable version.
Others branches are for specific current projects, and should not be touched.

Sending your file for inclusion in PrestaShop

Until now, all you have done is work locally – or at least, in your own repository in Github. If you keep it that way, the PrestaShop developers will never know that you did anything here. You must send your work to them.

...

Understanding Git

You can find instructions on the Github website (more here), but the best way to go is to learn more about Git and Github:

...