2011-03-30 2 views
8

나는 ../myCustomTheme/layout/local.xml에 저장 다음 코드로 젠토의 top.links에 사용자 지정 링크를 추가 할 수 있어요다른 도메인으로 리디렉션되는 Magento top.links에 링크를 어떻게 추가합니까?

<reference name="root"> 
<reference name="top.links"> 
    <action method="addLink" translate="label title"> 
     <label>example</label> 
     <url>example</url> 
     <title>example</title> 
     <prepare>true</prepare> 
     <urlParams helper="core/url/getHomeUrl"/> 
     <position>100</position> 
     <liParams/> 
     <aParams>class="top-link-example"</aParams> 
     <beforeText></beforeText> 
     <afterText></afterText> 
    </action> 
</reference> 
</reference> 

예 명명 된 링크를 생성합니다 위의 코드 포인트 http://myexampledomain.com/example. 내가

<url>http://myotherexampledomain.com</url> 

에 코드

<url>example</url> 

이 라인을 변경하면 나는 http://myexampledomain.com/http:/myotherexampledomain.com를 가리키는 링크라는 이름의 예와 끝까지. 준비 매개 변수를 false로 설정하고 ../app/code/core/Mage/Core/Model/Url.php를 보면서 urlParams에 다양한 매개 변수를 추가하려했습니다.

답변

12

그래서 나는 이것을 지켰다. 기본적으로 준비는 "true"또는 "false"로 설정된 경우 사이트의 기본 URL에 URL을 추가하기 때문에 설정을 해제해야합니다. 나는 또한 도우미가 = urlParams에서 "코어/URL/getHomeUrl"이 getHomeUrl 기능이이 경우에 필요하지 않기 때문에 제거

<reference name="root"> 
<reference name="top.links"> 
    <action method="addLink" translate="label title"> 
     <label>example</label> 
     <url>http://myotherexampledomain.com</url> 
     <title>example</title> 
     <prepare/> 
     <urlParams/> 
     <position>100</position> 
     <liParams/> 
     <aParams>class="top-link-example"</aParams> 
     <beforeText></beforeText> 
     <afterText></afterText> 
    </action> 
</reference> 
</reference> 

다음은 수정 된 코드입니다. 위의 코드는 http://myotherexapmpledomain.com을 올바르게 가리키는 example 링크를 만듭니다.

+0

내 문제가 해결되었습니다. addLink 메소드에 필요한 모든 인수를 제공해야한다는 점은 주목할 가치가 있습니다. 그 이유는 addLink 메소드가 목록에서 누락 된 경우 그 이후의 모든 인수는 XML에서 무시 될 것이기 때문입니다. – nyaray

관련 문제