Time for action—editing the text in a language file

In this section, we will learn how to change the Manufacturer keyword into Brand on the product details page in the relevant English language file. The following screenshot shows the keyword which we will rename:

Time for action—editing the text in a language file
  1. OpenCart has a very well designed MVC-L (Model-View-Controller-Language) based structure which helps us to easily change any files, including language files.

    Note

    For coders who want to understand MVC-L software development principles more, try:

    http://en.wikipedia.org/wiki/Model view controller

    Other readers can continue reading the following section.

    Every OpenCart URL shows the directory where related PHP files are located on web server. In our example, the product details URL is:

    http://www.yourstore.com/store/index.php?route=product/product&product_id=49

    What we need to do is look at the route parameter carefully. We see that it is product/product. This tells us that the language file which we will edit is located under the catalog/language/english/product directory on the web server and the file we should edit is product.php. The following screenshot shows this directory when opened by cPanel File manager. We will Edit this file.

    Time for action—editing the text in a language file
  2. The system will show us a dialog box to choose the correct encoding type to edit the file. For English and most European languages, it is not very important except special characters. In any case, we select utf-8 to not lose any characters:
    Time for action—editing the text in a language file
  3. We find the line with Manufacturer text which we should replace:
    Time for action—editing the text in a language file
  4. We change it to Brand and click on Save Changes button on the top of the screen:
    Time for action—editing the text in a language file
  5. When we again browse into a product detail page on the storefront, we now see our new Brand keyword is there:
    Time for action—editing the text in a language file

What just happened?

We have seen how to locate and edit OpenCart language files which we need to change according to the route parameter of the URL.

Tip

English storefront language files are located under catalog/language/english. In another language example, the path would be catalog/language/italian for the Italian language.

Tip

As another hint, the administration panel language files also follow the a similar pattern except that we need to browse into the admin/language folder instead of catalog/language.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.253.198