Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Moving Advanced Search from Footer to Header Exercise #2
 
DavidL
Jr. Member
 
Total Posts:  1
Joined:  2008-04-04
 

I am having a little trouble with

Exercise #2: Separate the SEO links at the footer area - Instead of having the link items to be one list, isolate ‘Advanced Search’ to be in the header instead.

I followed the exercise, but I am getting the following displayed in the header instead of the link.

getChildHtml(’header_links’)?>

This is what code I added.

head.phtml

<?=$this->getChildHtml('header_links')?>
page.xml

<block type="page/html_header" name="header" as="header">
                <
block type="page/template_links" name="top.links" as="topLinks"/>
                <
block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
                <
block type="core/text_list" name="top.menu" as="topMenu"/>
                <
block type="core/template_links" name="header_links" as="header_links" template="page/html/links.phtml"/>
            </
block>
catalogsearch.xml

<default>
        <
reference name="header">
            <
block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
        </
reference>
        <
reference name="header_links"
            <
action method="addLink" translate="label title" module="catalogsearch"><label>Advanced Search</label><url             helper="catalogsearch/getAdvancedSearchUrl" /><title>Advanced Search</title></action
        </
reference
        <
reference name="footer_links">
            <
action method="addLink" translate="label title" module="catalogsearch" ifconfig="catalog/seo/search_terms"><label>Search Terms</label><url helper="catalogsearch/getSearchTermUrl" /><title>Search Terms</title></action>
            <
action method="addLink" translate="label title" module="catalogsearch"><label>Advanced Search</label><url helper="catalogsearch/getAdvancedSearchUrl" /><title>Advanced Search</title></action>  
        </
reference>
    </default>
[

Thanks,
Dave

 
Magento Community Magento Community
Magento Community
Magento Community
 
Brett
Sr. Member
 
Total Posts:  121
Joined:  2007-12-01
 

I’m not sure if this will work, but make sure theres a space after <? and before ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
glaDiator
Member
 
Avatar
Total Posts:  65
Joined:  2008-03-17
 

I think you may not have short tag enabled.
Either you enable short tag in .htaccess or use <?php ... ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
fenix
Jr. Member
 
Total Posts:  23
Joined:  2008-02-18
 
glaDiator - 17 April 2008 07:42 PM

I think you may not have short tag enabled.
Either you enable short tag in .htaccess or use <?php ... ?>

thats one

two:
didn’t work for me either until i changed page.xml:

from
<block type=”core/template_links" name="header_links" as="header_links" template="page/html/links.phtml"/>

<block type=”page/template_links" name="header_links" as="header_links" template="page/html/links.phtml"/>

and you need to add or copy the links.phtml file to: page/html/

then it worked for me grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adam_Shuy
Member
 
Avatar
Total Posts:  51
Joined:  2008-02-20
San Jose, CA
 
fenix - 18 April 2008 05:55 AM

glaDiator - 17 April 2008 07:42 PM
I think you may not have short tag enabled.
Either you enable short tag in .htaccess or use <?php ... ?>

thats one

two:
didn’t work for me either until i changed page.xml:

from
<block type=”core/template_links" name="header_links" as="header_links" template="page/html/links.phtml"/>

<block type=”page/template_links" name="header_links" as="header_links" template="page/html/links.phtml"/>

and you need to add or copy the links.phtml file to: page/html/

then it worked for me grin

Which one shall I add the getChildHtml to?  head.phtml or header.phtmo?

 
Magento Community Magento Community
Magento Community
Magento Community
 
plainspace
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2008-01-23
 

Finally got this.  Thanks for all of your help.  Only question now is where does the vertical line that separates the navigation items get set and how do I unset it for the Advanced Search link?

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Hugoto
Member
 
Avatar
Total Posts:  33
Joined:  2008-08-11
 

Hi guys,

I’ve followed the exercise, but after adding the line <?php echo $this->getChildHtml('header_links') ?> I’m getting this error msg:

Invalid method Mage_Page_Block_Html_Header::addLink(Array
(
    
[0] => Búsqueda Avanzada
    [1] 
=> http://localhost/magento/catalogsearch/advanced/
    
[2] => Búsqueda Avanzada
)
)
Trace:
#0 [internal function]: Varien_Object->__call('addLink', Array)
#1 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php(322): Mage_Page_Block_Html_Header->addLink('Búsqueda...', 'http://localhos...', 'Búsqueda...')
#2 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php(198): Mage_Core_Model_Layout->_generateAction(Array, Array)
#3 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Layout.php(194): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(279): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Cms\Helper\Page.php(76): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#6 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Cms\controllers\IndexController.php(26): Mage_Cms_Helper_Page->renderPage()
#7 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(343): Mage_Cms_IndexController->indexAction(Object(Mage_Cms_IndexController), 'home')
#8 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(144): Mage_Core_Controller_Varien_Action->dispatch()
#9 C:\Archivos de programa\xampp\htdocs\magento\app\code\core\Mage\Core\Controller\Varien\Front.php(168): Mage_Core_Controller_Varien_Router_Standard->match('index')
#10 C:\Archivos de programa\xampp\htdocs\magento\app\Mage.php(420): Mage_Core_Controller_Varien_Front->dispatch(Object(Mage_Core_Controller_Request_Http))
#11 C:\Archivos de programa\xampp\htdocs\magento\index.php(46): Mage::run()
#12 {main}

I’m very newbie to Magento so I dont know what I can do.

PS. The Front and the back end on mi Magento are in Spanish Spain, and the exercise was made in a clean installation with the sample data.

 
Magento Community Magento Community
Magento Community
Magento Community
 
morehawes
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-02-04
 

Hi everyone, I am also having some trouble with this excersise (great idea by the way, would love to see more of them!  grin )

After following all the steps (a few times infact!) The link goes from the footerbut does not appear in the header. I guess i’m making a silly mistake but I can’t figure it out. I have edited the following files:

catalogsearch.xml
page.xml
header.phtml

and the resulting code is as follows:

In catalogsearch.xml

...
    <default>
        <
reference name="header">
            <
block type="core/template" name="top.search" as="topSearch" 
                    
template="catalogsearch/form.mini.phtml"/>
        </
reference>
        <
reference name="footer_links">
            <
action method="addLink" translate="label title" module="catalogsearch" 
                    
ifconfig="catalog/seo/search_terms">
                <
label>Search Terms</label>
                <
url helper="catalogsearch/getSearchTermUrl" />
                <
title>Search Terms</title>
            </
action>
        </
reference>
        <
reference name="header_links">
           <
action method="addLink" translate="label title" module="catalogsearch">
                <
label>Advanced Search</label>
                <
url helper="catalogsearch/getAdvancedSearchUrl" />
                <
title>Advanced Search</title>
            </
action>
        </
reference>
    </default>
...

In page.xml

...
            <
block type="page/html_header" name="header" as="header">
                <
block type="page/template_links" name="top.links" as="topLinks"/>
                <
block type="page/switch" name="store_language" as="store_language" 
                        
template="page/switch/languages.phtml"/>
                <
block type="core/text_list" name="top.menu" as="topMenu"/>
                <
block type="page/template_links" name="header_links" as="header_links" 
                        
template="page/template/links.phtml"/>
            </
block>
...

in header.phtml

...
        
<?php echo $this->getChildHtml('topSearch'?>
        <?php 
echo $this->getChildHtml('header_links'?>
        
<div class="quick-access">
...

Any help would be greatly appreciated!  smile

Thanks,
Joe.

 
Magento Community Magento Community
Magento Community
Magento Community
 
morehawes
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-02-04
 

I have resolved my problem - silly mistake red face

 
Magento Community Magento Community
Magento Community
Magento Community
 
gapa
Jr. Member
 
Total Posts:  8
Joined:  2009-02-05
Slovenia, Ljubljana
 

Please post the solution. Maybe it could also help me.

br,
Gašper

 
Magento Community Magento Community
Magento Community
Magento Community
 
morehawes
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-02-04
 

Hi, my mistake was actually a typo! Nothing to do with the instructions. I did this a couple of weeks ago now, but if you post your problem / code then I / someone might be able to help.

Cheers,
Joe

 
Magento Community Magento Community
Magento Community
Magento Community
 
gapa
Jr. Member
 
Total Posts:  8
Joined:  2009-02-05
Slovenia, Ljubljana
 

My problem is the same. I am able to remove link from footer but it seems that I can’t put it in header. Looked also code you posted and it looks the same.
I can’t figure this out.

br,
Gašper

 
Magento Community Magento Community
Magento Community
Magento Community
 
morehawes
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-02-04
 

Hi again Gašper,

I’m trying to think what I was doing wrong. Make sure you are editing the correct theme that you have applied to your store - I have a feeling that I was editing a theme that was not loaded correctly. If you code is exactly the same as mine then it works and the problem is else where.

Also try disabling the cache in Admin.

Joe

 
Magento Community Magento Community
Magento Community
Magento Community
 
gapa
Jr. Member
 
Total Posts:  8
Joined:  2009-02-05
Slovenia, Ljubljana
 

You are a true life saver. smile
It was header.phtml that wasn’t edited from my edited theme but from default theme. So I had to find and edit correct header.phtml.
Thank you again.

br,
Gašper

 
Magento Community Magento Community
Magento Community
Magento Community
 
morehawes
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-02-04
 

No worries - it’s those sort of mistakes that you spend ages trying to sort out and you just need a little nudge! tongue rolleye

All the best,

Joe

P.s. I love Ljubljana, very jealous you live there! grin

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top