PrestaShop Forums: Free download function help... - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


Free download function help...


Free download function help...

#1 jonah

    PrestaShop Newbie

  • 17 May 2009
  • Members
  • Pip
  • 2 posts

Posted 19 March 2010 - 05:56 PM

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

#2

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 19 March 2010 - 07:31 PM

I don't know if this is right way or if it has some security flows,
but here is code you can put in your theme folder , file product.tpl

http://paste2.org/p/725004

It checks if there is zip file, with same name as product, in your download folder.
You can change type and folder

#3

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 19 March 2010 - 10:45 PM

When I look in my download folder I see a file that has a long file name like: 6959bbae9c89914e59fec6039a522fa7bd65b1c7 . no file extension. How do i decrypt this for that code?

#4

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 19 March 2010 - 10:48 PM

I tried the code but I am not sure where download files go on the server. When I left the code by itself nothing showed up on my store. Can I get more help.

#5

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 19 March 2010 - 11:39 PM

Sorry i totally misunderstood your question, my bad :red:

Will let you know if i think of something.

#6

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 20 March 2010 - 10:16 AM

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

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
 


I will try to test with validation options, but anyone who knows better solution, please let us know.
Edit: it is better to rename attach to getfreefile.php and also in added code in product.tpl.

Attached File(s)







1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users