Jump to content

Free download function help...


Recommended Posts

I know that topic title isn't clear but I didn't know how to word it... really.

What I need is a way to allow free products that are downloaded without a checkout.

If I need to make a module some pointers would be great.
Also I would like it if it didn't reduce stock levels as the free downloads are unlimited.

Thanks.

Jonah

Link to comment
Share on other sites

It can be done but with a changes of core files and that is not recommended.

Problem is in getfile.php and format of key.
/* Key format: - */
http://***/get-file.php?key=ef0e829558bb8cc7ac20f4e1d6451c91396be3c8-3e4e91a849b2305a878d18c0cafaf59f32b438d6

And hashOrder is generated after checkout.

Following code is for test purpose only, it skips all validation, so use it on localhost/test server.
In getfile.php (see atachment) i commented out most of code and added

    $file = _PS_DOWNLOAD_DIR_.$key;
   $filename = ProductDownload::getFilenameFromFilename($key);


Then in product.php after line 116

        $smarty->assign('virtual', ProductDownload::getIdFromIdProduct(intval($product->id)));


add

        $smarty->assign('dp', ProductDownload::getFilenameFromIdProduct(intval($product->id)));



Then in product.tpl in your theme folder add following code where you want

http://paste2.org/p/726236
ex. after

 
Link to comment
Share on other sites

×
×
  • Create New...