Magento 1.7 – How to Change Product Button URL on Home Page

magento-1.7producturl

I originally asked this question on stackoverflow, but was scolded a bit and rated down. I didn't realize there is now an entire Magento section, but now that I do this is clearly a more appropriate place to ask this question.

So, I know this is probably a simple question with an obvious answer… But my knowledge is pretty limited here. Anyway, all I'm trying to do is make the Product button I have in the top menu of my home page for my store link to a specific URL. So basically, right now, if you hover over the Products button you get a drop down of product categories (which is fine), but if you click on the actual Products button itself, it simply links back to the homepage. I'd like to link it to a Products landing page that I've created instead.

How do I achieve this? For reference, my site is: http://www.soundcherry.com.

The code that I THINK I need to edit is here: public_html/app/design/frontend/default/(the template I'm using)/template/catalog/navigation/top.phtml

And the code looks like:

<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
<div class="nav-container">
<ul id="nav">
<li><a href="<?php echo $this->getUrl() ?>"><?php echo $this->__('Home') ?></a></li>
<li><a href="<?php echo $this->getUrl('') ?>"><?php echo $this->__('') ?></a>
<?php if($_menu): ?>
    <ul>
        <?php echo $_menu ?>
    </ul>
<?php endif ?>
</li>
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('menu')->toHtml(); ?>

I'm not sure what to change, though. Or, even if this is the correct code to edit. Any help will be greatly appreciated!

Best Answer

I don't know the page you want the Products menu item to point, but let's say that the page url identifier is products.
You need to change the line under the homepage link

<li><a href="<?php echo $this->getUrl('') ?>"><?php echo $this->__('') ?></a>

(I assume that in the line above <?php echo $this->__('') ?> should actually be <?php echo $this->__('Products') ?>).

to this:

<li><a href="<?php echo $this->getUrl('', array('_direct'=>'products')) ?>"><?php echo $this->__('Products') ?></a>
Related Topic