Artem91 Posted February 8 Share Posted February 8 (edited) Hello, dear developers! I create module for ps v8.2.0. It will show some info about virtual product file. I need to read file contents for this task in "displayProductAdditionalInfo" hook. I know that all files located in "download" directory with hashed filenames. How to find which file related to specified product? Is it possible to get original filename and extension? Thanks a lot for your replies. Edited February 12 by Artem91 (see edit history) Link to comment Share on other sites More sharing options...
Prestashop Addict Posted February 10 Share Posted February 10 Hi, you need it in FO template or FO code or BO template or BO code? Link to comment Share on other sites More sharing options...
Artem91 Posted February 11 Author Share Posted February 11 In FO code. Already found solution with directly query to database: $sql = new DbQuery(); $sql->select('*'); $sql->from('product_download'); $sql->where('id_product = ' . $params['product']['id_product']); $results = Db::getInstance()->executeS($sql); if ($results) { $url = 'download/' . $results[0]['filename']; $original_filename = $results[0]['display_filename']; } Link to comment Share on other sites More sharing options...
Prestashop Addict Posted February 12 Share Posted February 12 Don't forget to change your title post by adding [SOLVED] and add a Thanks or Like to the good answer, this will help community. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now