Magento - Add target to new link on toplinks - magento

I add new link to top links using
<block type="page/template_links" name="top.links" as="topLinks">
<action method="addLink" translate="label title">
<label>Blog</label>
<url>/blog</url>
<title>Blog</title>
<prepare/>
<urlParams/>
<position>1</position>
</action>
</block>
It works properly.
I want to add target="_blank" to this link.
Is there any way to do this?
Thank you.

<block type="page/template_links" name="top.links" as="topLinks">
<action method="addLink" translate="label title">
<label>Blog</label>
<url>/blog</url>
<title>Blog</title>
<prepare/>
<urlParams/>
<position>1</position>
<aParams>
<target>_blank</target>
</aParams>
</action>
</block>
Your welcome! Feel free to have a look at the addLink() method at any time!

Related

How to Add Links to Magento Default Footer

I've reviewed several tutorials on creating your own custom footer in Magento but none relating to adding links to the default footer. I am wanting to add a few links under the "Account" div of the Magento default footer. Here's what I have in app/design/frontend/rwd/default/layout/customer.xml:
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
<action method="addLink" translate="label title before_text" module="customer"><label>Register</label><url helper="customer/getRegisterUrl" /><title>Register</title><prepare/><urlParams/><position>100</position><li/><a/></action>
</reference>
<reference name="footer_links2">
<action method="addLink" translate="label title" module="catalog"><label>My Account</label><url helper="customer/getAccountUrl" /><title>My Account</title></action>
<action method="addLink" translate="label title"><label>Customer Service</label><url helper="/customer-service/" /><title>Customer Service</title><prepare>true</prepare></action>
</reference>
</default>
You can use below code for add link in footer.your code is almost right but you made mistake in reference name make you sure that reference name footer_links
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalog"><label>My Account</label><url helper="customer/getAccountUrl" /><title>My Account</title></action>
<action method="addLink" translate="label title"><label>Customer Service</label><url helper="/customer-service/" /><title>Customer Service</title><prepare>true</prepare></action>
</reference>

Magento SIngle Column Layout for Customer Account Dashboard

I am trying to convert the 2 column layout of my account pages in Magento to a 1 column layout. I do not have any need to the navigation links on the left column. I am using Magento 1.9.0.1 and have very limited programming experience.
I have been told by the theme developer that I need to customize my local.xml file.
I have also found another thread on this site - Magento set customer my account layout to one column which suggests I should be looking at the <customer_account> handle.
Is anyone able to tell me what changes I need to make to to this file? Below is what I believe to be the relevant section of the local.xml file.
Thanks!
<customer_account>
<reference name="left">
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
<action method="unsetChild"><name>cart_sidebar</name></action>
<action method="unsetChild"><name>reorder</name></action>
</reference>
</customer_account>
<customer_logged_in>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
<action method="addLink" translate="label title" module="customer">
<label>Log Out</label>
<url helper="customer/getLogoutUrl"/>
<title>Log Out</title>
<prepare/>
<urlParams/>
<position>100</position>
<liParams/>
<aParams>class="top-link-logout"</aParams>
</action>
</reference>
<reference name="left">
<block type="sales/reorder_sidebar" name="sale.reorder.sidebar" as="reorder" template="sales/reorder/sidebar.phtml"/>
</reference>
</customer_logged_in>
<customer_logged_out>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
<action method="addLink" translate="label title" module="customer">
<label>Log In</label>
<url helper="customer/getLoginUrl"/>
<title>Log In</title>
<prepare/>
<urlParams/>
<position>100</position>
<liParams/>
<aParams>class="top-link-login"</aParams>
</action>
</reference>
</customer_logged_out>
<customer_account_edit translate="label">
<reference name="left">
<action method="unsetChild"><name>cart_sidebar</name></action>
</reference>
</customer_account_edit>
Update your local.xml file as follows.
<customer_account_index translate="label">
<label>Customer My Account Dashboard</label>
<update handle="customer_account"/>
<!-- Mage_Customer -->
<reference name="root">
<action method="setTemplate">
<template>page/1column.phtml</template>
</action>
</reference>
<reference name="my.account.wrapper">
<block type="customer/account_dashboard" name="customer_account_dashboard" template="customer/account/dashboard.phtml">
<block type="customer/account_dashboard_hello" name="customer_account_dashboard_hello" as="hello" template="customer/account/dashboard/hello.phtml"/>
<block type="core/template" name="customer_account_dashboard_top" as="top" />
<block type="customer/account_dashboard_info" name="customer_account_dashboard_info" as="info" template="customer/account/dashboard/info.phtml"/>
<block type="customer/account_dashboard_newsletter" name="customer_account_dashboard_newsletter" as="newsletter" template="customer/account/dashboard/newsletter.phtml"/>
<block type="customer/account_dashboard_address" name="customer_account_dashboard_address" as="address" template="customer/account/dashboard/address.phtml"/></block>
</reference>
</customer_account_index>
Change is
<action method="setTemplate"><template>page/1column.phtml</template></action>

Magento - Change Top Link Label of existing link (login link)

The default magento template has a top link called "Login".
This is being output by the standard template customer.xml.
I did this in my local.xml, hoping to remove the current link "Login" and by readding the same link but with a different label "Login / Register"
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl" /></action>
<action method="addLink" translate="label title" module="customer"><label>Log In / Register</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
However now i have 2 links there displaying, one called "Login" and another called "Login / Register".
How can i properly change the label of a toplink in Magento?
Try this to remove
<default>
<reference name="top.links">
<action method="removeLinkByUrl">
<url helper="customer/getAccountUrl"/>
</action>
</reference>
</default>
add by this
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Log In / Register</label>
<url helper="customer/getLogInUrl"/>
<prepare/>
<urlParams/>
</action>
</reference>

Magento: Add product sorting features to left column

Is the default left column product/category feature a widget or block... the task I'm trying to perform is adding the Sorting Features to the left column of a custom page. I checked in my theme catalog.xml but I see no reference to that column.
the custom page was built without that feature added. im trying to add it back
Look for catalogsearch.leftnav in catalogsearch.xml inside the default theme.
You should copy that layout file to your custom theme and edit it in there.
edit:
Sorry, remembered wrong.
It's been configured in the catalog.xml in default template.
If you lost the files, download your current version and look up the configuration in there.
This should be the configuration in catalog.xml that you're looking for:
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- The following code shows how to set your own pager increments -->
<!--
<action method="setDefaultListPerPage"><limit>4</limit></action>
<action method="setDefaultGridPerPage"><limit>3</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
<action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action>
<action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
-->
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference>
</catalog_category_layered>

The js files from skin directory not loading in Magento

I am trying to use the magento for ecommerce.
In that i just added some js file which are held on the skin\frontend\default\mytheme\js.
This is my code:
<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs"><script>lib/ccard.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>scriptaculous/builder.js</script></action>
<action method="addJs"><script>scriptaculous/effects.js</script></action>
<action method="addJs"><script>scriptaculous/dragdrop.js</script></action>
<action method="addJs"><script>scriptaculous/controls.js</script></action>
<action method="addJs"><script>scriptaculous/slider.js</script></action>
<action method="addJs"><script>varien/js.js</script></action>
<action method="addJs"><script>varien/form.js</script></action>
<action method="addJs"><script>varien/menu.js</script></action>
<action method="addJs"><script>mage/translate.js</script></action>
<action method="addJs"><script>mage/cookies.js</script></action>
<action method="addJs"><script>jscommon/jquery.min.js</script></action>
<block type="page/js_cookie" name="js_cookies" template="page/js/cookie.phtml"/>
<action method="addCss"><stylesheet>css/styles_default.css</stylesheet></action>
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addCss"><stylesheet>css/style.css</stylesheet></action>
<action method="addCss"><stylesheet>css/dd.css</stylesheet></action>
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>
<!-- <action method="addItem"><type>skin_js</type><name>js/jquery.js</name></action> -->
<action method="addItem"><type>skin_js</type><name>js/jquery.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/jqueryNoConf.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/jquery.anythingslider.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/jquery.dd.js</name></action>
<action method="addItem"><type>skin_css</type><name>css/anythingslider.css</name></action>
<!--<action method="addItem"><type>skin_js</type><name>js/scripts.js</name></action>-->
</block>
But from this line <action method="addItem"><type>skin_js</type><name>js/jquery.min.js</name></action> nothing will be loaded in browser. Nothing means even the script loading url not coming...
The code wrote in the page.xml from C:\wamp\www\theme\app\design\frontend\default\biomatrix\template\layout
What is teh problem in my code.
How can i solve this?
You have mentioned that you have kept js files in skin\frontend\default\mytheme\js path.
and you are writing code in page.xml placed in C:\wamp\www\theme\app\design\frontend**default\biomatrix**\template\layout folder
Try to create a path in the root js folder and create a folder like prototype , lib or mage
and call it with
<action method="addJs"><script>your folder/yourjs.js</script></action>

Resources