Product access level restriction > blank page

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 4 weeks ago #282792

-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.8.2
-- PHP version -- : 7.1.9
-- Browser(s) name and version -- : Chrome 62

Hi guys,
I set a group restriction for my product.
--- If I set a "HikaShop Category menu" and I'm not part of the joomla group, clicking on the menu link the content template is not shown;
--- If I set a "hikaShop Product menu" and I'm not part of the joomla group, clicking on the menu link I have back a totally blank page!

1 - I think the correct behaviour is the category menu one... a totally blank page is really awful. Please, Am I forgetting anything ? Or Can you confirm the behaviour ?
2 - How to have back the standard joomla red error message: "You are not authorized to view this content" ? I suppose this should be the right behaviour. Having back a blank content leave the users with doubt that something is not running.

Many Thanks for help

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

  • Posts: 62763
  • Thank you received: 9004
  • MODERATOR
7 months 4 weeks ago #282800

Hi,

A totally blank page indicates a fatal error during the execution of the PHP. Please activate the "error reporting" and "debug mode settings of the Joomla configuration and that should display an error message on that blank page which will indicate where the problem is coming from.
Without that, we can't say anything. It could come from anything on your website.

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

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks ago #283047

Hi Nicolas,
Debug System: Yes
Error Reporting: Development
I had to switch to Protostar template (instead of mine that continue to giveme back only the blank page) to have back this report:

Attachments:

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

  • Posts: 62763
  • Thank you received: 9004
  • MODERATOR
7 months 3 weeks ago #283051

Hi,

Your problem has several layers to it:
1. There is a problem with the URL of the page which leads HikaShop to not finding the product to display for the link you're clicking on.
2. HikaShop then tries to display the 404 error page of your website through Joomla's API.
3. There is apparently an issue with your 404 error page which creates the fatal error.

First, try to replace the code:

JError::raiseError(404, JText::_('PRODUCT_NOT_FOUND'));
		echo '</div>';
		return;
to:
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found", true, 404);
in the file components/com_hikashop/views/product/tmpl/show.php
That should display the 404 error without going through Joomla.

Now that won't fix the real issue which is that there is a problem with your URL, but we would need to know more about that: screenshot of the product settings and the URL you're using to access that error page.

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

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks ago #283105

Hi Nicolas,
thank you very much for reply. If it is more simple for you, I can put online a copy of the site with a Super Admin and FTP access to permit you a good investigation on it.

Waiting your confirmation before to process...

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

  • Posts: 62763
  • Thank you received: 9004
  • MODERATOR
7 months 3 weeks ago #283118

Hi,

Well, why not but on top of that we would reallly need that you first try the change I proposed and provide the information I asked for in my previous message.

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

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks ago #283188

Hi Nicolas,
so, I made the modification and:

1 - I have back the message: "Product not found"
2 - I attach the screenshot of the product settings. PS In Menus, the "Event" public menu is setted with alias as "convegno-aimfi-centro-nord-2017"
3 - "URL you're using to access that error page" - Here the product Menu Link on the copy test site
Thanks for support !

Attachments:
Last Edit: 7 months 3 weeks ago by joomleb.

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

  • Posts: 62763
  • Thank you received: 9004
  • MODERATOR
7 months 3 weeks ago #283192

Hi,

What I see on the like you gave and hat you reported so far is different.
On that link, I have that:
monosnap.com/file/AcTbS0L3G0fIpABmRJyhcvJa3zatev
And looking in the details of the error, there are no files of HikaShop involved with that error.
It seems to be a Joomla content menu item trying to display a Joomla article it can't find.
So I'm confused.
How do you get to that "Product not found" error page ?
Do you also have that "article not found" error when you try to access the link you gave ?
How did you configure the menu item of that link ?

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

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks ago #283242

Hi Nicolas,
thanks for helping:

1 - "Do you also have that "article not found" error when you try to access the link you gave ?" I'm too sorry, I made a mistake, I corrected it .

2 - "How do you get to that "Product not found" error page ?" = After trying I came back to the original file components/com_hikashop/views/product/tmpl/show.php. So now I have back the blank page. Please, let me know if I have to swith again to your modified file.
PS Menu Access: Public - Event Product - RESTRICTIONS AND DIMENSIONS - Access level: "XXX" - If the user is not assigned to that usergroup = blank page
Menu Access: Public - Event Product - RESTRICTIONS AND DIMENSIONS - Access level: "XXX" - If the user is assigned to the "XXX" usergroup = the Product page is shown rightly

3 - "How did you configure the menu item of that link ?" Here attached the setting image:

Attachments:
Last Edit: 7 months 3 weeks ago by joomleb.

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

  • Posts: 62763
  • Thank you received: 9004
  • MODERATOR
7 months 3 weeks ago #283244

Hi,

Can you make sure that you selected a product under the "Select a product" tab of your menu item ? And make sure that this product is published.

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

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks ago #283264

Hi Nicolas,
A - "Can you make sure that you selected a product under the "Select a product" tab of your menu item ?" = sure, selected
B - "And make sure that this product is published." = sure, published

Infact, When a user assigned to the "XXX" usergroup (same group selected into Product > RESTRICTIONS AND DIMENSIONS > Access level ) click on the Product Menu, the Product page is shown rightly

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

  • Posts: 62763
  • Thank you received: 9004
  • MODERATOR
7 months 3 weeks ago #283272

Hi,

Well, that's normal then.
If you set an access level to the product, then the users using the menu item link that don't have access to the product will be redirected to a 404 error page with the text "product not found", and then your template has a problem with the display of error pages.
So on HikaShop's end, it's actually working properly.
Now, I'm wondering why you're doing that ?
Why not instead restrict the menu item itself to the access level that you want ? That way, the menu item link won't be displayed when the user isn't in the correct user group.

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

  • Posts: 256
  • Thank you received: 17
  • Hikaserial Subscription Hikashop Business
7 months 3 weeks ago #283362

Hi Nicolas,
A - "Now, I'm wondering why you're doing that ? Why not instead restrict the menu item itself to the access level that you want ? That way, the menu item link won't be displayed when the user isn't in the correct user group." = Because I want attract new users, so all users should see products, but for some of them, if you are not a subscriber added to a specific usergroup, you cannot buy them.

B - "So on HikaShop's end, it's actually working properly" = S, this is why in my first post here I described:

--- If I set a "HikaShop Category menu" and I'm not part of the joomla group, clicking on the menu link the content template is not shown;
--- If I set a "hikaShop Product menu" and I'm not part of the joomla group, clicking on the menu link I have back a totally blank page!

And "I suggested":
1 - I think the correct behaviour is the category menu one... a totally blank page is really awful (is bettere the category behaviour)
2 - How to have back the standard joomla red error message: "You are not authorized to view this content" ? I suppose this should be the right behaviour. Having back a blank content or a 404 Error page leave the users with doubt that something is not running.

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

  • Posts: 22537
  • Thank you received: 3509
  • MODERATOR
7 months 2 weeks ago #283364

Hello,

ACL on product means that users can or cannot see/access the product.
If you don't want to let user buy the product ; use ACL on the prices !

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.124 seconds
Powered by Kunena Forum