1
votes

I am using Magento 1.9.
My top menu contains categories as menu items.
I have managed to open static CMS page when clicked on menu item (i.e. category) by adding custom URL rewrite rule from admin panel.
How I can add menu item with external link to it so that page will get redirected to other website when clicked on menu item.
My Magento website is going to be under subdoamin and external link will be of main doamin.

Magento site will be hosted on http://domain.xyz.dom/ and I need to redirect to http://www.xyz.dom/abc when clicked on menu item.

2

2 Answers

5
votes

The way you added cms page in "URL Rewrite Management" you can add external url too.

Create a category, in my case category ID is 3
Add a new URL Rewrite from URL rewrite management

Enter ID Path: category/3
Enter Request Path: catalog/category/view/id/3
Enter your external url in "Target Path"

0
votes

There can be two ways of redirecting the way you are trying.

  1. From Cateagory Url rewrite management which i guess you have tried so far.
  2. Another way is little messy but it will work you just have to add a static link on the template file.

I mean go to the file

app/design/frontend/your_package/your_theme/template/page/html/topmenu.phtml

you will see some code like this

<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
    <nav id="nav">
        <ol class="nav-primary">            
            <?php echo $_menu ?>
        </ol>
    </nav>
<?php endif ?>

I have replaced this to add a home page link on the menu see below.

<?php $_menu = $this->getHtml('level-top') ?>
<?php $baseUrl = Mage::getBaseUrl();?>
<?php $currentUrl = Mage::helper('core/url')->getCurrentUrl();?>

<?php if($_menu): ?>
    <nav id="nav">
        <ol class="nav-primary">
            <li class="level0 nav-1 <?php if($baseUrl==$currentUrl){echo 'active';}?>"><a href="<?php echo $baseUrl;?>">Home</a></li>
            <?php echo $_menu ?>
        </ol>
    </nav>
<?php endif ?>

In this way you can add your link.

Hope this helps. Happy Coding!!