Magento Forum

   
Page 1 of 2
Top.links external urls
 
pinoguin
Member
 
Avatar
Total Posts:  68
Joined:  2008-10-17
Philippines
 

I know I’m doing it wrong:

<action method="addLink" translate="label title" module="customer"><label>Go to external site</label><url helper="http://domain.com"/><title>Go to external site</title><prepare/><urlParams/><position>10</position></action>

What is the best way to insert a link like this? Also what do I put when I only wanted a ‘home’ link?

when I use ‘home’ In the helper I get this:
Fatal error: Class ‘Mage__Helper_Data’ not found

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 

external link:

<action method="addLink" translate="label title"><label>ext</label><url>http://external.com/</url><title>ext</title><prepare/><urlParams/><position>100</position></action>

home link:

<action method="addLink" translate="label title"><label>Home</label><url/><title>Home</title><prepare>true</prepare><urlParams/><position>1</position></action>

 
Magento Community Magento Community
Magento Community
Magento Community
 
pinoguin
Member
 
Avatar
Total Posts:  68
Joined:  2008-10-17
Philippines
 

Hi laurent,

Thanks ! that works fine

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

Hello guys,
Where should this code be added?
is it ok to add it here: /app/design/frontend/default/default/layout/page.xml

Do I need to add something more elsewhere?

Thanks a lot.

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 

Where should this code be added?
is it ok to add it here: /app/design/frontend/default/default/layout/page.xml

page.xml is for general layout. I think catalog.xml is a better place to put those links.

<default>
    <
reference name="top.links">
        <
action method="addLink" translate="label title">...</action>
    </
reference>
</default>

Do I need to add something more elsewhere?

No.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

Thanks for the info, but didn’t make it work.
I copied the code you gave me in catalog.xml (on my server there are 3 such files and I have tried with each) and did nothing else.
Can you more specific please on what it has to be done? Something a like A to Z steps to be done ... I think it will help a lot of people that would like to add a link to their top menu links.

You see, I am not a developer (like many others here I believe), that’s why I am trying to find out as much as I can on this forum.

Thanks in advance,
Cristi

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 

I copied the code you gave me in catalog.xml (on my server there are 3 such files and I have tried with each).

It means you don’t know the interface and theme you’re using. You should definitely read the Designer’s Guide to Magento

Can you more specific please on what it has to be done? Something a like A to Z steps to be done ... I think it will help a lot of people that would like to add a link to their top menu links.

I can’t be more specific! But you can explain exactly what you want to do and paste here your catalog.xml (with the changes you’ve made) and I’ll tell you what’s wrong.

You see, I am not a developer (like many others here I believe), that’s why I am trying to find out as much as I can on this forum.

Good luck!

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

well, this is my site: http://www.genti-rucsaci.ro/ and I would like to add a Home link to the right top links.
This is where I copied the code in /app/design/frontend/blank/theme021/layout/catalog.xml, and this is a part of what it looks like (couldn’t copied the whole code because there were too many characters):

<layout version="0.1.0">

<!--Default 
layoutloads most of the pages-->

    <default>

        <!-- 
Mage_Catalog -->
        <
reference name="top.menu">
            <
block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/>
        </
reference>
        <
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 (800DEMO-NUMBER.</alt></action>
                <
action method="setLinkUrl"><url>checkout/cart</url></action>
            </
block>-->
        </
reference>
        <
reference name="right">
            <
block type="core/template" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
            <!--<
block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml"/>-->
        </
reference>
        <
reference name="footer_links">
            <
action method="addLink" translate="label title" module="catalog" ifconfig="catalog/seo/site_map"><label>Site Map</label><url helper="catalog/map/getCategoryUrl" /><title>Site Map</title></action>
        </
reference>

    </default>

<!--
Adding top link-->

<default>
<
reference name="top.links">
        <
action method="addLink" translate="label title"><label>Home</label><url/><title>Home</title>
        <
prepare>true</prepare><urlParams/><position>1</position></action
    </
reference>
</default> 
...
</
layout>

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

It worked, sorry Laurent ... It seems after I have refreshed the cache and cleared the the images cache the Home link appeared to the top links.
Thanks a lot, man, and sorry about the inconvenience created.

Regards,
Cristi

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 

I’m glad it’s working, but you should have only one <default></default>, like that:

<layout version="0.1.0">

<!--Default 
layoutloads most of the pages-->

    <default>

        <!--
Adding top link-->

        <
reference name="top.links">
            <
action method="addLink" translate="label title"><label>Home</label><url/><title>Home</title>
            <
prepare>true</prepare><urlParams/><position>1</position></action
        </
reference>

        <!-- 
Mage_Catalog -->
        <
reference name="top.menu">
            <
block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/>
        </
reference>
        
[...]

    
</default>

...
</
layout>

if you want your link to be the lastest (to the right), put an higher position, try <position>110</position>.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

I corrected also the default thing, thanks a lot.
What if I would like to position my new link somewhere between the existing links?
If I want it to be the 3rd, should I modify this <position>110</position> to <position>3</position>?

Also, off this topic, can you help me please with a matter of lightbox? I can’t see the “loading” and “close” icons after watching the pics for the products. can you please teke a look and tell me why?

Thanks a lot,
Cristi

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 

What if I would like to position my new link somewhere between the existing links?
If I want it to be the 3rd, should I modify this <position>110</position> to <position>3</position>?

Look for <reference name="top.links"> inside files in your layout directory and you’ll find the default position of each link except for specials links where the position is hardcoded in classes: code/core/Mage/Checkout/Block/links.php for My Cart and Checkout links and code/core/Mage/Wishlist/Block/links.php for My Wishlist link.

Also, off this topic, can you help me please with a matter of lightbox? I can’t see the “loading” and “close” icons after watching the pics for the products. can you please teke a look and tell me why?

I already made an explanation here: http://www.magentocommerce.com/boards/viewthread/8458/

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

Hei Laurent, thanks for the advices.
Following the steps you posted here: http://www.magentocommerce.com/boards/viewthread/8458/ I think I found an error in the code. I mean, instead of this code

<action method="addItem"><type>skin_js</type><name>js/lightbox.js</name></action>
<
action method="addItem"><type>skin_css</type><name>css/lightbox.css</name></action>

I used this one

<action method="addJs"><script>lightbox/lightbox.js</script></action>
<
action method="addCss"><stylesheet>css/lightbox.css</stylesheet></action>

from here http://www.magentocommerce.com/wiki/adding_lightbox_to_magento_v2
At least, it worked for me and now I can see all the icons (loading, close, prev, next).

Thanks,Cristi

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 
cristache - 19 December 2008 05:51 AM

Hei Laurent, thanks for the advices.
Following the steps you posted here: http://www.magentocommerce.com/boards/viewthread/8458/ I think I found an error in the code. I mean, instead of this code

<action method="addItem"><type>skin_js</type><name>js/lightbox.js</name></action>
<
action method="addItem"><type>skin_css</type><name>css/lightbox.css</name></action>

I used this one

<action method="addJs"><script>lightbox/lightbox.js</script></action>
<
action method="addCss"><stylesheet>css/lightbox.css</stylesheet></action>


from here http://www.magentocommerce.com/wiki/adding_lightbox_to_magento_v2
At least, it worked for me and now I can see all the icons (loading, close, prev, next).

Thanks,Cristi

There’s no error. It’s just an other solution. You chose to put lightbox in the general js dir and I chose to put lightbox in the skin dir in order to have different images for different websites.

 
Magento Community Magento Community
Magento Community
Magento Community
 
cristache
Member
 
Total Posts:  72
Joined:  2008-12-06
Bucuresti - Romania
 

I just followed all the steps in your topic, and didn’t work for me ... comparing with the code in wiki, those 2 lines of code where different and I just copied them instead.

I’m not very good at this, I told you, maybe I slipped something from your explanation, I don’t know. But in conclusion it works ... but I don’t like those 2 buttons for zoom. Can I get rid of them?

I found this code on the forum:

<?php // if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
<!-- <class="product-image-zoom"><img id="image" src="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></p>
<
class="a-center" id="track_hint"><?php echo $this->__('Double click on above image to view full picture'?></p>

<
div class="image-zoom" id="track_outer">
    <
img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
    <
div id="track">
        <
div id="handle"></div>
    </
div>
    <
img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
</
div>
<
script type="text/javascript">
/*    Event.observe(window, 'load', function() {
        product_zoom = new Product.Zoom('image', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
    }); */
</script> -->
<?php // else: ?>
    
<a href="<?php echo $this->helper('catalog/image')->init($_product, 'image');?>" rel="lightbox[rotation]" title="<?php echo $_product->getName();?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(265); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
    <
class="a-center" id="track_hint"><?php echo $this->__('Double click on above image to view full picture'?></p>
<?php // endif; ?>

and placed it for this one

<?php if ($_product->getImage() != 'no_selection' && $_product->getImage()): ?>
<class="product-image-zoom"><img id="image" src="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></p>
<
class="a-center" id="track_hint"><?php echo $this->__('Double click on above image to view full picture'?></p>

<
div class="image-zoom" id="track_outer">
    <
img id="zoom_out" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_out.gif') ?>" alt="<?php echo $this->__('Zoom Out') ?>" class="btn-zoom-out" />
    <
div id="track">
        <
div id="handle"></div>
    </
div>
    <
img id="zoom_in" src="<?php echo $this->getSkinUrl('images/slider_btn_zoom_in.gif') ?>" alt="<?php echo $this->__('Zoom In') ?>" class="btn-zoom-in" />
</
div>
<
script type="text/javascript">
    
Event.observe(window'load', function() {
        product_zoom 
= new Product.Zoom('image''track''handle''zoom_in''zoom_out''track_hint');
    
});
</script>
<?php 
else: ?>
    
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'image')->resize(265); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" />
<?php endif; ?>

in app/design/frontend/default/your_style/template/catalog/product/view/media.phtml.

Doing so, there are also other things that change, for example the box for the main picture disappears. Or, when playing pictures in lightbox, it shows the first one 2 times.

Can you tell me please what is the mistake in the code?

Thanks in advance,
Cristi

 
Magento Community Magento Community
Magento Community
Magento Community
 
laurent
Member
 
Total Posts:  75
Joined:  2007-08-31
Paris, France
 

This threat is called: Top.links external urls.
Why not just create an new thread?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2