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

#   Prevent Hikashop module from showing items which are already in the cart

##

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

Less More

- Posts: 48
- Thank you received: 5
-
-

1 year 2 months ago [\#368107](#368107) by [brettv](/forum/user/68705-brettv "View brettv's Profile")  *[Prevent Hikashop module from showing items which are already in the cart](/forum/27-checkout/909624-prevent-hikashop-module-from-showing-items-which-are-already-in-the-cart#368107 "-- HikaShop version -- : 6.0.0 -- Joomla version -- : 4.4.13 -- PHP version -- : 8.1.32  Hello, I have set the Hikashop module to show Related products from cart. Then I have published this module on the Cart Display menu item (index.php?option=com&#95;hikashop&amp;view=cart&amp;layout=show) But the module displays products which are already in the cart. I'd like to prevent this from happening, because I only allow one copy per product to be purchased (I sell digital products only). I have multiple related products set, so if I refresh the cart page, a product which is not already in the cart will show up. But I'd like this to happen by default. I'd like the module to not show any product if there are no more related items which haven't already been added to the cart. How can I achieve this? Thanks in advance.")* was created by *[brettv](/forum/user/68705-brettv "View brettv's Profile")*

-- HikaShop version -- : 6.0.0
-- Joomla version -- : 4.4.13
-- PHP version -- : 8.1.32

Hello,
I have set the Hikashop module to show Related products from cart.
Then I have published this module on the Cart Display menu item (index.php?option=com_hikashop&amp;view=cart&amp;layout=show)
But the module displays products which are already in the cart.
I'd like to prevent this from happening, because I only allow one copy per product to be purchased (I sell digital products only).
I have multiple related products set, so if I refresh the cart page, a product which is not already in the cart will show up.
But I'd like this to happen by default.
I'd like the module to not show any product if there are no more related items which haven't already been added to the cart.
How can I achieve this?
Thanks in advance.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwOTYyNC1wcmV2ZW50LWhpa2FzaG9wLW1vZHVsZS1mcm9tLXNob3dpbmctaXRlbXMtd2hpY2gtYXJlLWFscmVhZHktaW4tdGhlLWNhcnQ/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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86289
- Thank you received: 14265
-
-

1 year 2 months ago [\#368109](#368109) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Prevent Hikashop module from showing items which are already in the cart](/forum/27-checkout/909624-prevent-hikashop-module-from-showing-items-which-are-already-in-the-cart#368109 "-- HikaShop version -- : 6.0.0 -- Joomla version -- : 4.4.13 -- PHP version -- : 8.1.32  Hello, I have set the Hikashop module to show Related products from cart. Then I have published this module on the Cart Display menu item (index.php?option=com&#95;hikashop&amp;view=cart&amp;layout=show) But the module displays products which are already in the cart. I'd like to prevent this from happening, because I only allow one copy per product to be purchased (I sell digital products only). I have multiple related products set, so if I refresh the cart page, a product which is not already in the cart will show up. But I'd like this to happen by default. I'd like the module to not show any product if there are no more related items which haven't already been added to the cart. How can I achieve this? Thanks in advance.")*

Hi,

I agree that the system could be improved to avoid referencing such products in the module as it doesn't make sense in most cases.

Try adding the line: Code:

$filters[] = 'b.product_id NOT IN ('.implode(',',$mainIds).')';

after the line: Code:

$filters[] = 'b.product_id IN ('.$ids.')';

in the file components/com_hikashop/views/product/view.html.php
That should do it. Let us know how it goes so that we can include the change for the next version of HikaShop.

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

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

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

Less More

- Posts: 48
- Thank you received: 5
-
-

1 year 2 months ago [\#368178](#368178) by [brettv](/forum/user/68705-brettv "View brettv's Profile")  Replied by *[brettv](/forum/user/68705-brettv "View brettv's Profile")* on topic *[Prevent Hikashop module from showing items which are already in the cart](/forum/27-checkout/909624-prevent-hikashop-module-from-showing-items-which-are-already-in-the-cart#368178 "-- HikaShop version -- : 6.0.0 -- Joomla version -- : 4.4.13 -- PHP version -- : 8.1.32  Hello, I have set the Hikashop module to show Related products from cart. Then I have published this module on the Cart Display menu item (index.php?option=com&#95;hikashop&amp;view=cart&amp;layout=show) But the module displays products which are already in the cart. I'd like to prevent this from happening, because I only allow one copy per product to be purchased (I sell digital products only). I have multiple related products set, so if I refresh the cart page, a product which is not already in the cart will show up. But I'd like this to happen by default. I'd like the module to not show any product if there are no more related items which haven't already been added to the cart. How can I achieve this? Thanks in advance.")*

Yes it worked. Thanks.

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkwOTYyNC1wcmV2ZW50LWhpa2FzaG9wLW1vZHVsZS1mcm9tLXNob3dpbmctaXRlbXMtd2hpY2gtYXJlLWFscmVhZHktaW4tdGhlLWNhcnQ/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.168 seconds

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

[](#top)
