- Posts: 48
- Thank you received: 5
Prevent Hikashop module from showing items which are already in the cart
1 year 1 month ago #368107
by brettv
-- 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&view=cart&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.
-- 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&view=cart&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 or Create an account to join the conversation.
1 year 1 month ago #368109
by nicolas
Replied by nicolas on topic Prevent Hikashop module from showing items which are already in the cart
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:
after the line:
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.
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).')';
Code:
$filters[] = 'b.product_id IN ('.$ids.')';
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
Please Log in or Create an account to join the conversation.
1 year 1 month ago #368178
by brettv
Replied by brettv on topic Prevent Hikashop module from showing items which are already in the cart
Yes it worked. Thanks.
The following user(s) said Thank You: nicolas
Please Log in or Create an account to join the conversation.
Time to create page: 0.223 seconds