500 - View class not found [class, file]: categoryViewproduct

  • Posts: 28
  • Thank you received: 3
6 years 9 months ago #274901

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.4
-- PHP version -- : 7.1.7
-- Browser(s) name and version -- : Firefox
-- Error-message(debug-mod must be tuned on) -- : 500 - View class not found [class, file]: categoryViewproduct, /home/alberta8/public_html/components/com_hikashop/views/product/view.html.php

I cannot reproduce this at my localhost. But the production web-site is affected.

My localhost has 7.1.6 php while the prod. server is under 7.1.7

I tried switching to the default template (means no HS overrides) - the same issue.

Enabling development error level doesn't change the output - I don't see any additional error information.

At my localhost here is ProductController (and it works)
and at the broken product server here is CategoryController

The menu item is a HS product. So the prod. server wrongly defines the controller.

static.xscreenshot.com/2017/07/28/11/scr...728aeb9d5313e78bdb28

Another screenshot
$view = JRequest::getCmd('view');
When works returns 'product', when not works - returns ''
static.xscreenshot.com/2017/07/28/12/scr...7473ac5e7c159e8249b0

I also tried recreating the menu item.

SEF links OFF - works.

I tired replacing all JRequest with $jinput (added $jinput = JFactory::getApplication()->input; at the top of the file) - and I can see the same error at my localhost).

Last edit: 6 years 9 months ago by remotelyyours.

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

  • Posts: 28
  • Thank you received: 3
6 years 9 months ago #274914

I can fix the issue by replacing JRequest by jInput and JRequest::setVar by $jinput->set

<?php
/**
 * @package	HikaShop for Joomla!
 * @version	3.1.1
 * @author	hikashop.com
 * @copyright	(C) 2010-2017 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><?php
jimport('joomla.application.component.controller');
jimport('joomla.application.component.view');

$jinput = JFactory::getApplication()->input;

$jinput->set('hikashop_front_end_main',1);

if(!defined('DS'))
	define('DS', DIRECTORY_SEPARATOR);
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');

if(defined('JDEBUG') && JDEBUG){
	error_reporting(E_ALL);
 	@ini_set('display_errors', 1);
}

$config =& hikashop_config();
if($config->get('store_offline')) {
	$app = JFactory::getApplication();
	$app->enqueueMessage(JText::_('SHOP_IN_MAINTENANCE'));
	return;
}

global $Itemid;
if(empty($Itemid)) {
	$urlItemid = $jinput->getInt('Itemid');
	if($urlItemid) {
		$Itemid = $urlItemid;
	}
}

$view = $jinput->getCmd('view');
if(!empty($view) && empty($jinput->getCmd('ctrl'))) {
	$jinput->set('ctrl', $view);
	$layout = $jinput->getCmd('layout');
	if(!empty($layout)){
		$jinput->set('task', $layout);
	}
}

if(HIKASHOP_J30) {
	$token = hikashop_getFormToken();
	$isToken = $jinput->getVar($token, '');
	if(!empty($isToken) && !$jinput->checkToken('request')) {
		$app = JFactory::getApplication();
		$app->input->request->set($token, 1);
	}
}

$session = JFactory::getSession();
if(is_null($session->get('registry'))) {
	jimport('joomla.registry.registry');
	$session->set('registry', new JRegistry('session'));
}
$taskGroup = $jinput->getCmd('ctrl','category');
$className = ucfirst($taskGroup).'Controller';

if(!class_exists($className) && (!file_exists(HIKASHOP_CONTROLLER.$taskGroup.'.php') || !@include(HIKASHOP_CONTROLLER.$taskGroup.'.php'))) {
	if(!hikashop_getPluginController($taskGroup))
		return JError::raiseError(404, 'Page not found : '.$taskGroup);
}
if($taskGroup != 'checkout') {
	$app = JFactory::getApplication();
	$app->setUserState('com_hikashop.ssl_redirect',0);
}

$classGroup = new $className();

$jinput->set('view', $classGroup->getName() );

$classGroup->execute($jinput->getCmd('task'));

$classGroup->redirect();
if($jinput->getString('tmpl') !== 'component'){
	echo hikashop_footer();
}

$jinput->set('hikashop_front_end_main',0);

But I meet another issue -
At the category lisitng page I cannot get to the list of producst. Both - with my hack and without it.

I go here albertatacticalrifle.com/hikashop-menu-for-categories-listing
and click on a category - I see the same page. I don't go to subcategories as expected.
albertatacticalrifle.com/hikashop-menu-f...ategory/13-ar15-ar10

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

  • Posts: 28
  • Thank you received: 3
6 years 9 months ago #274915

Well, I rolled back to PHP 7.0.21
This seems to start working. But I'm pretty sure it must work at php 7.1.7 as well.

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

  • Posts: 26017
  • Thank you received: 4004
  • MODERATOR
6 years 9 months ago #274917

Hello,

Would it be possible to have details about your menu configuration ?

Your issue is that you have neither "ctrl" or "view".
HikaShop consider that if you do not have the "view", you should have "ctrl" parameter instead.

Your issue looks like a routing issue. Do you use a SEF component or something which would change how Joomla is parsing the URL and the menus ?
So I'm afraid that it might not be related to HikaShop since it does just use Joomla core in order to get the parameters.
If JRequest do not have data but jinput does ; it means that there is a bug in Joomla core because components and plugins should be able to access to parameters via both.

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.

  • Posts: 28
  • Thank you received: 3
6 years 9 months ago #274987

We don't use any routing software. Joomla native SEF.

What do I need to tell about the menu configuration?

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

  • Posts: 81597
  • Thank you received: 13081
  • MODERATOR
6 years 9 months ago #275034

Hi,

Thanks for the feedback. We'll do the necessary modifications on our end to cope with that issue with the next version of HikaShop. Until then, you can keep your patches or stay with PHP 7.0.x

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

Time to create page: 0.064 seconds
Powered by Kunena Forum