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

#   Restriction of purchase if already in download area.

##

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

Less More

- Posts: 38
- Thank you received: 0
-
-

7 years 3 months ago [\#309444](#309444) by [lesk](/forum/user/58400-lesk "View lesk's Profile")  *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309444 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")* was created by *[lesk](/forum/user/58400-lesk "View lesk's Profile")*

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.10
-- PHP version -- : 7.2.20
-- Browser(s) name and version -- : Chrome

I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.

Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5ODAyMy1yZXN0cmljdGlvbi1vZi1wdXJjaGFzZS1pZi1hbHJlYWR5LWluLWRvd25sb2FkLWFyZWE/dG1wbD1tYXJrZG93bg==) 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
-
-
-

7 years 3 months ago [\#309468](#309468) 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 *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309468 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")*

Hello,

There's actually no option to do that, so the best solution will either be to :
- Develop a plugin or edit the code of your payment plugins, to prevent the order creation if he is not supposed to make any purchase.

OR

- Set the "User group after purchase" option of your product configuration page to a custom user group
- Go to your payment configuration pages and restrict your payment method to every groups but that new one.

Kind regards,
Mohamed Thelji.

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

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

Less More

- Posts: 38
- Thank you received: 0
-
-

7 years 3 months ago [\#309511](#309511) by [lesk](/forum/user/58400-lesk "View lesk's Profile")  Replied by *[lesk](/forum/user/58400-lesk "View lesk's Profile")* on topic *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309511 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")*

> Mohamed Thelji wrote: Hello,
>
> There's actually no option to do that, so the best solution will either be to :
> \- Develop a plugin or edit the code of your payment plugins, to prevent the order creation if he is not supposed to make any purchase.

It needs to happen at the click to add to cart stage. If it gets to the payment plugin, then it's going to be too late.

> Mohamed Thelji wrote: - Set the "User group after purchase" option of your product configuration page to a custom user group
> \- Go to your payment configuration pages and restrict your payment method to every groups but that new one.

With a million ebooks - I don't think that's even a viable suggestion.

**If anyone has managed to resolve this issue please let me know. Thanks in advance.**

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5ODAyMy1yZXN0cmljdGlvbi1vZi1wdXJjaGFzZS1pZi1hbHJlYWR5LWluLWRvd25sb2FkLWFyZWE/dG1wbD1tYXJrZG93bg==) 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
-
-
-

7 years 3 months ago -  7 years 3 months ago [\#309512](#309512) 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 *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309512 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")*

Hello,

I'm sorry if my suggestions were not viable solution for your issue, it wasn't specified that the error message should have bean displayed just after clicking on the add to cart button.

A good solution can be to directly develop a plugin based on the "onBeforeCartSave(&amp;$element,&amp;$do)" trigger, and cancel the add to cart action if your user already purchased that product and display your error message.

For more information about that trigger, you can check our developer documentation :

> This method will be called by HikaShop before the cart is saved, when a product is added, removed, modified, when a shipping or payment method is selected, etc. In the object $element, you can have an attribute cart\_products which is an array of products to be added/modified. You can use the variable $do to cancel the save.

[ www.hikashop.com/support/documentation/6...umentation.html#cart](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#cart)

Kind regards,
Mohamed Thelji

Last edit: 7 years 3 months ago by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile").

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

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

Less More

- Posts: 38
- Thank you received: 0
-
-

7 years 3 months ago [\#309550](#309550) by [lesk](/forum/user/58400-lesk "View lesk's Profile")  Replied by *[lesk](/forum/user/58400-lesk "View lesk's Profile")* on topic *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309550 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")*

Hi Mohamed

I think I've got a workaround for this by allowing the download to be available on the product page. Then altering the label as in picture.

It would be useful to disable the product link below it. Is there a simple bit of code I can add to do that?

[ ![Snap16.jpg](/forum/attachment/47423) ](/forum/attachment/47423 "Snap16.jpg")

- [ ![Snap16.jpg](/forum/attachment/47423?download=1) ](/forum/attachment/47423?download=1 "Snap16.jpg") [ ](/forum/attachment/47423?download=1 "Snap16.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5ODAyMy1yZXN0cmljdGlvbi1vZi1wdXJjaGFzZS1pZi1hbHJlYWR5LWluLWRvd25sb2FkLWFyZWE/dG1wbD1tYXJrZG93bg==) 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: 86359
- Thank you received: 14293
-
-

7 years 3 months ago [\#309557](#309557) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309557 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")*

Hi,

I'm not sure what you mean ? You want to disable the link to the download file there ?
In that case, you could just add such CSS:
\#hikashop_product_files_main .hikashop_product_file_link{ display:none;}

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

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

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

Less More

- Posts: 38
- Thank you received: 0
-
-

7 years 3 months ago [\#309589](#309589) by [lesk](/forum/user/58400-lesk "View lesk's Profile")  Replied by *[lesk](/forum/user/58400-lesk "View lesk's Profile")* on topic *[Restriction of purchase if already in download area.](/forum/35-orders-management/898023-restriction-of-purchase-if-already-in-download-area#309589 "-- HikaShop version -- : 4.2.1 -- Joomla version -- : 3.9.10 -- PHP version -- : 7.2.20 -- Browser(s) name and version -- : Chrome  I want the order to fail if the customer already has a copy of the file in their download directory. I need it to show a message like 'you have already purchased this ebook' or whatever I need it to say.  Is there any way of doing this within the restrictions of the existing software or is it a bespoke programming item?")*

Thank you, that's fine. ![:)](/media/kunena/emoticons/3.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5ODAyMy1yZXN0cmljdGlvbi1vZi1wdXJjaGFzZS1pZi1hbHJlYWR5LWluLWRvd25sb2FkLWFyZWE/dG1wbD1tYXJrZG93bg==) 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.069 seconds

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