Jump to content
NemoPS

Creating free virtual products with direct download

Recommended Posts

Hey there,

i'm assuming the prestashop addons store is using prestashop itselft (why not to believe in their own software?) and for that reason my question is this:

- you can download free products directly from the addons store. No registration, no checkout process. Just direct dowload. It is possible in prestashop? I tried adding free digital products (setting price to 0), but i still have to go through the checkout process.

 

I just want to substitute the "add to cart" with "download for free" in product page, and allow customers to directly download from there.

 

So, again, is this possible?

 

Fabio

Share this post


Link to post
Share on other sites

Hi Nemo1,

 

Yes it is technically possible.

 

As you say we are using PrestaShop to do it, even if it is quite heavily modified, it is still PrestaShop. So with some work you should be able to do the same :).

  • Like 1

Share this post


Link to post
Share on other sites

Hi

 

One of workarounds is to use attachment feature like rocky used on his website

http://www.nethercottconstructions.com/en/prestashop-modules/4-product-links.html

 

Code is already in product.tpl (section with tabs) it only need some styling.

Something like this :

  {if $attachments}
  {foreach from=$attachments item=attachment}
   <p><a href="{$link->getPageLink('attachment.php', true)}?id_attachment={$attachment.id_attachment}"><img src="{$img_dir}download.png" alt="{$attachment.name|escape:'htmlall':'UTF-8'}" title="{$attachment.description|escape:'htmlall':'UTF-8'}"></img></a></p>
  {/foreach}
  {else}
	 <form id="buy_block" ...
.... {/if}

And you can use some additional if/else conditions like if $virtual depending how you set product.

  • Like 1

Share this post


Link to post
Share on other sites

Razaro-

your link is for next and previous links module FREE however how would you change those links so that they are linked to "download product" each specific product that is downloadable????

Thanks

Share this post


Link to post
Share on other sites

Here is maybe better solution, that works for downloadable products.

 

In attachment there are files download-file.php and ProductController.php.

 

File download-file.php should be copied in root directory of prestashop installation.

ProductController.php goes to override/controllers/ folder. If there is already one there

code should be megred.

 

Finialy product.tpl in theme folder should be edited. I choose to hide whole buy_block.

Changed

{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->

to

 

{if $virtual AND $product->getPrice(true, $smarty.const.NULL) == 0}
<a href="{$link->getPageLink('download-file.php', true)}?file={$product_filename|escape:'htmlall':'UTF-8'}" title="{l s='download this product'}" class="button">{l s='Free Download!'}</a>
{elseif ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->

 

Note only that this doesn't take in consideration downloadable product options like number of downloads, expiration date and number of days.

 

@girlsgirl12 I didn't quite understand your question, but did you mean something like this ?

directdownload.zip

Edited by razaro (see edit history)
  • Like 3

Share this post


Link to post
Share on other sites

Hi DGV,

 

I edited post, not sure what happened before.

Maybe I forgot to attach file or some forum glitch.

  • Like 1

Share this post


Link to post
Share on other sites

Here is maybe better solution, that works for downloadable products.

 

In attachment there are files download-file.php and ProductController.php.

 

File download-file.php should be copied in root directory of prestashop installation.

ProductController.php goes to override/controllers/ folder. If there is already one there

code should be megred.

 

Finialy product.tpl in theme folder should be edited. I choose to hide whole buy_block.

Changed

{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->

to

 

{if $virtual AND $product->getPrice(true, $smarty.const.NULL) == 0}
<a href="{$link->getPageLink('download-file.php', true)}?file={$product_filename|escape:'htmlall':'UTF-8'}" title="{l s='download this product'}" class="button">{l s='Free Download!'}</a>
{elseif ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->

 

Note only that this doesn't take in consideration downloadable product options like number of downloads, expiration date and number of days.

 

@girlsgirl12 I didn't quite understand your question, but did you mean something like this ?

 

Hi,

 

I did this as you explain, and I get a "Download this product!" button in my free downloads, but when I click this button it gets me to an error page.

 

What is wrong? Do I have to change anything else?

I'm using PS v. 1.5.2

You can see it in http://www.partty.es/es/48-lista-de-invitados-gratis.html

 

Thanks!!

Share this post


Link to post
Share on other sites

This was working in 1.4 version but in 1.5 there were some changes, so my previous solution is not working.

When I find solution for 1.5 will post here.

  • Like 1

Share this post


Link to post
Share on other sites

This was working in 1.4 version but in 1.5 there were some changes, so my previous solution is not working.

When I find solution for 1.5 will post here.

 

Thanks for your reply.

 

This is a very useful module, I hope you can make it work, I can't find any other way to make free downloads easy to my shop customers.

 

Anyway, thanks for the good job made with the module.

Share this post


Link to post
Share on other sites

Here is modification for Prestashop version 1.5.

 

Files should be copied with same file structure like in zip file.

So download-file.php should go to root of websites where are rest of main php files.

DownloadFileController.php should be copied to controllers/front folder and

file ProductController.php to override/controllers/front if it not exists there.

If file exists code should be compared and copied apropriate lines.

 

Last step is to change code in product.tpl in current theme folder.

This could be done in different way but here is one. In default theme,

for example, find code arround line 259

 

{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}

<!-- add to cart form-->

and replace it with

 

{assign var='virtualproductPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
{if $product->is_virtual AND $virtualproductPrice == 0 }
<a href="{$link->getPageLink('download-file', true,NULL,"file={$product_download->filename}")}" title="{l s='download this product'}" class="button">{l s='Free Download!'}</a>
{elseif ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->

 

And now you have direct download of free virtual products.

free download.zip

Edited by razaro (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

Hi Razaro,

 

thank you very much for your help. It works great.

I have been searching for this function for a long time...and finally you got it!!

 

The only thing I miss is that this don't changes the 'Add to cart' buttons in products categories page, and it will be a little confusing for the users...but I'm not a programmer so I don't know if this is difficult or easy to do (or maybe not possible)

You can see it here http://www.partty.es...escargas-gratis

 

Anyway, thanks again for your great and fast job!!

 

If you don't mind I will share it in the spanish forum, I know that some people where searching for this function too.

Edited by parttyshop (see edit history)

Share this post


Link to post
Share on other sites

razaro

 

Nice!! Congratulations!

 

But if I show my product category (ie. 'Free products') where I have all my free products, then every product still show "add cart" button.

 

Only when you enter the specific product the button is "Free Download!".

 

Is possible to put "Free Download!" button in every free product when are showed in the category level ?

I guess I have to go to category.tpl (or similar) and find the code referenced and changed...but how I do this?

 

Thanks!

Share this post


Link to post
Share on other sites

Here is maybe better solution, that works for downloadable products.

 

In attachment there are files download-file.php and ProductController.php.

 

File download-file.php should be copied in root directory of prestashop installation.

ProductController.php goes to override/controllers/ folder. If there is already one there

code should be megred.

 

Finialy product.tpl in theme folder should be edited. I choose to hide whole buy_block.

Changed

{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->
to

 

{if $virtual AND $product->getPrice(true, $smarty.const.NULL) == 0}
<a href="{$link->getPageLink('download-file.php', true)}?file={$product_filename|escape:'htmlall':'UTF-8'}" title="{l s='download this product'}" class="button">{l s='Free Download!'}</a>
{elseif ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->
Note only that this doesn't take in consideration downloadable product options like number of downloads, expiration date and number of days.

 

@girlsgirl12 I didn't quite understand your question, but did you mean something like this ?

 

 

how to edit product-list.tpl. so it looks like product.tpl

i using presta 1.4

 

help me please

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks so much for the code. But I have some problem, when you press the button "download" you go to other link and don't download anything.

You can see it: at this link.

Share this post


Link to post
Share on other sites

Like @iltecnobadante, I'm also looking for a way to track free downloads via the back-office. Anyone have ideas?

Share this post


Link to post
Share on other sites

Unless i miss the gist of the thread, there seems to be a logic path missing here: say i offer one free ebook. Store the big file up on AWS for example, create a thank you file with details of the download link. Price it at 0$ as a virtual product. Run through the check out to increase your customer base. They should not receive 3 emails for the cart process (payment accepted) and i would argue, as well, the Order Confirmation. It seems heavy.

 

Thoughts?

Share this post


Link to post
Share on other sites
On 1/28/2013 at 9:08 PM, razaro said:

Here is modification for Prestashop version 1.5.

 

Files should be copied with same file structure like in zip file.

So download-file.php should go to root of websites where are rest of main php files.

DownloadFileController.php should be copied to controllers/front folder and

file ProductController.php to override/controllers/front if it not exists there.

If file exists code should be compared and copied apropriate lines.

 

Last step is to change code in product.tpl in current theme folder.

This could be done in different way but here is one. In default theme,

for example, find code arround line 259

 

 


{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}

<!-- add to cart form-->
 

 

and replace it with

 

 


{assign var='virtualproductPrice' value=$product->getPrice(true, $smarty.const.NULL, $priceDisplayPrecision)}
{if $product->is_virtual AND $virtualproductPrice == 0 }
<a href="{$link->getPageLink('download-file', true,NULL,"file={$product_download->filename}")}" title="{l s='download this product'}" class="button">{l s='Free Download!'}</a>
{elseif ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
<!-- add to cart form-->
 

hi . can u please help me?

my store is on PS 1.6.1.24

i did all these things. but i faced with fatal error 

:

in address bar :

http://newspower.ir/index.php?controller=download-file&file=

in white page with these words : FATAL ERROR

 

And now you have direct download of free virtual products.

free download.zip 5.49 kB · 248 downloads

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More