|
@ Hoodgrown
I moved my site map and search terms to an additional bar above the search bar in the modern theme as in the graphic.
I could not have completed this mission with the excellent tutorial from Bill007 at the following:
http://www.magentocommerce.com/boards/viewthread/3454/. Big thank you to Bill007
However, I modified Bill007 to suit my needs. My file changes are as follows.
GO TO CMS AND THEN TO Static Blocks >> Add new Block
Block Title * Navigation Links
Identifier * nav_links
Choose your STORE (FOR ME ALL STORES)
Status * ENABLE
Content * <ul class="nav-links">
<li><a href="{{store url=""}}">Home</a></li>
<li><a href="{{store url=""}}about-magento-demo-store">About Us</a></li>
<li class"last"><a href="{{store url=""}}customer-service">Customer Service</a></li>
Now go to app/design/frontend/default/modern/layout/page.xml
add this code
<block type="page/template_links" name="top.links" as="topLinks"/>
<!-- BEGIN EDIT ADD TO PAGE.XML -->
<block type="page/html_nav" name="nav.links" as="navLinks" template="page/html/nav.phtml">
<block type="cms/block" name="nav_links">
<action method="setBlockId"><block_id>nav_links</block_id></action>
</block>
</block>
<!-- END OF EDIT -->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
Now go to apps/design/frontend/default/modern/template/page/html/
Create a new file called nav.phtml
Add this code
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* @category design_default
* @package Mage
* @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
?>
<?php echo $this->getChildHtml()?>
<?php if($this->hasSeoLinks()>0):?>
<?foreach($this->getSeoLink() as $item):?>
<li><a href="<?=$item['url'];?>"><?=$item['title'];?></a></li>
<?endforeach;?>
</ul>
<?php endif;?>
This is Bill’s original code:
Now go to
apps/code/core/Mage/Page/Block/Html
CREATE A new file in the block folder called Nav.php {note you must use a capital N IN Nav.php}
and paste the following code into it
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* @category Mage
* @package Mage_Page
* @copyright Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
/**
* Html page block
*
* @category Mage
* @package Mage_Page
*/
class Mage_Page_Block_Html_Nav extends Mage_Core_Block_Template /* this needs to reflect the new name of the block file so for me Nav*/
{
protected $_seolinks;
protected function _prepareLayout()
{
parent::_prepareLayout();
$this->initSeoLink();
}
public function setCopyright($copyright)
{
$this->_copyright = $copyright;
return $this;
}
public function getCopyright()
{
if (!$this->_copyright) {
$this->_copyright = $this->getDesignConfig(’page/nav/copyright’);
}
return $this->_copyright;
}
public function getSeoLink()
{
return $this->_seolinks;
}
public function setSeoLink(array $varName)
{
$this->_seolinks=$varName;
}
public function addSeoLink(array $varName)
{
$this->_seolinks[]=$varName;
}
public function hasSeoLinks()
{
return count($this->_seolinks);
}
public function initSeoLink()
{
if(Mage::getStoreConfig(’catalog/seo/site_map’)){
$seolink[’title’]=$this->__(’Site Map’);
$seolink[’url’]=$this->helper(’catalog/map’)->getCategoryUrl();
$this->_seolinks[]=$seolink;
}
if(Mage::getStoreConfig(’catalog/seo/search_terms’)){
$seolink[’title’]=$this->__(’Search Terms’);
$seolink[’url’]=$this->helper(’catalogSearch/data’)->getSearchTermUrl();
$this->_seolinks[]=$seolink;
}
}
}
Image Attachments
Click thumbnail to see full-size image
|