Jump to content

Recover the virtual product filename from product.tpl


Recommended Posts

Hi All,

from the product page I need a download link to the virtual product.

Looking at the admin theme, inside the virtualproduct.tpl, I saw that the virtual product link is generated using the code below

 

{$product->productDownload->getHtmlLink(false, true)}

 

Now I'd like to use a similar code inside the product.tpl. Any suggestions?

 

Thank you very much,

 

Giacomo

Link to comment
Share on other sites

Hi

 

I did modification that enables direct download of free virtual products, check out files here .

 

But thing you maybe only need is overriding class Product

<?php
class Product extends ProductCore
{
public function getFreeDownload($product_id)
{
 $id_product_download = (int)ProductDownload::getIdFromIdProduct((int)$product_id);
 if ($id_product_download){
  $download = new ProductDownload((int)$id_product_download);
  self::$smarty->assign('product_download', $download);
 }
}
}

And then in product.tpl use

{$product_download->filename}

Link to comment
Share on other sites

×
×
  • Create New...