404 and error pages not recorded in Joomla redirects

  • Posts: 88
  • Thank you received: 19
2 years 10 months ago #333621

-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.27
-- PHP version -- : 7.4

Hi

I have a problem getting Hikashop to work together with Joomla redirects when bad URL's are displayed. Also I see 2 different kinds of error pages / layouts, depending only on dash (-) in the url. It seems as if Hikashop handles bad urls / 404 pages internally only, and never tells Joomla about it.
That means, we have no way of finding / acting upon those urls, as we can with every other extension we use.

Is it something we can "turn off" or override?

Demonstration video:
we.tl/t-tkW5b5fsQd

Thanks.

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
2 years 10 months ago #333631

Hi,

Are you sure that your redirect component and its system redirect plugin are properly configured to log the 404 errors and it works for other extensions on that same website ?
Because as far as I can see, when Joomla needs to display a 404 error page, it uses the code:
throw new Exception(JText::_('JERROR_PAGE_NOT_FOUND'), 404);
And for the "Product not found" error page, HikaShop uses the same mechanism:
throw new Exception(JText::_('PRODUCT_NOT_FOUND'), 404);

In fact, this particular line was added almost 3 years ago following this thread:
www.hikashop.com/forum/product-category-...hikashop.html#300564
where the user had an issue with the redirect component of Joomla not logging the 404 URLs from HikaShop anymore, and having this code used made it work again.
So I'm pretty sure that the redirect component is seeing these "product not found" 404 URLs coming from HikaShop.
And thus, it's likely that it's the redirect component or the redirect plugin not configured properly on your end to log them.

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

  • Posts: 88
  • Thank you received: 19
2 years 10 months ago #333639

I will test, but on our production website, the redirects component works for other components, collecting 404 pages, but just not for hikashop.

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

  • Posts: 88
  • Thank you received: 19
2 years 9 months ago #334298

I have now tested this on a vanilla Joomla with Hikashop.
Regular "bad" URLs are collected in Joomla Redirects component.
If I test against a hikashop url, I get mixed results.

Test URL with a working product page:
URL/hikashop-menu-for-categories-listing/product/brown-shoes

If I remove the dash like this:
URL/hikashop-menu-for-categories-listing/product/brownshoes
Then I get a warning containing: Page not found : browshoes

The URL is not collected in Joomla Redirects.

if I test while keeping the dash, but change other parts on the product name like:
URL/hikashop-menu-for-categories-listing/product/brown-2hoes
Then I get a proper 404 page, and the URL is collected in Joomla Redirects.

So it seems as if, when Hikashop tries to handle a 404, then the error page is not collected.

Last edit: 2 years 9 months ago by dyvel.

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

  • Posts: 81540
  • Thank you received: 13069
  • MODERATOR
2 years 9 months ago #334301

Hi,

Ok, thank you for your feedback. I think I understand the situation.
The proper 404 page is the case I was talking about in www.hikashop.com/forum/install-update/90...edirects.html#333631
Following your test instructions, I was able to get the "Page not found : browshoes" error. It comes from another place when loading the controller for the page processing.
Change the code:

header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found", true, 404);
		$app = JFactory::getApplication();
		$app->enqueueMessage('Page not found : '.$taskGroup, 'warning');
to:
throw new Exception('Page not found : '.$taskGroup, 404);
in the file components/com_hikashop/hikashop.php and it will make it use the normal 404 error page too.
On my end, this modification works fine so we'll include it in the next release of HikaShop. Let me know if you find other issues like that after that modification.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum