Module URL in Prestashop

If you are working on a Prestashop module, and want to get the module URL inside a PHP file in your module, you just need this snippet (found in the “blocklayered” module):

$module_url = Tools::getProtocol(Tools::usingSecureMode()).$_SERVER['HTTP_HOST'].$this->getPathUri();

This returns the URL of the base directory of your module, so you can reference images or other files within your module. This is quite useful in backend forms of modules.


05:05 PMPosted by in Uncategorized | 0 comments

Add Your Comment

Your email address will not be published.