Jump to content

Adding Google Fonts API code to Prestashop


Recommended Posts

I'm hoping someone can tell me how I can insert the google font api code into the header file of my site. It seems that whatever changes I make in header.tpl do not take effect. Just trying to insert a simple snippet of code so that I can change the font in my nav bar.

Link to comment
Share on other sites

No need to mess with the template files. If your installation is compatible, download this module. Disclosure: module is built by me. Install. Visit Back Office > Modules > Front Office Features > Multi Block ... > Configuration. Select Header of Pages in drop down and paste your snippet in the Block Body field. Save. You are ready to go. Read module's help section for more information and examples.

  • Like 1
Link to comment
Share on other sites

No need to mess with the template files. If your installation is compatible, download this module. Disclosure: module is built by me. Install. Visit Back Office > Modules > Front Office Features > Multi Block ... > Configuration. Select Header of Pages in drop down and paste your snippet in the Block Body field. Save. You are ready to go. Read module's help section for more information and examples.

 

I have no idea how to install it

Link to comment
Share on other sites

Download the module's zip file from the link I gave to your computer.

Login to back office, click on Modules tab, then Add a module from my computer.

Click Browse... button next to Module file field, navigate to folder where you downloaded the zip file, select it, then click Upload this module. Here is a summary screen capture.

 

It should take few seconds and the module will be added to the list of the modules. Look under Front Office Features on the same page to find the module (you might need to reset the module filter to show all modules). Then follow the instructions from my previous post. Post here if you have any problems.

 

What berka.pavel said may work as well if that is the problem and if you don't want to use the module.

Link to comment
Share on other sites

You delete the hook used, (each position is actually a hook provided by Prestashop).

 

Go to Back Office > Modules > Positions, select Show Multi Block ... and check Display non-positionable hooks as module can hook non-positionable hooks. Then either check the relevant hook and select Unhook the selection or click on the bin icon to delete it (summary screen capture).

 

Post if you have any problems.

Link to comment
Share on other sites

There is not a single file that holds all CSS declarations. Depending on what modules are loading, what page you are seeing etc eventual CSS files loaded will differ. It is also dependent on whether it is a module related CSS file, theme related CSS file or Prestashop's core CSS file. The default installation of Prestashop has 120+ CSS files loaded from 40+ locations, and loading of these are scattered throughout the codebase.

 

It is however possible to manually modify one or more core files to load an additional CSS if you want to do it manually. Though I am not sure why would you do it that way as it becomes a maintenance headache. If you explain what you are trying to do I may be help.

Link to comment
Share on other sites

Well i'm having font problems as OP mentioned. The design for the shop was created separately and was already confirmed by the customer. So this design contains custom font wich means i either have to somehow integrate the font, or generate different images for each block header (this font is used for block headers) wich then becomes pain in the ass for maintenance. So going from this, i wanted to integrate google's font API's link rel somewhere.

 

Any other ideas on the matter or suggestions would be highly appreciated.

Link to comment
Share on other sites

  • 1 year later...

Disclosure: module is built by me. Install. Visit Back Office > Modules > Front Office Features > Multi Block ... > Configuration. Select Header of Pages in drop down and paste your snippet in the Block Body field. Save. You are ready to go. Read module's help section for more information and examples.

Where is the link to this Module??

Link to comment
Share on other sites

  • 8 months later...

this module isn't free anymore.

you can do it with free html block module of with free content block module

tutorial here: google fonts and prestashop

 

I am trying to develop my own design for prestashop and minimized it.

There are a few questions - regarding google font api too.

By default there is a google font loaded directly from google server.

This is bad as it allows google to track users and could be avoided by copying fonts to local server.

 

So I found this in "header.tpl".

First I copied the initial theme provided by installation to my own theme and make changes here.

Is it safe to edit files like header.tpl for example to delete this google style as link rel ?

Does it correspond with eventually new versions of prestashop ?

 

Second - I found that in the default theme a lot of modules are activated and about a dozen or

more css files are loaded. This is not very fast to do it this way. Is there a chance to add all

css files automatically to a one and only file or at least two, a core css and a css for all modules.

This could be done by software.

The default behaviour increases load for first time visitors significantly which results in bad speed

(even when running on a fast server).

Edited by karlspezial2 (see edit history)
Link to comment
Share on other sites

 

 

Is it safe to edit files like header.tpl for example to delete this google style as link rel ?

you can remove these lines, you don't have to worry about potential problems, because these lines arent important.

 

 

Does it correspond with eventually new versions of prestashop ?

if you changing default theme - it will be overwrited after update, so it's worth to move default theme from default-bootstrap to other directory (then you will not lose changes)

 

Second - I found that in the default theme a lot of modules are activated and about a dozen or

more css files are loaded. This is not very fast to do it this way. Is there a chance to add all

css files automatically to a one and only file or at least two, a core css and a css for all modules.

This could be done by software.

The default behaviour increases load for first time visitors significantly which results in bad speed

(even when running on a fast server).

yes, under adv. parameters > performance tab you can run CCC for css files

this feature will minify all css files, and then - combine them into one file

  • Like 1
Link to comment
Share on other sites

yes, under adv. parameters > performance tab you can run CCC for css files

this feature will minify all css files, and then - combine them into one file

 

Hey - that's great news. Tried it and worked.

Thanks, I didn't expect it to work that easy. :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...