Product is not available

  • Posts: 41
  • Thank you received: 2
1 year 11 months ago #347432

-- HikaShop version -- : 4.7.0
-- Joomla version -- : 3.10.11
-- PHP version -- : 8.0.26
-- Browser(s) name and version -- : All

I have a setup where I have categories that are public and others that are restricted by user groups.
With a user logged in they are able to view the "restricted items" however I have an issue that when selecting an item in the "restricted" area it can but not all the time, come up with "product unavailable" this is despite the item being set to unlimited qty.
When this happens I can navigate to an item which is available to someone not registered on the site add it to the cart and then go back to a "restricted" item and it will then add to the cart.

I was able to force this issue to happen by navigating to the basket and selecting "Empty the cart" and then go to any category which requires the user to be logged in with a usergroup that needs to be logged on with and then following the instructions above.

Thanks in advance

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 11 months ago #347434

Hi,

Could you provide precise steps to reproduce the issue on your website with a test user account and a screenshot of the settings of the product/category involved (or a backend access) so that we can look into it ?

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 2
1 year 11 months ago #347435

I have just downgraded to 4.4.5 on a local version of the site which is running J4 & php 7 and I see there isn't an option to "Empty the cart" but when I upgrade the shop there to 4.7.0 the error happens.

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 2
1 year 11 months ago #347438

nicolas,
Thanks for your response, I have just sent a message using the support "contact us" page with log on details and exact details to follow to be able to replicate the issue

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 11 months ago #347481

Hi,

Thank you for the access. I'm able to reproduce the issue on your website.
That's great. I looked at the code on our end for that "The product %s is not available" error message, and I think it comes from the function checkQuantities in class.cart which verifies that the product can be added to the cart before adding it.
I think it has something to do with the user group check done with the code

if(empty($msg) && !in_array($product['data']->parent_product_access, array('', 'all')) && hikashop_level(2)) {
					if(!empty($cart->user_id)) {
						$userClass = hikashop_get('class.user');
						$user_groups = $userClass->getGroups( (int)$cart->user_id );
						$parent_product_groups = explode(',', $product['data']->parent_product_access);
						hikashop_toInteger($parent_product_groups);
						$intersect = array_intersect($user_groups, $parent_product_groups);
					}
					if(empty($intersect))
						$msg = JText::sprintf('PRODUCT_NOT_AVAILABLE', $id);
				}
Would it be possible to also have a FTP access in order to add some debugging around that code in order to check the situation deeper ?

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 2
1 year 11 months ago #347484

Hi thanks for looking into this, I am glad you have been able to replicate the issue as well.
I have just set up and passed on the ftp details via contact us. I am travelling with work at the moment so haven't been able to confirm the ftp is working. Any issues let me know and I can address them Thursdat

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 11 months ago #347493

Hi,

We got the FTP access but it's not working. No worries, just check it when you get back.

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 2
1 year 11 months ago #347554

FTP is now working, I have sent new log on details to Contact us :)

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 11 months ago #347570

Hi,

Thanks. I was able to investigate and added a patch for the issue.
Once a cart was emptied, and if you added to the cart a product with variants where the main product was restricted by user group and even if you were logged in with access to the product, it was possible the add to cart would be refused due to the system not properly retrieving the current user id.
It seems to be working fine on your website now. I've also added the patch on our end for the next version of HikaShop.

Please Log in or Create an account to join the conversation.

  • Posts: 41
  • Thank you received: 2
1 year 11 months ago #347571

Hi Nicolas,
Many thanks for your assistance in resolving the issue, I have just checked and all seems to be working correctly :)

Please Log in or Create an account to join the conversation.

  • Posts: 42
  • Thank you received: 0
  • Hikashop Business
1 year 10 months ago #347827

It seems I have the same issue. Is the patch publicly available?

Last edit: 1 year 10 months ago by webwerk.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
1 year 10 months ago #347829

Hi,

Yes. After some further testing on our end, we've added it as a hot patch without waiting for the next release, which is scheduled for the end of January.
So to get the patch, download again the install package of the 4.7.0 on our website and install it on your website.

The following user(s) said Thank You: webwerk

Please Log in or Create an account to join the conversation.

Time to create page: 0.083 seconds
Powered by Kunena Forum