[Skip to main content](#vessel-content)

#   Force registration for free products

##

- **[icronje](/forum/user/1483-icronje "View icronje's Profile")**
- [![icronje's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1483-icronje "View icronje's Profile") Topic Author
- [ Offline](/forum/user/1483-icronje)

Less More

- Posts: 52
- Thank you received: 0
-
-

14 years 2 months ago [\#60723](#60723) by [icronje](/forum/user/1483-icronje "View icronje's Profile")  *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#60723 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")* was created by *[icronje](/forum/user/1483-icronje "View icronje's Profile")*

Hi,

I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?

Regards

Ic

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

14 years 2 months ago [\#60756](#60756) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Re: Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#60756 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Hi,

In the HikaShop configuration, you can set the registration method.
System =&gt; configuration =&gt; checkout (tab) =&gt; Registration.
[ www.hikashop.com/en/support/documentatio...config.html#checkout](http://www.hikashop.com/en/support/documentation/integrated-documentation/54-hikashop-config.html#checkout)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[icronje](/forum/user/1483-icronje "View icronje's Profile")**
- [![icronje's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1483-icronje "View icronje's Profile") Topic Author
- [ Offline](/forum/user/1483-icronje)

Less More

- Posts: 52
- Thank you received: 0
-
-

14 years 2 months ago [\#60818](#60818) by [icronje](/forum/user/1483-icronje "View icronje's Profile")  Replied by *[icronje](/forum/user/1483-icronje "View icronje's Profile")* on topic *[Re: Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#60818 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Jerome,

Thanks for the reply.

I have this setting set to "Registration".

Maybe I wast not so clear about my problem initially. I have an online store with products that I want to sell on the internet. I would also like to offer free products (programs) for download and would like the user to download it without going throught the entire checkout process, but before they download it they will need to register on Hikashop.

Is this possible to do?

Regards

IC

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4077
-
- [](http://obsi.dev)
-

14 years 2 months ago [\#60869](#60869) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Re: Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#60869 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Hi,

You can attach files to HikaShop product.
A file could be a "free download" or not.
A "free download" does not require to make an order, the link is displayed in the product page.
Otherwise, the customer has to make an order to have a secured download link.

You can use "free download" files but modify the product page (thanks to view editing) in order to require authentication.
If the user is authenticated, the download link would be displayed.
I think it could be a good mix.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[icronje](/forum/user/1483-icronje "View icronje's Profile")**
- [![icronje's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1483-icronje "View icronje's Profile") Topic Author
- [ Offline](/forum/user/1483-icronje)

Less More

- Posts: 52
- Thank you received: 0
-
-

14 years 2 months ago [\#61094](#61094) by [icronje](/forum/user/1483-icronje "View icronje's Profile")  Replied by *[icronje](/forum/user/1483-icronje "View icronje's Profile")* on topic *[Re: Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#61094 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Jerome,

Thanks for the answer.

I do not have PHP skill though and also do not know the hikashop architecture. Can you give a few pointers, please.

Regards

IC

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14290
-
-

14 years 2 months ago [\#61149](#61149) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#61149 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

You would have to edit the file show_block_product_files via the menu Display-&gt;Views and add such code at the beginning:
&lt;?php $user =&amp; JFactory::getDBO();
if(user-&gt;guest) return; ?&gt;

The following user(s) said Thank You: [watashi](/forum/user/8585-watashi "View watashi's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")**
- [![ScienceDyn's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")
- [ Offline](/forum/user/23338-sciencedyn)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 3 months ago -  13 years 3 months ago [\#114872](#114872) by [ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")  Replied by *[ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")* on topic *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#114872 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Dear Nicolas,

we tried to do what you describe above but unfortunatelly we are still getting pars error. Could you be a little more specific on where and how to add this code: Code:

&lt;?php $user =&amp; JFactory::getDBO(); if(user-&gt;guest) return; ?&gt;

We have the last version of Hikashop and Hikamarket business.

This is the beginning of the file we need to edit: Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 2.2.0 * @author hikashop.com * @copyright (C) 2010-2013 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;div id="hikashop_product_files_main" class="hikashop_product_files_main"&gt; &lt;?php if (!empty ($this-&gt;element-&gt;files)) { $skip = true; foreach ($this-&gt;element-&gt;files as $file) { if ($file-&gt;file_free_download) $skip = false; } if (!$skip) { global $Itemid; $url_itemid=''; if(!empty($Itemid)){ $url_itemid='&amp;Itemid='.$Itemid; }

Thanks for fast answer.

Last edit: 13 years 3 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 3 months ago [\#115016](#115016) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#115016 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Hi,

First of all, you have to use the php tags only if you are not in a php area in your file.
And Nicolas just forgot a "$", the code to use is: Code:

$user = JFactory::getDBO(); if($user-&gt;guest) return;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")**
- [![ScienceDyn's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")
- [ Offline](/forum/user/23338-sciencedyn)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 3 months ago [\#115128](#115128) by [ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")  Replied by *[ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")* on topic *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#115128 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Dear Xavier,

we have implemented the code in following way:

&lt;?php

/**
* @package HikaShop for Joomla!
* @version 2.2.0
* @author hikashop.com
* @copyright (C) 2010-2013 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 [ www.gnu.org/licenses/gpl-3.0.html](http://www.gnu.org/licenses/gpl-3.0.html)
*/

$user = JFactory::getDBO();
if($user-&gt;guest) return;

defined('_JEXEC') or die('Restricted access');
?&gt;&lt;div id="hikashop_product_files_main" class="hikashop_product_files_main"&gt;
&lt;?php
if (!empty ($this-&gt;element-&gt;files)) {
$skip = true;
foreach ($this-&gt;element-&gt;files as $file) {
if ($file-&gt;file_free_download)
$skip = false;
}
if (!$skip) {
global $Itemid;
$url_itemid='';
if(!empty($Itemid)){
$url_itemid='&amp;Itemid='.$Itemid;
}
?&gt;

But still if I try to download a "free" product as unregistered user it lets me download it without registration.

Try it yourself: [ www.sciencedynamics.net/index.php/en/sho...oduct/15-test-zdarma](http://www.sciencedynamics.net/index.php/en/shop/product/15-test-zdarma)

Any suggestions?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

13 years 3 months ago [\#115259](#115259) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#115259 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Hi,

Are you sure that you edited the good **show\_block\_product\_files** file of the product view of your front-end template that you are **currently using** ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")**
- [![ScienceDyn's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")
- [ Offline](/forum/user/23338-sciencedyn)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 3 months ago [\#116437](#116437) by [ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")  Replied by *[ScienceDyn](/forum/user/23338-sciencedyn "View ScienceDyn's Profile")* on topic *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#116437 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Well, there's only one file of that name on our server located in /home/.../public_html/components/com_hikashop/views/product/tmpl/show_block_product_files.php

after adding the code you have created at the beginning of the file, nothing happens - unregistered user still can access the file.

The code is here:
&lt;?php
$user = JFactory::getDBO();
if($user-&gt;guest) return;
/**
* @package HikaShop for Joomla!
* @version 2.2.0
* @author hikashop.com
* @copyright (C) 2010-2013 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 [ www.gnu.org/licenses/gpl-3.0.html](http://www.gnu.org/licenses/gpl-3.0.html)
*/
defined('_JEXEC') or die('Restricted access');
?&gt;&lt;div id="hikashop_product_files_main" class="hikashop_product_files_main"&gt;
&lt;?php
if (!empty ($this-&gt;element-&gt;files)) {
$skip = true;

Let us know what to do, pls.
Best,
Mark

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 3 months ago [\#116548](#116548) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Force registration for free products](/forum/4-how-to/60723-force-registration-for-free-products#116548 "Hi,  I would like to offer free enticers, but would like people to register before getting the product. Is this possible with Hikashop?  Regards  Ic")*

Hi,

The code to use is: Code:

$user = hikashop_loadUser(); if($user == null) return;

sorry for the previous mistake.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzYwNzIzLWZvcmNlLXJlZ2lzdHJhdGlvbi1mb3ItZnJlZS1wcm9kdWN0cz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.078 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
