Error class active subcategory

  • Posts: 220
  • Thank you received: 8
8 years 10 months ago #251184

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2
-- PHP version -- : 5.4.36

Hi,

I'm testing Hikashop 2.6.4 (patch 2016-09-29) and I noticed an error in the display of subcategories (Content module).

The standard li-class of a subcategory is: hikashop_category_list_item
Before the class of the active subcategory changed into: hikashop_category_list_item current active

But now the class of the active subcategory does not change, still it is hikashop_category_list_item
Because of this the CSS of the active class does not work anymore.

I didnot notice this error before, it might be introduced in the last patch (but I'm not sure about this) .

Please advise.

Regards,
Udo

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

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
8 years 10 months ago #251190

Hi,

I've checked the change log on our end and I don't see what recent change could have done that.
The active class still displays on my end when I test it with the latest version.
So I guess it might be linked to the way something is configured on your website. We would need more details to be able to say more on that.

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

  • Posts: 220
  • Thank you received: 8
8 years 10 months ago #251386

Hi,

I have some new information that might help.

I did another test on a local XAMPP site running Hikashop 2.5.0 on Joomla 2.5.28
The active subcategory works fine, the li classes "current active" are present

First I updated to Hikashop 2.6.0
Nothing changes, still the active subcategory works fine, the classes "current active" are present..

Then I updated to Hikashop 2.6.3
Now the problem arises. The classes "current active" are not present anymore in the active subcategory.. The li classes of active and inactive subcategories are the same.

So a change in 2.6.1, 2.6.2 or 2.6.3 has caused my problem (I don't have versions 2.6.1 and 2.6.2 so I can't test which version is to blame).
I hope this new information helps.
.
You said it's possible that the configuration causes the problem. I have no idea where to look. Do you have any suggestions which part of the configuration is relevant to this issue?

Regards,
Udo

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

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
8 years 10 months ago #251388

Hi,

Thank you for the additional information. I see what's going on. I've added a patch on our end. Download the install package on our website and install it on yours and that will add the patch for that bug.

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

  • Posts: 220
  • Thank you received: 8
8 years 10 months ago #251445

Hi,
This morning I downloaded and installed the newest package.
Alas, still no classes current active. The problem persists.

Udo

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

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
8 years 10 months ago #251451

Hi,

I'm not able to reproduce the issue with the latest package.
Maybe you have an override of the file "listing_list" of the view "category" via the menu Display>Views ?
Otherwise, we'll need more information as it's now working on our end as far as we can see.

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

  • Posts: 220
  • Thank you received: 8
8 years 10 months ago #251565

Hi Nicolas,

No, there's no override listing_list.

I have new information about the source of the problem.
I've tested settings of the 'Category data display' in the Hikashop content module 'Categories on 1 level'.

My setting on Show children is 'All direct subcategories'.
If I change this setting into 'All subcategories' the display of the active subcategory is correct: classes 'current active' are present..
After changing this setting back into 'All direct subcategories' the display of an active subcategory is wrong again, without classes çurrent active'.

I hope this information helps.

Regards, Udo

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

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
8 years 10 months ago #251588

Hi,

Ok. Try to replace the code of that view file with this one:

<?php
if(empty($this->rows))
	return;

$pagination = $this->config->get('pagination','bottom');
if(in_array($pagination,array('top','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total > $this->pageInfo->limit->value) {
	$this->pagination->form = '_top';
?>
	<form action="<?php echo hikashop_currentURL();?>" method="post" name="adminForm_<?php echo $this->params->get('main_div_name').$this->category_selected;?>_top">
		<div class="hikashop_subcategories_pagination hikashop_subcategories_pagination_top">
		<?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
		<span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>
		</div>
		<input type="hidden" name="filter_order_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->value; ?>" />
		<input type="hidden" name="filter_order_Dir_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->dir; ?>" />
		<?php echo JHTML::_('form.token'); ?>
	</form>
<?php } ?>
	<div class="hikashop_subcategories">
<?php

$app = JFactory::getApplication();
$in_hikashop_context = (JRequest::getString('option') == HIKASHOP_COMPONENT && in_array(JRequest::getString('ctrl','category'), array('category', 'product')));
$cid = 0;
$last_category_selected = 0;
if($in_hikashop_context) {
	if(JRequest::getString('ctrl','category') == 'product' && JRequest::getString('task','listing') == 'show') {
		$last_category_selected = (int)$app->getUserState(HIKASHOP_COMPONENT.'.last_category_selected', 0);
		$config =& hikashop_config();
		$pathway_sef_name = $config->get('pathway_sef_name', 'category_pathway');
		$cid = JRequest::getInt($pathway_sef_name, 0);
	} else {
		$cid = JRequest::getInt('cid', 0);
	}
}

$only_if_products = $this->params->get('only_if_products', 0);
switch($this->params->get('child_display_type')){
	case 'nochild':
	default:
?>
	<ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>">
<?php
		$width = 0;
		if((int)$this->params->get('columns', 0) > 0)
			$width = (int)(100 / (int)$this->params->get('columns'));
		if(empty($width))
			$width = '';
		else
			$width = 'style="width:' . (int)$width . '%;"';

		$found = 0;
		if($in_hikashop_context) {
			$found = $last_category_selected;
			foreach($this->rows as $row) {
				if($cid == $row->category_id) {
					$found = (int)$row->category_id;
					$app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected', (int)$row->category_id);
					break;
				}
			}
		}

		foreach($this->rows as $row) {
			if($only_if_products && $row->number_of_products < 1)
				continue;

			$link = $this->getLink($row);
			$class = ($found == $row->category_id) ? ' current active' : '';
?>
		<li class="hikashop_category_list_item<?php echo $class; ?>" <?php echo $width; ?>>
			<a href="<?php echo $link; ?>"><?php
				echo $row->category_name;
				if($this->params->get('number_of_products', 0)) {
					echo ' (' . $row->number_of_products . ')';
				}
			?></a>
		</li>
<?php
		}
?>
	</ul>
<?php
		break;

	case 'allchildsexpand':
		if($this->params->get('ul_display_simplelist', 0)) {
?>
	<ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>">
<?php
			foreach($this->rows as $k => $row) {
				if($only_if_products && $row->number_of_products < 1)
					continue;

				$found = 0;
				if($in_hikashop_context) {
					$found = $last_category_selected;
					if($cid == $row->category_id) {
						$found = (int)$row->category_id;
						$app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected', (int)$row->category_id);
					}
				}

				$link = $this->getLink($row);
				$class = ($found == $row->category_id) ? ' current active' : '';

?>
		<li class="hikashop_category_list_item<?php echo $class; ?>">
			<a href="<?php echo $link; ?>"><?php
				echo $row->category_name;
				if($this->params->get('number_of_products', 0))
					echo ' (' . $row->number_of_products . ')';
			?></a>
<?php
				// DISPLAY SUB CATEGORIES
				if(!empty($row->childs)) {
					$limit = $this->params->get('child_limit');
					$i = 0;
?>			<ul>
<?php
					foreach($row->childs as $child) {
						if($only_if_products && $child->number_of_products < 1)
							continue;
						if(!empty($limit) && $i >= $limit) {
							break;
						}
						$i++;
						$link = $this->getLink($child);
						$class = ($found == $child->category_id) ? ' current active' : '';
?>
				<li class="hikashop_category_list_item<?php echo $class; ?>">
					<a href="<?php echo $link; ?>"><?php
						echo $child->category_name;
						if($this->params->get('number_of_products', 0))
							echo ' (' . $child->number_of_products . ')';
					?></a>
				</li>
<?php
					}
?>
			</ul>
<?php
				}
?>
		</li>
<?php
			}
?>
	</ul>
<?php
		} else {
?>
	<div id="category_panel_<?php echo $this->params->get('id');?>" class="pane-sliders">
<?php
			foreach($this->rows as $k => $row) {
				if($only_if_products && $row->number_of_products < 1)
					continue;
				if($this->params->get('number_of_products', 0)) {
					$row->category_name .= ' (' . $row->number_of_products . ')';
				}

				if(!$this->module || $this->params->get('links_on_main_categories')){
					$link = $this->getLink($row);
					$row->category_name = '<a href="' . $link . '">' . $row->category_name . '</a>';
				}
?>
		<div class="panel">
			<h4 class="jpane-toggler title" id="category_pane_<?php echo $k;?>" style="cursor:default;">
				<span><?php echo $row->category_name; ?></span>
			</h4>
			<div class="jpane-slider content">
				<ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>">
<?php
				if(!empty($row->childs)) {
					$app = JFactory::getApplication();

					$found = '';
					if($in_hikashop_context) {
						foreach($row->childs as $child) {
							if($cid == $child->category_id) {
								$found = (int)$child->category_id;
								$app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected', (int)$child->category_id);
								break;
							}
						}
					}

					$limit = $this->params->get('child_limit');
					$i = 0;
					foreach($row->childs as $child) {
						if($only_if_products && $child->number_of_products < 1)
							continue;
						if(!empty($limit) && $i >= $limit)
							break;

						$i++;
						$link = $this->getLink($child);
						$class = ($found == $child->category_id) ? ' current active' : '';
?>
					<li class="hikashop_category_list_item<?php echo $class; ?>">
						<a href="<?php echo $link; ?>"><?php
							echo $child->category_name;
							if($this->params->get('number_of_products', 0)) {
								echo ' (' . $child->number_of_products . ')';
							}
						?></a>
					</li>
<?php
						}
				} else {
					echo JText::_('HIKA_LISTING_LIST_EMPTY');
				}
?>
				</ul>
			</div>
		</div>
<?php
			}
?>
	</div>
<?php
		}
		break;

	case 'allchilds':
		$found = -1;
		$sub_selected = -1;
		if($in_hikashop_context) {
			if(JRequest::getString('ctrl', 'category') == 'product' && JRequest::getString('task', 'listing') == 'show' && empty($cid)) {
				$database = JFactory::getDBO();
				$query = 'SELECT category_id FROM '.hikashop_table('product_category').' WHERE product_id = ' . (int)hikashop_getCID('product_id') . ' ORDER BY product_category_id ASC';
				$database->setQuery($query);
				$cid = $database->loadResult();
				if(empty($cid)) {
					$class = hikashop_get('class.product');
					$product = $class->get(hikashop_getCID('product_id'));
					if($product && $product->product_type == 'variant' && $product->product_parent_id) {
						$query = 'SELECT category_id FROM '.hikashop_table('product_category').' WHERE product_id = ' . (int)$product->product_parent_id . ' ORDER BY product_category_id ASC';
						$database->setQuery($query);
						$cid = $database->loadResult();
					}
				}
			}

			$i = 0;
			foreach($this->rows as $k => $row) {
				if($only_if_products && $row->number_of_products < 1)
					continue;
				if((int)$row->category_id == $cid) {
					$found = $i;
					break;
				}
				if(!empty($row->childs)) {
					foreach($row->childs as $child) {
						if($child->category_id == $cid) {
							$found = $i;
							$sub_selected = $row->category_id;
							break 2;
						}
					}
				}
				$i++;
			}

			$app = JFactory::getApplication();
			if($found >= 0) {
				$app->setUserState(HIKASHOP_COMPONENT.'.last_category_selected', $found);
			} elseif(JRequest::getString('ctrl', 'category') != 'category' || JRequest::getString('task','listing') != 'listing') {
				$found = (int)$last_category_selected;
			}
		} else {
			$cid = 0;
		}

		if($this->params->get('ul_display_simplelist', 0)) {
?>
	<ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>">
<?php
			foreach($this->rows as $k => $row) {
				if($only_if_products && $row->number_of_products < 1)
					continue;

				$link = $this->getLink($row);
				$class = ($cid == $row->category_id) ? ' current active' : '';

?>
		<li class="hikashop_category_list_item<?php echo $class; ?>">
			<a href="<?php echo $link; ?>"><?php
				echo $row->category_name;
				if($this->params->get('number_of_products', 0))
					echo ' (' . $row->number_of_products . ')';
			?></a>
<?php
				// DISPLAY SUB CATEGORIES
				if(!empty($row->childs)) {
					$sub_selected = false;
					if($cid != $row->category_id) {
						foreach($row->childs as $child) {
							if($cid == $child->category_id) {
								$sub_selected = true;
								break;
							}
						}
					}

					if($cid == $row->category_id || $sub_selected == $row->category_id) {
						$limit = $this->params->get('child_limit');
						$i = 0;
?>			<ul>
<?php
						foreach($row->childs as $child) {
							if($only_if_products && $child->number_of_products < 1)
								continue;
							if(!empty($limit) && $i >= $limit)
								break;
							$i++;
							$link = $this->getLink($child);
							$class = ($found == $child->category_id) ? ' current active' : '';
?>
				<li class="hikashop_category_list_item<?php echo $class; ?>">
					<a href="<?php echo $link; ?>"><?php
						echo $child->category_name;
						if($this->params->get('number_of_products', 0))
							echo ' (' . $child->number_of_products . ')';
					?></a>
				</li>
<?php
						}
?>
			</ul>
<?php
					}
				}
?>
		</li>
<?php
			}
?>
	</ul>
<?php
		} else {
			jimport('joomla.html.pane');
			$this->tabs = hikashop_get('helper.sliders');
			$this->tabs->setOptions(array(
				'startOffset' => $found,
				'startTransition' => 0,
				'displayFirst' => 0
			));
			echo $this->tabs->startPane('category_panel_'.$this->params->get('id'));
			foreach($this->rows as $k => $row) {
				if($only_if_products && $row->number_of_products < 1)
					continue;
				if($this->params->get('number_of_products', 0)) {
					$row->category_name .= ' (' . $row->number_of_products . ')';
				}

				if( !$this->module || $this->params->get('links_on_main_categories') || empty($row->childs)) {
					$link = $this->getLink($row);
					$row->category_name = '<a href="'.$link.'">'.$row->category_name.'</a>';
				}

				// Allow to open the slider of the currently displayed category
				$toOpen = false;

				// Get the category id for category listing
				$cid = hikashop_getCid();

				// Get categories from product page
				if(JRequest::getVar('ctrl','category') == 'product' && JRequest::getVar('task','listing') == 'show'){
					$productClass = hikashop_get('class.product');
					$cid = $productClass->getCategories(hikashop_getCid());
				}

				// Get main category from product listing
				if(empty($cid)){
					if(!HIKASHOP_J30){
						$menuClass = hikashop_get('class.menus');
						$menuData = $menuClass->get($this->params->get('itemid',0));
						if(@$menuData->hikashop_params['content_type']=='product' && isset($menuData->hikashop_params['selectparentlisting']))
							$cid = $menuData->hikashop_params['selectparentlisting'];
					}else{
						$app = JFactory::getApplication();
						$menuItem = $app->getMenu()->getActive();
						if(is_object($menuItem)){
							$hkParams = $menuItem->params->get('hk_product',false);
							if(isset($hkParams->category))
								$cid = $hkParams->category;
						}
					}
				}
				if(!is_array($cid))
					$cid = array($cid);

				if(in_array($row->category_id,$cid))
					$toOpen = true;

				if(!empty($row->childs)) {
					foreach($row->childs as $child) {
						if(in_array($child->category_id,$cid))
							$toOpen = true;
					}
				}

				echo $this->tabs->startPanel($row->category_name, 'category_pane_'.$k, !empty($row->childs), $toOpen);
				if(!empty($row->childs)) {
?>
		<ul class="hikashop_category_list<?php echo $this->params->get('ul_class_name'); ?>">
<?php
					foreach($row->childs as $child) {
						if($only_if_products && $child->number_of_products < 1)
							continue;
						$class = ($cid == $child->category_id) ? ' current active' : '';
						$link = $this->getLink($child);
?>
			<li class="hikashop_category_list_item<?php echo $class; ?>">
				<a class="hikashop_category_list_item_link" href="<?php echo $link; ?>"><?php
					echo $child->category_name;
					if($this->params->get('number_of_products', 0))
						echo ' (' . $child->number_of_products . ')';
				?></a>
			</li>
<?php
					}
?>
		</ul>
<?php
				} else {
					echo JText::_('HIKA_LISTING_LIST_EMPTY');
				}
				echo $this->tabs->endPanel();
			}
			echo $this->tabs->endPane();
		}
		break;
	}
?>
	</div>
<?php
if(in_array($pagination,array('bottom','both')) && $this->params->get('show_limit') && $this->pageInfo->elements->total > $this->pageInfo->limit->value) {
	$this->pagination->form = '_bottom';
?>
	<form action="<?php echo hikashop_currentURL();?>" method="post" name="adminForm_<?php echo $this->params->get('main_div_name').$this->category_selected;?>_bottom">
		<div class="hikashop_subcategories_pagination hikashop_subcategories_pagination_bottom">
		<?php echo $this->pagination->getListFooter($this->params->get('limit')); ?>
		<span class="hikashop_results_counter"><?php echo $this->pagination->getResultsCounter(); ?></span>
		</div>
		<input type="hidden" name="filter_order_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->value; ?>" />
		<input type="hidden" name="filter_order_Dir_<?php echo $this->params->get('main_div_name').$this->category_selected;?>" value="<?php echo $this->pageInfo->filter->order->dir; ?>" />
		<?php echo JHTML::_('form.token'); ?>
	</form>
<?php }
Also, check whether it works with either the "Display in simplelist" activated or not in the settings of the module as that could also influence the result.

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

  • Posts: 220
  • Thank you received: 8
8 years 10 months ago #251662

Hi Nicolas,

Alas, your override of category/listing_list.php doesnot help.

Also the module setting Display in simplelist doesnot help.

However an override containing the 2.6.0 version of category/listing_list.php does help! Now classes curent active are present!
Subsequent changes in this file cause the problem.

Regards,
Udo

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

  • Posts: 84233
  • Thank you received: 13675
  • MODERATOR
8 years 10 months ago #251672

Hi,

I don't have the problem on my end with the new version of the file.
So I can't reproduce.
Please provide a link to the page with the issue, a backend access, a FTP access and a link to this thread via our contact form so that we can have a deeper look into it.
www.hikashop.com/support/contact-us.html

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

  • Posts: 220
  • Thank you received: 8
8 years 10 months ago #252260

Hi,
Today (12 Oct) I installed the latest 2.6.4 package and now the bug is gone, active subcategory classes "current active" are here again.
Thanks for your help!

regards,
Udo

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

Time to create page: 0.081 seconds
Powered by Kunena Forum