Jump to content

[SOLVED] How to get virtual product contents?


Recommended Posts

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 by Artem91 (see edit history)
Link to comment
Share on other sites

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

  • Artem91 changed the title to [SOLVED] How to get virtual product contents?

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...