How do I add links to the top menu in Magento? - magento

I want to modify the top level menu using code. I want it to a show list of pages in top level. How is it possible?

You can modify this file '\app\design\frontend\yourtheme\template\page\html\topmenu.phtml' and add custom code there to show list of pages.

`<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>

Related

Sort new products in product via page

When I go now to the product page the old products ar at the top and the arrow pointing downwards but it the arrow have to pointing to the top so that the new products are the first to show.
See printshot: https://gyazo.com/712c7cfa33e237cda3ce8c91045e4916
Best regards,
Michel
You can set the default direction via xml layout.
In your local.xml
<layout>
<catalog_category_default>
<reference name="product_list_toolbar">
<action method="setDefaultDirection"><string>asc</string></action>
<action method="setDefaultOrder"><string>name</string></action>
</reference>
</catalog_category_default>
<catalog_category_layered>
<reference name="product_list_toolbar">
<action method="setDefaultDirection"><string>asc</string></action>
<action method="setDefaultOrder"><string>name</string></action>
</reference>
</catalog_category_layered>
And this would set your arrow direction in ascending order by default on your toolbar. (Also you can set the default order for your sort as you can see on layout above)

magento add column after product tab in product view page

I am creating a custom module and want to add another tab after product description tab in product detail page. Below is my xml code for execute:
<catalog_product_view>
<reference name="product.description">
<block type="testimonial/monblock" name="stockas">
<action method="setTemplate">
<template>testimonial/viewMore.phtml</template>
</action>
</block>
</reference>
</catalog_product_view>
But it shows under price column. I want to show it under product details tab.
Any one please help me.
Just add this code after Description block in catalog.xml files
<block type="testimonial/monblock" name="stockas">
<action method="setTemplate">
<template>testimonial/viewMore.phtml</template>
</action>
</block>
you can add in the above way for any number of tabs needed hope this helps.

How to show My Cart link at top links

I installed a template, and there is no My Cart link at top link.
This in checkout.xml:
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
I want to show it with item quantity ex: My Cart(1)
Please help me!
Best regards,
One way you can do this is within the template file add this code:
$count = $this->helper('checkout/cart')->getSummaryCount();
This will display the number of items in the cart. If you copy the template and layout files into your theme you should be able to add this in and get it working.

Renaming links from top menu using local.xml?

In the default checkout.xml there is:
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
Eg: I want to rename My Cart, My Cart(1) to Current order, Current order(1) respectively.
You can find your translation files here "/app/locale/YOUR_LANGUAGE". To change the top links menu, you have to open "mage_checkout.csv".

Adding image in Magento via update layout

I'm trying to figure out how to add images, etc. to the left sidebar portion of a 2 column with left sidebar page in Magento using the layout update in the cms ->page->design portion of the admin area.
Is it possible to do this from the update layout xml area? If not, could you explain how to create a module (or whatever else would be required).
Thanks.
If you look in base/default/layout/catalog.xml, you will see an example of using a template with an image placeholder that can be specified in your Update Layout XML area:
<reference name="left">
<block type="core/template" name="left.permanent.callout" template="callouts/left_col.phtml">
<action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (555) 555-0123.</alt></action>
<action method="setLinkUrl"><url>checkout/cart</url></action>
</block>
</reference>
So, in your Update Layout XML, you would write something like:
<reference name="left.permanent.callout"> <!-- match this to the block name from above -->
<action method="setImgSrc"><src>images/media/my_file_name.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Some text here</alt></action>
<action method="setLinkUrl"><url>your/path</url></action>
</reference>
You can adapt that by taking a copy of the template file left_col.phtml and making changes as you wish.

Resources