Downloadable Files: troubleshooting

Downloadable Files: troubleshooting

Some customers have some problems with OpenCart 2.0 extension "Downloadable Files". Since problems are similar, it was decided to collect solving them in one place.

Problem: Blank page, error 500 or message Fatal error: Class 'finfo' not found in ...
Reason: The PHP module Fileinfo is disabled or not installed. It returns mime type of file.
Solution 1: Enable or install Fileinfo.
Solution 2: Use Downloadable Files version 1.2.1.
Solution 3: Open install.xml and find:

        $finfo = new finfo(FILEINFO_MIME);
        $mime_type = $finfo->file($file);

replace to: 

        $mime_type = 'application/octet-stream';


Problem: Instead of a tab, it shows up as a text link, files shows up in the wrong place etc.
Reason: Template is not default.
Solution: Open install.xml and find 

       <file path="catalog/view/theme/*/template/product/product.tpl">

increase up index value: instead index="0" write index="1" etc.


Problem: After install I see no changes.
Reason: Files are not attached to product.
Solution: Attach some downloads to product :)  The tab shows up if the product has one or more attached downloads.