Pergunta

I am currently trying to move the quick search below my welcome message on all pages. I've gone to my theme/template/page/html/header.phtml and moved the welcome-msg above the 'topSearch', but it is not changing anything. I've looked at theme/layout/page.xml but I can't figure out if there's anything that I can change there to make it work. I'm new to PHP and XML so any help would be appreciated.

Here is my 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" translate="label">
                <label>Navigation Bar</label>
                <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
            </block>
            <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
                <label>Page Header</label>
                <action method="setElementClass"><value>top-container</value></action>
            </block>
        </block>

And my header.phtml

<div class="header-container">
    <div class="header">
        <?php if ($this->getIsHomePage()):?>
        <h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>
        <?php else:?>
        <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
        <?php endif?>
        <div class="quick-access">
            <p class="welcome-msg"><?php echo $this->getWelcome() ?> <?php echo $this->getAdditionalHtml() ?></p>
            <?php echo $this->getChildHtml('topSearch') ?>
            <?php echo $this->getChildHtml('topLinks') ?>
            <?php echo $this->getChildHtml('store_language') ?>

        </div>
        <div id="phone_number">1(888)641-7988</div>
        <?php echo $this->getChildHtml('topContainer'); ?>
    </div>
</div>
<?php echo $this->getChildHtml('topMenu') ?>

Any help would be greatly appreciated.

Foi útil?

Solução

Please correct your css, .header .form-search this css class is used for form search style and position:absolute is used in this class, so remove this and form search is moved below your welcome message

Outras dicas

Instead of

<?php echo $this->getChildHtml('topSearch') ?>

use this

<?php $this->getLayout()->getBlock('top.search')->toHtml(); ?>

This way you can call your search anywhere in your .phtml file.

I think you should look at your CSS. If position: absolute is used, moving elements in html, does not help.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top