Custom currency switcher in Magento header vanished? - magento

I built a custom currency switcher for my header yesterday, all working well. Today I came to setup the catalog pages and found myself needing to remove the standard currency switcher in the left column, I opened up my local.xml and add a remove to currency. Silly choice perhaps, I managed after fiddleing to get the left.currency to be removed when i suddenly noticed something I had done in one of my files had stopped my header custom currency switcher from displaying.
local.xml
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<!-- Remove callouts and rarely used stuff -->
<remove name="right.poll"/>
<remove name="right.permanent.callout"/>
<remove name="left.permanent.callout"/>
<remove name="paypal.partner.right.logo"/>
<remove name="catalog.compare.list" />
<!-- add the local stylesheet -->
<reference name="head">
<action method="addCss"><stylesheet>css/smoothness/jquery-ui-1.10.1.custom.css</stylesheet></action>
<action method="addJs"><script>ahoy/jquery-1.9.1.js</script></action>
<action method="addJs"><script>ahoy/jquery-ui-1.10.1.custom.js</script></action>
<action method="addJs"><script>ahoy/script.js</script></action>
<action method="addCss"><stylesheet>css/1140.css</stylesheet></action>
<action method="addCss"><stylesheet>css/ahoy.css</stylesheet></action>
</reference>
<reference name="header">
<block type="template/currency" name="custom_currency_selector" template="currency/currency.phtml"/>
</reference>
</default>
<catalog_category_view>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_category_view>
First part of header.phtml
<div class="header">
<div class="row">
<div class="row">
<div class="sixcol">
<?php echo $this->getChildHtml('topLinks') ?>
<?php echo $this->getChildHtml('custom_currency_selector') ?>
</div>
<div class="sixcol last">
<div class="row">
test/default/template/currency/currency.phtml
<?php if($this->getCurrencyCount() > 1): ?>
<div class="currency-block">
<ul>
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<?php $active = ($_code==$this->getCurrentCurrencyCode()) ? "active":""; ?>
<li>
<a class="<?php echo $active; ?>" href="<?php echo $this->getSwitchCurrencyUrl() . "currency/" . $_code; ?>" title="Set <?php echo $_code; ?> as your chosen currency">
<?php echo Mage::app()->getLocale()->currency($_code)->getSymbol(); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
From what I remember this is all I need to create the block, assign its position and call it out. I've been clearing the cache constantly while fiddeling, I reloaded in the currency conversion data, removed and retested the "remove" in local that removed the left bars currency, that one has now come back after i removed the remove for left.currency but the top one never came back.
These are my current files, so no removes at all for currency now, I'm not sure when this vanished but I've only been playing with the left sidebar stuff, after css struggles i tried to remove the currency and as i did not know how to reference it tried killing off all currency i could find and when i twigged i was no longer sure when i removed the top currency.

Try changing type="template/currency" to type="directory/currency"

Related

how to remove the 'home' link from top menu in magento?

I have a website where i don't want the 'home' link in top menu, I just want to remove or disable it...I have tried this link
http://www.magentocommerce.com/boards/viewthread/60059/
but it didn't find any code in top.phtml (app > design > frontend > default (or whatever theme you have) > catalog > navigation > top.phtml ) like-
<li> yada /home statement </li>
or
<li><?php echo $this->__('Home') ?></li>
I have only
<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
<ul id="nav">
<?php echo $_menu ?>
</ul>
</div>
<?php endif ?>
Please give a solution.
I already tried using xml in customer.xml file but may be I didn't use it in proper xml file or proper code.
<reference name="top.links">
<action method="removeLinkByUrl">
<url helper="core/url/getHomeUrl" />
</action>
</reference>
Try this in the local.xml file of your active theme.
<default>
<reference name="root">
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="core/url/getHomeUrl"/></action>
</reference>
</reference>
</default>
As a hack you can hide it using css
find the class and add .class { display:none }
At last, I figured it out.The Home link is there because of the menu plugin(custom responsive menu'). I disabled it from backend.

Moving Magento Advanced Search Link From Footer To Beneath Search Bar

I'm trying to move magentos advanced search link from the footer links right beneath the search bar.
I know that the origins of the link are in layout/catalogsearch.xml under
reference name="footer_links" and appear in the footer because of getChildHtml('footer_links') in footer.phtml
And i know that the search bar originates from template/catalogsearch/form.mini.phtml and appears though catalogsearch.xml under reference name="top.menu"
Any ideas on how to proceed here?
thank you for the quick answer!
But it is not exactly what I was looking for as it would display the entire footer links block beneath the searchbar.
Nevertheless thank you for showing me the method you used for that!
Anyways, I figured out a solution on my own:
I modified catalogsearch.xml:
<default>
<reference name="top.menu">
<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
</reference>
<!-- add a new reference to top.search including my new adv.search block -->
<reference name="top.search">
<block type="page/template_links" name="adv.search" as="adv.search" >
<action method="addLink" translate="label title" module="catalogsearch">
<label>Advanced Search</label>
<url helper="catalogsearch/getAdvancedSearchUrl" />
<title>Advanced Search</title>
</action>
</block>
</reference>
<!-- the reference to the footer i commented out as its not longer needed; it includes advanced search and popular search terms-->
</default>
In form.mini.phtml I added a new div that calls adv.search:
</script>
<div class="adv-search"> <?php echo $this->getChildHtml('adv.search') ?> </div>
</div>
And last, in styles.css, I added some code to controll the looks of that div:
.adv-search {width:100px; height:15px; margin-top:24px; margin-left: 120px;}
.adv-search a { color:#fff; font-weight:bold; }
any additional advice is more than welcome
Cheers!
In order for this to work, you must:
1) Update your app/design/frontend/[yourtheme]/default/layout/local.xml file
2) Call the new blocks in app/design/frontend/[yourtheme]/default/template/page/html/header.phtml - this is needed because header.phtml is not a "core/text_list" block type which automatically renders its nested blocks. So we must explicitly tell Magento to render those child blocks
Your app/design/frontend/[yourtheme]/default/layout/local.xml should contain this:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="header">
<!-- Insert cms links. No need to use <action method="insert"> as this block is not used elsewhere in layout -->
<block type="cms/block" name="top_links_cms" as="top_links_cms" before="top_links_other">
<action method="setBlockId"><block_id>footer_links</block_id></action>
</block>
<!-- Insert former footer links. -->
<action method="insert">
<!-- We must keep block name "footer_links" as it is used as a reference for adding links by other modules -->
<blockName>footer_links</blockName>
<!-- Name of the block we want to have as sibling (in order to get its position and place our block after it. See next node <after> -->
<siblingName>topSearch</siblingName>
<!-- $after param from Mage_Core_Block_Abstract::insert() is a boolean type, so its value in the XML node is [empty], 0 or 1 -->
<after>1</after>
<alias>top_links_other</alias>
</action>
</reference>
<reference name="footer">
<action method="unsetChild"><name>footer_links</name></action>
<action method="unsetChild"><name>cms_footer_links</name></action>
</reference>
</default>
</layout>
This is an updated header.phtml you can get inspiration from for your app/design/frontend/[yourtheme]/default/template/page/html/header.phtml file:
<div class="header-container">
<div class="header">
<?php if ($this->getIsHomePage()):?>
<h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></h1>
<?php else:?>
<strong><?php echo $this->getLogoAlt() ?></strong><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" />
<?php endif?>
<div class="quick-access">
<?php echo $this->getChildHtml('topSearch') ?>
<?php
/**
* Add other top links (footer and cms links)
*/
?>
<?php echo $this->getChildHtml('top_links_cms') ?>
<?php echo $this->getChildHtml('top_links_other') ?>
<p class="welcome-msg"><?php echo $this->getWelcome() ?> <?php echo $this->getAdditionalHtml() ?></p>
<?php echo $this->getChildHtml('topLinks') ?>
<?php echo $this->getChildHtml('store_language') ?>
</div>
<?php echo $this->getChildHtml('topContainer'); ?>
</div>
</div>
<?php echo $this->getChildHtml('topMenu') ?>

magento - remove recently added items

I want to remove "Recently added item" in cart sidebar on the front page of Magento. I can remove the following lines from checkout/cart/sidebar.phtml, but is there a less destructive way to do this, in case we want to quickly restore this in the future?
<?php // if(count($_items)): ?>
<!-- <p class="block-subtitle"><?php //echo $this->__('Recently added item(s)') ?></p> -->
<!-- <ol id="cart-sidebar" class="mini-products-list"> -->
<?php // foreach($_items as $_item): ?>
<?php // echo $this->getItemHtml($_item) ?>
<?php // endforeach; ?>
<!-- </ol> -->
<!-- <script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script> -->
<?php // else: ?>
<!-- <p class="empty"><?php //echo $this->__('You have no items in your shopping cart.') ?></p> -->
<?php //endif ?>
You simply use following xml layout update in local.xml:
<remove name="cart_sidebar" />
OR
<action method="unsetChild"><name>cart_sidebar</name></action>
Cheers!
You could create a new template file with the new layout you require...
app/design/frontend/your_package/your_theme/template/checkout/cart/sidebar-updated.phtml
Then in your layout xml, you can change swap the sidebar template to the new version...
<default>
<reference name="cart_sidebar">
<action method="setTemplate"><template>checkout/cart/sidebar-updated.phtml</template></action>
</reference>
</default>
Then to revert back at any point, simply remove/comment out this layout xml
Better still, add this to your local.xml
<remove name="left.reports.product.viewed"/>
<remove name="right.reports.product.viewed"/>
To be more explicit it's in /app/design/frontent/default/[[your-theme-name]]/layout/local.xml.
Less intrusive for an easier upgrade path and this answer is an adaptation of the more intrusive solution I saw here.

how to display toplinks at footer in magento?

How can i display below toplinks in footer,
i used below code in Footer.phtml file,
<?php echo $this->getChildHtml('topLinks'); ?>
but the links are not displayed?. How can i do this?
Thanks in advance
footer.phtml
<div class="footer-container">
<div class="footer">
<?php echo $this->getChildHtml() ?>
<?php echo $this->getChildHtml('newsletter') ?>
<?php //echo $this->getLayout()->createBlock('cms/block')->setBlockId('sample_links')->toHtml() ?>
<?php echo $this->getChildHtml('samplelinks') ?>
<?php echo $this->getChildHtml('top.links'); ?>
<p class="bugs"><?php echo $this->__('Help Us to Keep Magento Healthy') ?> - <strong><?php echo $this->__('Report All Bugs') ?></strong> <?php echo $this->__('(ver. %s)', Mage::getVersion()) ?></p>
<address><?php echo $this->getCopyright() ?></address>
</div>
</div>
</div>
Classic learning-to-theme-Magento question!
The relationship of one block to another is most evident in templates (as your current effort demonstrates). The ability for a parent (footer, in your case) to trigger rendering of another block requires that a parent-child relationship be established. This typically happens in layout update XML.
If this relationship were core, it is likely that you would see the following in the base/default theme's layout/page.xml file:
<block type="page/html_footer" name="footer" ...>
<!-- other child block directives -->
<block type="page/template_links" name="top.links" as="topLinks"/>
</block>
In your case, because you are adding a relationship between two existing blocks, you can set up a relationship between block instances in a special end-user layout xml file named local.xml which you should place in your custom theme's layout folder. Here is what it should look like:
<?xml version="1.0"?>
<layout>
<default><!-- effectively: "do this on all pages" -->
<reference name="footer"><!-- parent block -->
<action method="insert"><!-- this PHP class method sets the relationship -->
<block_name_to_insert>top.links</block_name_to_insert><!--use the block name in the layout, not the alias. See Mage_Core_Block_Abstract::insert() -->
<sort_relative_to_other_childname/><!-- empty val is fine here -->
<sort_before_or_after/><!-- not relevant -->
<alias>topLinks</alias><!-- because you are using the original alias, need to re-specify that here -->
</action>
</reference>
</default>
</layout>

Magento: Move product filters

As default, the available product filters are displayed in the left sidebar. But I'd like to display them above the product list instead.
I simply tried to just copy the following code from /template/catalog/layer/view.phtml to /template/catalog/product/list.phtml:
<p class="block-subtitle"><?php echo $this->__('Shopping Options') ?></p>
<dl id="narrow-by-list">
<?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<dt><?php echo $this->__($_filter->getName()) ?></dt>
<dd><?php echo $_filter->getHtml() ?></dd>
<?php endif; ?>
<?php endforeach; ?>
</dl>
But apparently it doesn't work that way. How should I do?
Thank you in advance!
You need to make the block (a php class) which uses the filters template a child of the class where you wish to include those filters. This is done in layout XML.
In a local.xml file in your theme's layout folder, do the following:
<?xml version="1.0" ?>
<layout>
<catalog_category_layered>
<!-- remove from left block -->
<reference name="left">
<action method="unsetChild">
<child>catalog.leftnav</child>
</action>
</reference>
<!-- add as child to product list block -->
<reference name="product_list">
<action method="insert">
<child>catalog.leftnav</child>
</action>
</reference>
</catalog_category_layered>
</layout>
using the above, you can simply call <?php echo $this->getChildHtml('catalog.leftnav') ?> inside your custom list template for it to show. You can either style it using CSS, or you can change its template by adding this inside the catalog_category_layered node above:
<reference name="catalog.leftnav">
<action method="setTemplate">
<child>path/to/template.phtml</child>
</action>
</reference>

Resources