Jump to content

[SOLVED] Problem with blocktopmenu custom link and name


Recommended Posts

I've searched in this forum for a while now but didn't find any conclusion to my problem.

 

For easier understanding here a link to my shop: artwave.lacerta.uberspace.de/en/

 

In the CMS i added a sub cms-category named "social" and added 2 cms pages "social stream" and "videos" to that category. Then i added the supcategory to the blocktopmenu.

 

The problem is, when you click on "social" directly you are directed to a category page with just this content:

---------------------------

SOCIAL

List of pages in Social:

  • Social stream
  • Videos

-----------------------------

First of all, how can I change the content of that page ?

Is it possible to change the of "social" ?

And is it possible to rename just the title shown in the menu without chanigng the name of the cms category ?

 

What I wanted to do is, to change the title displayed in the menu from "social" to "artwave" and link to the index page without changing the cms-category name?

 

Thanks for your help!

Edited by vekia (see edit history)
Link to comment
Share on other sites

SOCIAL is an category, you cant edit it.

if you want to change name of this page without changing category name, you have to modify blocktopmenu.php file

 

it will be a bit hard if you don't know basics in php, anyway, you have to modify this:

		case 'CMS_CAT':
					$category = new CMSCategory((int)$id, (int)$id_lang);
					if (count($category))
					{
						$this->_menu .= '<li><a href="'.Tools::HtmlEntitiesUTF8($category->getLink()).'">'.$category->name.'</a>';
						$this->getCMSMenuItems($category->id);
						$this->_menu .= '</li>'.PHP_EOL;
					}
					break;

add there if condition to check category id, if id== id of SOCIAL - instead of $category->name use own name 

  • Like 1
Link to comment
Share on other sites

tha_phu, one alternative might be to set 'Social' as a CMS Page, not a CMS category. Then you can include the links to the other CMS pages within it, and also edit the content to your requirements. The only downside is that you wouldn't get the other CMS pages appearing as a dropdown when you hover on Social in the horizontal menu.

 

Another idea. I don't know much about php really, but looking at Vekia's code snippet above, I wonder if you could just remove

     href="'.Tools::HtmlEntitiesUTF8($category->getLink()).'"

so that if you have a CMS category in the top menu, it doesn't link to anywhere. You'd therefore have to select the other CMS pages from the dropdown. I don't know if that's feasible, though, perhaps just try it in a test shop.

 

Cheers, Dave 

  • Like 1
Link to comment
Share on other sites

Thanks a lot for your suggestions, vekia & scotty cabanas!

 

@vekia: I tried to modify the code as you described but it does not work.... what am I doing wrong?

case 'CMS_CAT':
					$category = new CMSCategory((int)$id, (int)$id_lang);
					if ($id == 2)
					{
						$this->_menu .= '<li><a href="'.artwave.lacerta.uberspace.de.'">'.Artwave.'</a>';
						$this->getCMSMenuItems($category->id);
						$this->_menu .= '</li>'.PHP_EOL;
					}
					if (count($category))
					{
						$this->_menu .= '<li><a href="'.htmlentities($category->getLink()).'">'.$category->name.'</a>';
						$this->getCMSMenuItems($category->id);
						$this->_menu .= '</li>'.PHP_EOL;
					}
					break;
Link to comment
Share on other sites

Thanks a lot for the hint with the cache!

 

I got it nearly working the way i want it to. Thank you very much so far!

I've got just one little Problem. The link is wrong, when you click on Artwave - you are staying on the page you are.

But it should be a link to artwave.lacerta.uberspace.de How do I do that ?

case 'CMS_CAT':
					$category = new CMSCategory((int)$id, (int)$id_lang);
					if ($id == 2)
					{
						$this->_menu .= '<li><a href="'."".'">'.Artwave.'</a>';
						$this->getCMSMenuItems($category->id);
						$this->_menu .= '</li>'.PHP_EOL;
					}
					if (count($category))
					{
						if ($id == 2)
							{
							}
						else
						{
						$this->_menu .= '<li><a href="'.htmlentities($category->getLink()).'">'.$category->name.'</a>';
						$this->getCMSMenuItems($category->id);
						$this->_menu .= '</li>'.PHP_EOL;
						}
					}
					break;
Link to comment
Share on other sites

×
×
  • Create New...