Show Paging Heading global menu value not working

  • Posts: 274
  • Thank you received: 5
  • Hikashop Business
9 years 5 months ago #236664

-- url of the page with the problem -- : test server
-- HikaShop version -- : 2.6.2
-- Joomla version -- : 3.4.8

Changing the global value for show_page_heading makes no difference when viewing Hikashop categories. Instead on Joomla article pages and contacts it shows or not depending on the setting.

I have created a Hikashop category menu item and set the page display value to "Use Global". I have then changed the global value in Menus Options to Show Page Heading "Yes". The page heading does not show.

The only way I can set the show_page_heading is by changing this value at menu item level. Changing from Use Global to Yes makes it show correctly.

I have disabled any template overrides to if that was the problem and I have read the following forum thread put it did not answer my problem

I have also tried this on clean and install and I get the same result

Last edit: 9 years 5 months ago by jameswadsworth.

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

  • Posts: 84308
  • Thank you received: 13701
  • MODERATOR
9 years 5 months ago #236709

Hi,

Yes, the "use global" choice is not supported for now.
We're going to add that in the next version of HikaShop.
In the mean that, you can change the code:

if(version_compare(JVERSION,'1.6','<')){
	$title = 'show_page_title';
}else{
	$title = 'show_page_heading';
}
$titleType = 'h1';
if($this->module){
	$title = 'showtitle';
	$titleType = 'h2';
}

if($this->params->get($title)
to:
$titleType='h1';
if(version_compare(JVERSION,'1.6','<')){
	$title = $this->params->get('show_page_title');
}elseif($this->module){
	$title = $this->params->get('showtitle');
	$titleType='h2';
}else{
	$title = (string) $this->params->get('show_page_heading');
	if($title===''){
		$params = JComponentHelper::getParams( 'com_menus' );
		$title = $params->get('show_page_heading');
	}
}

if($title
in the file 'listing' of the views product and category via the menu Display>Views and that will add that support.

The following user(s) said Thank You: jameswadsworth

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

  • Posts: 274
  • Thank you received: 5
  • Hikashop Business
9 years 5 months ago #236812

Hi Nicolas,

cut and paste your solution and now the global value for the page title is working!!!

Thanks, James

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

  • Posts: 274
  • Thank you received: 5
  • Hikashop Business
9 years 4 months ago #237305

I have been testing with the global value 'show_page_heading' set to on and I have run into an issue for which I cannot find a solution. We have the following structure

Parent Category
Child Cat1 - Child Cat2 - Child Cat 3

There aren't any products in the Parent Category, just in the child categories. We have created a category listing menu link to the Parent category, and under the products options we have set Sub elements filter to 'Group by Category'. We have created product listing menu links to each of the child categories.

If you click the link to the parent category the show page heading shows before the sub categories and then underneath we have the products in the grouped together, each with the category title.

If you clicked the menu link to chilld category originally there were two titles, the page heading and the category name. We solved this problem by modifying the product listing page from

<h2><?php echo $category['category']->category_name; ?></h2>
to
if (!$title)
{
      echo '<h2>'.$category['category']->category_name .'</h2>';
}
And the the product listing works as wanted.

However if you start off in the parent category listing and click one of the contained links to a child category there is always the page heading plus the category name. I have tried with different values to hide the category name, however it is hidden in this view, it is also hidden in the parent category listing view.

I want when viewing the parent category, which has children categories, the child categories have titles, but when viewing the child as a category listing, in that they don't have any child categories themselves, you can hide the category name and use the page heading.

Is it possible when in a category listing view to find if the category viewed has any child categories or not?

Last edit: 9 years 4 months ago by jameswadsworth.

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

  • Posts: 274
  • Thank you received: 5
  • Hikashop Business
9 years 4 months ago #237389

Okay I have found a solution that seems to working. In the product listing.php file I modified the line

<h2><?php echo $category['category']->category_name; ?></h2>
to
if (!$title && $category['category']->category_id != JRequest::getVar('cid'))
{
	echo '<h2>'.$category['category']->category_name .'</h2>';
}

Now the category name shows when it is a sub-category or when the show_page_heading is not set or 0.

p.s. the product/listing.php uses superglobals such as @$_REQUEST=='listing' in line 220. It would be more secure to use JRequest::getVar('task')=='listing'

Last edit: 9 years 4 months ago by jameswadsworth.

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

  • Posts: 84308
  • Thank you received: 13701
  • MODERATOR
9 years 4 months ago #237313

Hi,

Well, that should not be necessary.
In the title, you get the name of the main category of the listing.
And this line is for the display of the name of the sub category of each group of products on the products listing.

@$_REQUEST['task']=='listing'
is perfectly secure.
Using instead JRequest::getVar('task')=='listing' just uses more processing for no reason.
Directly using $_REQUEST is indeed a bad idea when the variable is used for a MySQL query, or when you pass it from one function to another and that it might be used in the future in a MySQL query, creating a security issue.
Here, there is no reason to use JRequest::getVar instead of $_REQUEST.

Last edit: 9 years 4 months ago by nicolas.

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

  • Posts: 274
  • Thank you received: 5
  • Hikashop Business
9 years 4 months ago #237503

I now have the headers showing as wanted with the modification I made in the previous post. I have been unable to do otherwise just with the settings alone.

Thanks for the elaboration about the use of superglobals.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum