To get the logo image of your PrestaShop store using code, you can use the following steps:
- Use the
Configuration::get()method to retrieve the value of the
PS_LOGOconfiguration key. This will return the relative path to the logo image file.
$logo_path = Configuration::get('PS_LOGO');
- 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;
- Use the
$logo_filevariable 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/config.inc.php file to access the
Configuration class and other PrestaShop functions. For example:
require_once('/path/to/config/config.inc.php'); $logo_path = Configuration::get('PS_LOGO'); $logo_file = _PS_IMG_DIR_ . $logo_path; echo '<img src="' . $logo_file . '" alt="Logo">';