Child pages
  • Contributing code to PrestaShop

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Contributing code to PrestaShop

As an open source project, PrestaShop strives thanks to its community, and especially from volonteer developers who are willing to give some of their time to help resolve issues in the code.

If you are a software developer, you can help the development of PrestaShop by fixing problems that have been reported by you or another person in the Forge.

If you find an issue, report it on the Forge: read the "How to use the Forge to contribute to PrestaShop" chapter to learn more, at http://doc.prestashop.com/display/PS15/How+to+use+the+Forge+to+contribute+to+PrestaShop.

If you want to help fixing a bug by writing a patch, there are a few steps to follow. In short, your submission should be made as a pull request on GitHub (https://github.com/PrestaShop/PrestaShop/pulls).

If you have never used Git or Github, read the following instructions.

 

Forking PrestaShop

In order to make changes to PrestaShop's code, you first need to create a fork of PrestaShop within Github.

This 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).

Now you can go to your own version of PrestaShop from your Github account, and make changes there before you submit them to the PrestaShop developers.

Making changes directly in Github

A recent change to the way Github works has made 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 that

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

  1. From your fork of PrestaShop, click the "+" button next to the project's name (usually, next to "PrestaShop").
  2. Once the online editor is open, type your code in the screen. Try not to forget to add the notice of license and the disclaimer in a comment section at the top of the file, just like every other files in PrestaShop do.
  3. Save your file. Do not forget to give it a name, along with 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 file, and therefore to decide whether it should be added to PrestaShop or not.
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.

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. You can find instructions on the Github website (more here), but the best way to go is to learn more about Git and Github: