3

I would like to know how to move my cart icon into my navigation instead of the header. How can I do this?

0

First you will have to remove the original cart link from the top links.

Edit (or create) app/design/frontend/<your_package>/<your_theme>/layout/local.xml and add the following code under the <default> layout handle:

<reference name="top.links">
    <remove name="checkout_cart_link"/>

     <!-- To re-add 'Checkout' after removing both -->
     <block type="checkout/links" name="checkout_link_custom">
         <action method="addCheckoutLink"></action>
     </block>
</reference>

<reference name="catalog.topnav">
     <block type="page/template_links" name="catalog.links">
         <block type="checkout/links" name="cart_link_custom">
             <action method="addCheckoutLink"></action>
         </block>
     </block>
</reference>

The problem at this point is that the template that renders the menu does not automatically display the child blocks so you will have to create (or edit) app/design/frontend/<your_package>/<your_theme>/template/page/html/topmenu.phtml with the following code:

<?php $_menu = $this->getHtml('level-top') ?>

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

<?php echo $this->getChildHtml('catalog.links'); ?>

If you want to add the cart link before the menu then move <?php echo $this->getChildHtml('catalog.links'); ?> at the top of the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.