PrestaShop Documentation, PrestaShop Tutorials

PrestaShop how to get logo image by code

To get the logo image of your PrestaShop store using code, you can use the following steps:

  1. Use the Configuration::get() method to retrieve the value of the PS_LOGO configuration key. This will return the relative path to the logo image file.
$logo_path = Configuration::get('PS_LOGO');
  1. Get the absolute path to the logo image file by appending the logo path to the _PS_IMG_DIR_ constant, which represents the absolute path to the /img/ directory in your PrestaShop installation.
$logo_file = _PS_IMG_DIR_ . $logo_path;
  1. Use the $logo_file variable to display the logo image on your web page or in your application.
<img src="<?php echo $logo_file; ?>" alt="Logo">

Note that if you want to use the logo image in a custom PHP script outside of the PrestaShop framework, you may need to include the config/ file to access the Configuration class and other PrestaShop functions. For example:

$logo_path = Configuration::get('PS_LOGO');
$logo_file = _PS_IMG_DIR_ . $logo_path;
echo '<img src="' . $logo_file . '" alt="Logo">';

About zohaibk

We develop useful addons for #E-Commerce and #CRM software to provide extra features.#PrestaShop,#Magento,#SugarCRM,#Vtiger & #Android #apps
View all posts by zohaibk →