Hi, this is my first tutorial about OpenCart and it will be followed by many others, I hope. I will try to present the most interesting problems that I have solved and some ideas, solutions and bug fixes that can be useful. Also I will show some new features that is easy and good looking to have on your site. But to explain all this I should start from the beginning, so let me introduce you – OpenCart!
OpenCart is a PHP based e-shop system, it is working on the MVC design pattern and also is one of the most popular e-commerce solutions in the world. There are a lot of reasons for you to choose OpenCart – it is fully translated on many languages, it is offering you payment and shipping methods, taxes and localization set up, intuitive content management and much more. You can also choose between a plenty of themes, free and premium, to create a really beautiful front-end view of your project. So you have already picked up OpenCart for your project and you are wondering where to start. Here comes this tutorial.
In the very beginning of the project you have to take a deep look to OpenCart features and to decide what you need to develop by yourself. You can also choose your template or the design that must be integrated into an OpenCart theme, to check if you have some work to do on it. After that we are ready to work.
It is time to install our OpenCart shop! We will need a database and database user, that you can create from the hosting control panel. After that we have to upload the OpenCart files to the folder on our server where the site will be hosted. The real installation is happening when we reach the url of our new site and it is easy and quick. So we have our first OpenCart e-shop!
There are a lot of tutorials that explain mostly everything about the admin panel part of the site so, I will skip that. Otherwise we will take a look to the file stucture of the code. As I said before OpenCart is a MVC system, but in fact it is MVC+L system. That’s mean that we have model – view – controller files + language files and it is the reason to be so easy to translate our projects. We have five folders where the files are stored – admin, catalog, downloads, image and install. You have to delete the install folder right after the installation set up. The other four are the folder that we are going to work with. As you guess the admin and catalog folder are the most important part of the system. These two folders run the back and the front- end part of every opencart project. As we already said they contain four subfolders – model, view, controller and language.
I hope that you are familiar with the MVC structure so I will pass this explanation. The interesting that I should mention here is how the text, links and images in both catalog and admin are inserted. They are added to an array “data” and defined in every controller for it’s respective view. So you should be careful when you want to edit or add something.To change the value of a variable you should check if it is bilingual and if the answer is yes to correct the language file. Otherwise the change should be in the controller. I will explain how to add fields in my next tutorial.