Category not found error after upgrade to Hikashop Business v4.2.1

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #311558

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.12
-- PHP version -- : 7.2.21
-- Browser(s) name and version -- : Version 77.0.3865.90 (Official Build) (64-bit)
-- Error-message(debug-mod must be tuned on) -- : Category not found
/mnt/data/vhosts/casite-620018.cloudaccess.net/httpdocs/components/com_hikashop/views/category/view.html.php:187

Hi all, as soon as I upgrade to 4.2.1 (from 4.0.3), you can no longer login to the front end of the site without receiving a 404 Category not found error.

I use Community Builder v2.4.2 for the login functions, and my Joomla version is 3.9.12.


The basics of how it *should* work are:

1. Client logs in with CB login module on home page

2. They are immediately redirected on login to their main category page using the 'Redirect on Login' plugin. I removed this plugin entirely in my testing and I still got the error.


I can confirm that it is the Hikashop update that triggers the issue, as I am testing the update on my staging server. I have updated everything except Hika and everything works as it should, but the instant I update Hika the problem occurs.

I thought it might be some kind of canonical url issue, but no amount of wrangling with the settings, including removing them entirely affects the problem. I've even turned off Joomla SEF completely with no effect.

A couple of odd things:

• You can't login using the CB Login module on the home page, but you CAN login using the CB Login default page.

• once you get the error, clicking the Home Page link to the index.php page generates another error, but if I put in one of the urls by hand it loads fine.

• I'm getting these issues in Chrome and Safari, but in Firefox sometimes instead of the 404, it just kicks you over to the CB Login page.

This message contains confidential information


But you still can't login, it just keeps reloading the page.

Thanks for any help. I'm stumped on this one...

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #311566

Hi,

Without looking at the issue, I can't say much.
From what you've described, I would also say that the issue is related with SEF/URL redirection.
You gave a link to the login page, but I don't see any link to register and you didn't provide a test user account. Could you provide a test user account so that we could reproduce the issue ?
Also, you're saying that after login they are redirected to "their main category page". So I suppose that the link where they are redirected is different for each user, right ? How does it work ?

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #311581

My fault, I'll provide the necessary details.

This message contains confidential information

Last edit: 4 years 5 months ago by Philip.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #311609

Hi,

From what I can see the redirect on login doesn't work properly since I get redirected to your home page URL instead of of being redirected to your blue-category-all-products.html menu item after the CB login. I don't see how HikaShop would be loinked to that since it's something handled between CB and that "redirect on login" plugin. HikaShop plays no role here. It would if you were redirected to blue-category-all-products.html and from there to the home page, but that's not the case.

And you have a second problem: on the home page, once you're logged in, there is that category not found error. I suspect it's either linked to the menu item or to a module on the page configured to display only for some access level.
For that second problem, I would recommend to turn on the "error reporting" and "debug mode" settings of the Joomla configuration and try again. The error page should then display the call stack (files and line numbers involved) of the error. If you could then provide the full error report on the page, that will help us better understand the situation.

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #311634

Hi Nicolas, thanks for checking on this one.

Were you trying in Firefox? As I wrote Firefox seemed to kick you back to the login page, while Chrome/Safari kicked up the 404 category not found error. The whole thing is odd.

As for the Redirect on Login plugin, as I wrote before I disabled, then removed that plugin entirely and the error still occurs. Without the plugin (and without the 4.2.1 update), when you login instead of redirecting you just stay on that home page. As soon as 4.2.1 is applied then you get the error.

I did turn on the error reporting and debug settings, and I pasted the result into the first post which was:

-- Error-message(debug-mod must be tuned on) -- : Category not found
/mnt/data/vhosts/casite-620018.cloudaccess.net/httpdocs/components/com_hikashop/views/category/view.html.php:187

I looked in that file around that line number and found this block of code:

$acl_filters[] = 'category_type=\''.$content_type.'\'';
				$acl_filters[] = 'category_id IN ('.implode(',',$pageInfo->filter->cid).')';
				$query = 'SELECT category_id FROM '.hikashop_table('category').' WHERE '.implode(' AND ',$acl_filters);
				$database->setQuery($query);
				$pageInfo->filter->cid = $database->loadColumn();
				if(!count($pageInfo->filter->cid)) {
					throw new Exception(JText::_('CATEGORY_NOT_FOUND'), 404);
				}
			}
		}

I see the 'Category Not Found' message and some acl code, but unless something drastic changed under the hood, my user groups and access should all be the same and working as before.

Right now all I have is that everything works until Hikashop 4.2.1 is applied. So Hikashop is either the direct culprit here, or the 4.2.1 update is in conflict with something, but I sure can't tell what. I've reverted my server several times over now to reapply the update and everything works fine until Hika is updated to 4.2.1.

So at this point my live site is going to have to remain on 4.0.3 until I can figure this one out.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #311635

Hi,

This code is there to prevent people from accessing categories that are unpublished or with an access level not allowed.
This code was not present in old versions of HikaShop and thus it could allow people to access categories they weren't supposed to see.
So I would recomment to first check the category selected in the "main category" setting of the menu item used on the homepage or the same setting of a products / categories listing module configured to display on the homepage.
It must be linked to the way the category is configured.

But without knowing your setup I can't say exactly.
Of course, you could just remove the code that was added there, and you would be done, but I don't recommend it.

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #311697

Alright, so my home page menu item is a basic Joomla category that is set to 'Public' access.

However the homepage has many, many modules set to display. Some are Joomla menu items and some are Hikashop category listings, but each is set to the access level of it's respective client.

So there would be over 200 menus and category listing on that page, and each client on login would only see 1 top menu, and 1 Hika Category listing on that home page.

Could this be the problem?

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #311699

Hi,

Ok, I see the problem then.
Try changing the line:
if(!count($pageInfo->filter->cid)) {
to:
if(!count($pageInfo->filter->cid) && empty($this->module)) {
in that block of code of the file components/com_hikashop/views/category/view.html.php
That should avoid throwing an 404 error for modules and instead just not display the module (like before).

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

  • Posts: 75
  • Thank you received: 7
  • Hikashop Business
4 years 5 months ago #311793

Yes, that did it! Thanks!

Now, is this something I can manage in an override? Or must I always apply this change each time I update?

I went to Display > Views and chose Category view for the front end of my template, but I can't seem to find this code in any of them.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
4 years 5 months ago #311797

Hi,

That change will be added on our end so you won't have to do anything in the future.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum