Updated on 2024-09-27 GMT+08:00

Using PrestaShop to Build an E-Commerce Website

Application Scenario

PrestaShop is a full-featured, cross-platform, and open source e-commerce platform written in the PHP programming language with support for the MySQL database management system. PrestaShop supports transactions using different currencies and almost all payment methods, such as Paypal. It is a good choice for you to build foreign trade websites. Supported By FlexusL, the PrestaShop application image uses Ubuntu 22.04 and is deployed using Docker. The Nginx, MySQL, phpMyAdmin, and Docker have been preconfigured in the image. This section describes how to use PrestaShop to build an e-commerce website.

Resource Planning and Costs

This practice uses the following resource planning as an example. You can adjust it as required.

Resource

Configuration

Description

Cloud server

  • vCPUs: 2
  • Memory: 2 GiB

Select appropriate instance specifications based on your service requirements.

Image

PrestaShop

Select the PrestaShop application image.

Security group

Inbound rule:
  • Protocol/Application: TCP
  • Port: 9001,9000,3306
  • Source: 0.0.0.0/0
  • 80: Specifies the internal forwarding port of application images.
  • 9000: Allows external access to the application O&M dashboard.
  • 9001: Allows external access to the application management page.
  • 3306: Allows access to MySQL databases.

Domain name

wpwebsite.com

  • If the website is only used for personal development or testing, there is no need to add a domain name.
  • If the website is open to the public, add and resolve a domain name for the cloud server.

Procedure

Procedure

Description

Step 1: Purchase a FlexusL Instance

Purchase a FlexusL instance and select the PrestaShop application image.

Step 2: Configure Security Groups

Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.

Step 3: Initialize Prestashop

Log in to PrestaShop and select the desired language for the management page.

Step 4: Deploy Prestashop

On the dashboard, perform the following operations:

  • Manage language packages and set languages
  • Manage modules
  • Back up databases
  • Configure domain names

Step 1: Purchase a FlexusL Instance

  1. Log in to the FlexusLconsole and click Buy FlexusL.
  2. Specify required parameters for the FlexusL instance.

    Parameter

    Example

    Description

    Region

    CN-Hong Kong

    For low network latency and quick resource access, select the region nearest to your target users. After a FlexusL instance is created, the region cannot be changed. Exercise caution when selecting a region.

    Application Images

    PrestaShop

    Select the PrestaShop application image.

    Instance Specifications

    2 vCPUs | 2 GiB memory and 60 GiB system disk

    Select instance specifications as needed.

    Instance Name

    PrestaShop-Example

    Customize an instance name that is easy to identify, for example, PrestaShop-Example.

    (Optional) Associated Services

    • Data disk: 10 GiB
    • Host security
    • Cloud backup vault: 70 GiB

    You can bundle any of the services to your FlexusL instances as needed: EVS, HSS (basic edition), and CBR and set specifications as needed.

    Required Duration

    1 month

    The minimum duration of a purchase is one month and the maximum duration is three years.

    Auto-renew is enabled by default, which means the purchased FlexusL instances will be automatically renewed before they expire. If you do not enable auto-renew during the purchase process, you can still enable it later after the instances are created. For more information about auto-renewal rules, see Auto-Renewal Rules.

    Quantity

    1

    Set the number of FlexusL instances to be purchased.

  3. Click Buy Now and complete the payment as prompted.
  4. Go back to the FlexusL console and view the purchased FlexusL instance.

    After a FlexusL instance is created using an application image, wait until the image with the pre-installed application is up and running. Then, you can perform operations such as restarting or stopping the instance, or resetting the password. Otherwise, the installation may fail and you cannot log in to the image application dashboard.

Step 2: Configure Security Groups

Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.

  1. Log in to the FlexusL console and click a resource card to go to the instance details page.
  2. In the navigation pane on the left, choose Cloud Servers. Locate the server and click its name.

  3. On the Security Groups tab, click Add Rule. In the displayed dialog box, add rules displayed in the following figure and click OK.

    The following figure only displays common rules. You can add more rules as needed.

    Table 1 Security group rules

    Priority

    Action

    Type

    Protocol & Port

    Source

    Description

    1

    Allow

    IPv4

    TCP: 80

    0.0.0.0/0

    Specifies the internal forwarding port of application images

    1

    Allow

    IPv4

    TCP: 3306

    0.0.0.0/0

    Allows access to MySQL databases.

    1

    Allow

    IPv4

    TCP: 9000

    0.0.0.0/0

    Allows external access to the application O&M dashboard.

    1

    Allow

    IPv4

    TCP: 9001

    0.0.0.0/0

    Allows external access to the application dashboard.

Step 3: Initialize Prestashop

The image application dashboard needs to be initialized only when you log in for the first time.

When you visit http://Public IP address:9001/admin to access the management console for the first time, PrestaShop generates a random character string following admin for encryption. Keep the encrypted address in mind because you can only use it to access the management console. For example, when you visit http://1.1.1.1:9001/admin to access the management console for the first time, the address automatically changes to http://1.1.1.1:9001/admin923reep1k.

You can also reset the address for accessing the management console, but this will lead to data loss. Please keep the encrypted address safe.

  1. Obtain the administrator username and password for logging in to GitLab.

    1. In the address bar of a local browser, enter http://EIP:9000 to log in to the application O&M dashboard.

      The username and password for logging in to the dashboard are the root user and password of the FlexusL instance. A FlexusL instance does not have an initial password. Reset the password and use it to log in to the dashboard.

    2. Choose My Apps and click the App icon.
    3. Choose Access and click Initial Account to view the username and password of the administrator.

  2. Visit http://Public IP address:9001/admin in the address bar of a local browser to access the management console.

    When you visit http://Public IP address:9001/admin to access the management console for the first time, PrestaShop generates a random character string following admin for encryption. Keep the encrypted address in mind because you can only use it to access the management console. For example, when you visit http://1.1.1.1:9001/admin to access the management console for the first time, the address automatically changes to http://1.1.1.1:9001/admin923reep1k.

    You can also reset the address for accessing the management console, but this will lead to data loss. Please keep the encrypted address safe.

  3. Enter the password obtained in step 1.

    If a message is displayed indicating that the username or password you entered is invalid when you attempt to log in to the application dashboard, refer to Why Can't I Access the Dashboard of the Application Pre-installed in the Application Image After Entering the Initial Username and Password?

  4. Click LOG IN to log in to PrestaShop.

Then, you have obtained a PrestaShop hosting server. You can start operating the website or follow the steps in Step 4: Deploy Prestashop to manage language packages and set languages, install modules, back up databases, and configure domain names.

Step 4: Deploy Prestashop

This section describes some basic operations of PrestaShop. For more information, see PrestaShop Documentation.

PrestaShop has a built-in multi-language system. You only need to select the corresponding language and import it to your PrestaShop system online.

  • Import a language package.
    1. Choose IMPROVE > International > Localization, select the language package you want to import, and click Import.

    2. Click the Languages tab to view the language packages that have been imported.
  • Set the language of the dashboard.

    Click the avatar on the right corner, select Your profile and set the language. Click Save.

  • Delete a language package.
    You can delete unnecessary language packages.
    1. Choose International > Localization > Languages and disable the language package you want to delete.

    2. In the Actions list, click Delete to delete the language that is disabled.

PrestaShop has a rich module library, which greatly expands the functions of PrestaShop.

  • Choose Modules > Marketplace, find the required plug-in, and click Buy Now or Install to purchase and install the module.

    You can also click Upload a module to install other modules.

  • Choose Modules > Module Manager.
    • On the Modules tab page, you can disable, configure, uninstall, and restore the modules.
    • On the Alerts tab page, you can view the notifications of modules.
    • On the Updates tab page, you can view modules that can be updated.

PrestaShop allows you to back up databases.

  1. In the navigation pane on the left, choose Advanced Parameters > Database > DB Backup, read the disclaimer, and click I have read the disclaimer. Please create a new backup.

    You can follow the instructions on the following page to restore a database.

  2. Click Download the backup file to download the backup file to your local PC.

Add and resolve a domain name for the website so that users can use the domain name to access the website. If the website is only used for personal development or testing, there is no need to add a domain name.

  1. If the domain name is not registered with Huawei Cloud or not hosted on Huawei Cloud DNS, the domain name cannot be resolved. Use either of the following methods to resolve the issue:
  2. Add the domain name on the application O&M dashboard.
    1. In the address bar of a local browser, enter http://EIP:9000 to log in to the application O&M dashboard.

      The username and password for logging in to the dashboard are the root user and password of the FlexusL instance. A FlexusL instance does not have an initial password. Reset the password and use it to log in to the dashboard.

    2. Choose My Apps and click the App icon.
    3. Choose Access and click Add Domain.

  3. Apply for ICP licensing for the domain name.

    To successfully access the server using a domain name, you must license the domain name. Domain name licensing provided by the ICP License Service is free of charge. For details, see ICP Filing Process.

    After the domain name is licensed, you can use it to visit the website.