Close

How do I add a linkto another web site to Mega Menu? version 3.6

chrisADK
8 years ago
#10494 Quote
Avatar
  • 19
Hi,
I need to add a link to another store on the right hand side of the the mega menu. Don't really understand the synthax for cshtml so not sure where in the MegaMenu.cshtml file I should put this.
This is the format I need the link to be.
<a href="http://www.store1.com" target="_blank">Store1</a>

Any help would be greatly appreciated.

Thanks Chris
Deni
8 years ago
#10497 Quote
Avatar
  • Moderator
  • 389
chrisADK wrote:
Hi,
I need to add a link to another store on the right hand side of the the mega menu. Don't really understand the synthax for cshtml so not sure where in the MegaMenu.cshtml file I should put this.
This is the format I need the link to be.
<a href="http://www.store1.com" target="_blank">Store1</a>

Any help would be greatly appreciated.

Thanks Chris


Hi, 

For example find this code:
if (Model.Settings.IncludeForumLink)
{
  <li>
    <a href="@Url.RouteUrl("Boards")" title="@T("Forum.Forums")">@T("Forum.Forums")</a>
  </li>
}


and right after it add your code. But it should follow this structure:

<li>
  <a href="http://www.store1.com" title="Store1" target="_blank">Store1</a>
</li>


I hope this helped !
Best Regards,
Mladen Staykov
Nop-Templates.com
chrisADK
8 years ago
#10500 Quote
Avatar
  • 19
Hi,
Excellent that worked thanks. Is there anyway to make this work with a multi-store site? So that the link is different on each site? Basically need to have a link that points to the other store for both sites.
Like maybe can I put the link in the Motion themes custom CSS per store maybe? Tried but could not figure out the right syntax to use or it does not work.

Thanks Chris


Deni
8 years ago
#10502 Quote
Avatar
  • Moderator
  • 389
chrisADK wrote:
Hi,
Excellent that worked thanks. Is there anyway to make this work with a multi-store site? So that the link is different on each site? Basically need to have a link that points to the other store for both sites.
Like maybe can I put the link in the Motion themes custom CSS per store maybe? Tried but could not figure out the right syntax to use or it does not work.

Thanks Chris


Hi, 

If you want to make the two sites to show links to each other, then your code should look like this:

if (Nop.Core.Infrastructure.EngineContext.Current.Resolve<Nop.Core.IStoreContext>().CurrentStore.Id == 1)
{
  <li>
    <a href="http://www.store2.com" title="Store 2" target="_blank">Store 2</a>
  </li>
}
else
{
  <li>
    <a href="http://www.store1.com" title="Store 1" target="_blank">Store 1</a>
  </li>
}


I hope this helped !
Best Regards,
Mladen Staykov
Nop-Templates.com