Jump to content

[SOLVED] Change home category to 'new products' link


Recommended Posts

that's right, there will be no dropdow with categories

so i assume that you want this dropdown, but only change link associated with first menu item?

 

That's right, at the moment the Home category goes to my front page, but I'm able to change the name of the category, but not the link. I'd like to change the link too and have the dropdown still work.

Link to comment
Share on other sites

hello

sorry for long waiting time, i missed you reply :(

in this case it's necessary to alter blocktopmenu.php file (located in module directory)

 

there is a code like:
 

if ($category['level_depth'] > 1)
			{
				$cat = new Category($category['id_category']);
				$link = Tools::HtmlEntitiesUTF8($cat->getLink());
			}
			else
				$link = $this->context->link->getPageLink('index');

change $link = $this->context->link->getPageLink('index'); to $link = $this->context->link->getPageLink('new-products');

  • Like 2
Link to comment
Share on other sites

hello

sorry for long waiting time, i missed you reply :(

in this case it's necessary to alter blocktopmenu.php file (located in module directory)

 

there is a code like:

 

if ($category['level_depth'] > 1)
			{
				$cat = new Category($category['id_category']);
				$link = Tools::HtmlEntitiesUTF8($cat->getLink());
			}
			else
				$link = $this->context->link->getPageLink('index');

change $link = $this->context->link->getPageLink('index'); to $link = $this->context->link->getPageLink('new-products');

This makes perfect sense, I've changed it like so:

 

private function generateCategoriesMenu($categories)

{
$html = '';
 
foreach ($categories as $key => $category)
{
if ($category['level_depth'] > 1)
{
$cat = new Category($category['id_category']);
$link = Tools::HtmlEntitiesUTF8($cat->getLink());
}
else
$link = $this->context->link->getPageLink('new-products');
 

It isn't changing on the site, unfortunately! Do I need to do something else in addition to uploading the changed .php file?

Link to comment
Share on other sites

now it's time to re-save settings in your block top menu page

just open top menu configuration page and hit save button (you don't have to change anything, just save settings)

Ahh, I just experimented with the cache settings, and deleting the cache worked, I'll remember to just save settings in the module to trigger a clear cache, thanks so much for your help!!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...