OpenCart 2.x/3.x. How to add custom font

You can present and sell your products using OpenCart. What can be important while viewing the site is the way it looks, especially the fonts used on it, that is why you may need to change them. We will show how to change and add fonts to your store.
  1. Let’s change the font for menu items. Find a font that is used for particular text on your template using developers tools. In this example, we will use Firebug – Mozilla Firefox plugin
  2. In  catalog\view\theme\themeXXX\template\common\header.tpl file we can see all  the fonts location, the link of which can be easily found by rel=”stylesheet”
  3. In this case, we can see that the font for the menu it is set in  catalog\view\theme\themeXXX\stylesheet\stylesheet.css, that is why we need to reach this file via FTP or cPanel and open it with a code editor (hosting code editor, NotePad++, Sublime, etc.) where we can see the font reference via the @import method:

  4. In order to add another font and change it for the menu, we need to install it.

  5. Open http://www.google.com/webfonts  and select appropriate font using filters.
    [notice type=”warning”]Pay attention to character set. Select a font that supports your character set. We have selected Cyrillic Extended in order to be able to use Cyrillic symbols.
  6. Press + to select this font.

  7. Click on the Family Selected tab that will appear in the bottom.

  8. You will see two methods of adding the font in the Embed tab:
    • Standard – should be used to insert the font to catalog\view\theme\themeXXX\template\common\header.tpl or header.twig in the <head> section alongside with other fonts:
    • @import– should be used to insert the font to the needed CSS file, usually to catalog\view\theme\themeXXX\stylesheet\stylesheet.css

    You can use any method. The main difference is that if you add the font to header.tpl it will be used all over the site, in case of adding it to a .css file –  it will be used only on pages using this file. Since stylesheet.css is used for all the pages, it makes no difference which method you use to add the font.

    So you need to copy the code to catalog\view\theme\themeXXX\template\common\header.tpl or catalog\view\theme\themeXXX\stylesheet\stylesheet.css depending on the method you selected.

  9. In both methods you will see the Specify in CSS section, e.g: 

    This section defines the CSS rule to use for setting this font family for the needed element.

  10. That is why in order to set the new font for the menu, we should add this code to the catalog\view\theme\themeXXX\stylesheet\stylesheet.css file:
  11. Your CSS rule will be different depending on the inspected element. If the font is already set for the element, you can simply change its name in the rule itself. For example, 

    from

    to

  12. Save the made changes.
In order to install other fonts instead of Google web fonts perform the following steps:
  1. Look for a free web font using any search engine you prefer (Google, Yahoo, etc.). There are the websites with the great number of fonts in their collections, for example, http://www.fontsquirrel.com.
  2. Select the web font you like and save it to your computer by clicking on the download button. [notice type=”warning”]Make sure the font type is either TTF (True Type Font) or OTF (Open Type Font).

  3. Navigate to http://www.font2web.com  and click on the “Browse…” button to choose the downloaded .ttf/.otf font file.

  4. Once the font file is uploaded, click on the “Convert and Download” button to download the converted font to your computer.

  5. Upload the converted font package to the catalog\view\theme\themeXXX\fonts folder of the site directory via FTP or hosting cPanel and make sure to unzip the font files to the fonts folder itself.
  6. Copy the code from fonts.css from the font package and paste to catalog\view\theme\themeXXX\stylesheet\stylesheet.css adding the direct link to the font in the following format:  http://your_site_url.com/themes/themeXXX/fonts/font_file
  7. Add the font-family CSS code from fonts.css to the needed element, for example, we will add this code to catalog\view\theme\themeXXX\stylesheet\stylesheet.css to change the menu items font:

  8. Save the made changes.

 

zemez wordpress themes
monster one