How to create an eCommerce Website using Laravel

Posted on Oct 29 2020 by in Blog Blog Post Blogs 

How to create an eCommerce Website using Laravel

First of all, kudos to your decision of creating an eCommerce website using Laravel, these days, everybody is dependent on plugins and prebuilt stores. Creating an Ecommerce website using a programming language and frameworks will help you create an ideal website for your online business. Most users while starting a dropship business or eCommerce business tend to opt for easy option of CMSs which are easy to setup a website but aren’t that secured and well performing. With Laravel, they can create a feature rich website which loads fast. Surely, it will boost your plans.

But before proceeding with the process, you must learn about some prerequisite of the process:

  1. Prior Knowledge of PHP, work hand experience PHP7.x will make the process more smooth and hustle free for you.
  2. High-speed Server
  3. Knowledge of PHP and Laravel Frameworks

Besides all these, a primary computer with an internet connection is a must. You must consider a high-speed responsive server, do not pick an average hosting server as it might affect your website’s performance significantly.

In this process, we are going to use a free eCommerce framework of Laravel, i.e. Bagisto. Bagisto will have a free eCommerce theme, but if you have your theme, you are free to use it.

Installing Frameworks

Follow the steps carefully to avoid any errors, make sure you don’t skip any of the steps; otherwise, there are chances that you’ll be running into errors:

Step 1. Setting up the Laravel Framework on your system.

There are two different ways to install Laravel framework: one is to use the HomeStead installation process, second is to use WAMP/XAMP server and then manually installing the Laravel via Composer. 

If you are interested in the First method, you can read the installation guide here.

Step 2. Install Bagisto Framework of Laravel

To install the Bagisto, you have two different ways. First is using the SSH terminal and second via GUI installer.

For this tutorial, the SSH terminal will be used. Follow the steps mentioned below:

Step 2.1 Download Bagisto

To download Bagisto framework, you need to open the SSH terminal and go to your server directory.

Run the command to download the bagisto in the desired directory.

composer create-project bagisto/bagisto

If your system doesn’t have a composer on your system, you can download the
“composer.phar” file and place it in the root folder and run the command:

php composer.phrp create-project bagisto/bagisto

Step 2.2 Set the .env variables

All the required files of bagisto will be automatically downloaded, now navigate to the downloaded files and locate the file with .env file.

Open it using any text editor.

In this file, you’ll have seven different fields:

APP_URL

DB_CONNECTION

DB_HOST

DB_PORT

DB_DATABASE

DB_USERNAME

DB_PASSWORD

Set their respective values, (refer to the image attached below)

Note: For this tutorial, localhost is used, you can directly implement on your hosting server but make sure you are “using VPN for security”.

Step 3. Create a migration table in the database

Now you need to create a migration table in the database that you have defined in the .env file.

Run the following command:

                        php artisan migrate

Step 4. Seed the database using the seeded classes

Use the following command to seed the database.

            php artisan db:seed

Step 5. Copy all the configuration and asset files to the specified publish directory.

            php artisan vendor:publish

On execution, you will get the following result:

-> Press 0 and then press enter to publish all assets and configurations.

Step 6. Create a link between the storage directory with the public so that anyone can access the images.

Run the following command to create the symbolic link:

                        php artisan storage:link

That’s how you install the bagisto framework and do all the required configurations.

Accessing the website front page.

Now, you can test the installed by accessing the front-end of the website.

Step 1. Open the following link in your browser:

            localhost/bagisto

Step 2. Navigate the public folder and click on it.

Step 3. As soon as you click not the public folder, your website’s index webpage will appear in front of you.

Note: If any error occurs, check the directory, it does not have any files. Try restarting the process from installing the frameworks.

Accessing the admin panel of the website

Since you are accessing the admin panel for the first time, you need to enter the default credentials.

Use the URL to access the admin panel:

            http(s)://example.com/admin/login

Later, if you want, you can change them. Check for tutorials on forums to change the credentials of the admin panel.

Default Credentials:

            Email: admin@example.com

            Password: admin123

In this Admin Panel, you’ll find all the required control to manage an eCommercewebsite efficiently. Besides this, since it is a custom made websites, you can add desired modules like “Live Chat”, “Newsletters”.

It is recommended to check for the tutorials on the internet to get an exact idea about any module.

Note: If you want your website to load fast and perform well, you must go for the best hosting servers, do check the trusted website that “review hosting plans” and pick accordingly. Besides this, these days, websites are being attacked by hackers; it is must be “using VPN for security” reasons. Even while surfing the internet, you must use a VPN to keep your personal information safe and sound.

Final Notes

Though there are dozens of platforms to create an eCommerce website in just a few seconds, but they are prone to attacks and quite complex. A Laravel website might seem complicated right now, but when you use it, you will find it extremely simple and way more faster than other sites.

Apart from this, it will be easy for you to alter the structure of the website. In future, the Laravel developers will be adding more features to the framework, and that will allow you to customize your website more efficiently and comfortably.

If you face any issue while creating your eCommerce website using Laravel and Bagisto framework, you can drop your query down, someone from our team will follow it up with you and will fix the issue as soon as possible.