Magento: Replace currency drop down menu with currency symbols to cklick on - magento

We have a currency drop down selector in the top right of our header.
I would like to replace that with currency symbols to click on.
i.e.:
$ £ €

Check this link. This may be helpful.
Change currency dropdown
Currency symbol
Currency selector
If you dont want dropdown menu use this code in your themes "directory/currency.phtml"
<ul>
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<li>
<a onclick="setLocation('<?php echo $this->getSwitchCurrencyUrl($_code) ?>')"><?php echo Mage::app()->getLocale()->currency($_code)->getSymbol()?> - <?php echo $_code ?></a>
</li>
<?php endforeach; ?>
</ul>

In your Themes template/directory/currency.phtml change the code to this (this is based on the RWD theme):
<?php if($this->getCurrencyCount()>1): ?>
<div>
<ul class="in_currency">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<li style="float:left;padding:0px 5px 0px 0px;">
<a href="<?php echo $this->getSwitchCurrencyUrl($_code) ?>" onclick="setLocation(this.value);">
<?php echo $_code ?>
<?php
$currencySymbol = Mage::app()->getLocale()->currency($_code)->getSymbol();
?>
<?php //echo $currencySymbol; ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>

Related

How to display all categories in Magento not top level category?

I tried this link and displaying all the categories in home page but it is displaying only the top level categories. I want to display all the categories.
<div class=”block block-verticalmenu”>
<div class=”block-title”>
<strong><span><?php echo $this->__(‘Categories’) ?></span></strong>
</div><!–End block block-cart–>
<div class=”block-content”>
<ul id=”ma-accordion” class=”accordion”>
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?> </ul>
</div><!–End Of vertical-nav–>
<?php echo $this->getChildHtml(‘topLeftLinks’) ?>
</div><!–End Of vertical-nav-container box base-mini–>
You could try replacing the function call
echo $this->drawItem($_category)
by
echo $this->drawOpenCategoryItem($_category)
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<ul>
<?php foreach($_categories as $_category): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

How to show all the category and all the sub-category in magento?

In my store, I want to display all the category and sub category in the sidebar.
I got the category but It doesn't show the sub-category products.
Here is my code:
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?></p>
<ul>
<?php foreach($_categories as $_category): ?></p>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>"><br />
<?php echo $_category->getName() ?><br />
</a>
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?><br />
<?php $_subcategories = $_category->getChildrenCategories() ?><br />
<?php if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>"><br />
<?php echo $_subcategory->getName() ?><br />
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
/ul>
<?php endif; ?>
Can any give a suggestion to solve this problem....
Thanks
Make Sure that your child categories have set 'Yes' for "is anchor" setting. As magento has this filter by default.
Second thing assign some products to categories and child categories then check it again.
Have a look at the method Mage_Catalog/Mage_Catalog_Block_Navigation::renderCategoriesMenuHtml. Something like this should show all categories:
<?php echo $this->getLayout()->createBlock('catalog/navigation')->renderCategoriesMenuHtml(); ?>
If you do not see the subcategories, make sure that they are not hidden by CSS.

Hide a certain category in layered navigation on search results

I would like to hide just a single category from my layered navigation. I have the "Show in Navigation" set to no but it still shows up on search results page. Is there a way to hide this?
To exclude a single category from layered navigation please follow the below steps. Note you could do this for any type of category listing.
Open /app/design/frontend/default/YOURTHEMENAME/template/catalog/navigation/left.phtml. If it does not exist, copy it from the base folder.
Find the code:
<dl id="narrow-by-list2">
<dt><?php echo $this->__('Category') ?></dt>
<dd>
<ol>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
</li>
<?php endif; ?>
<?php endforeach ?>
</ol>
</dd>
</dl>
Add this if statement just inside the foreach loop (and dont forget to close it): <?php if ($_category->getId() != 22): ?>
The new code will look like this:
<dl id="narrow-by-list2">
<dt><?php echo $this->__('Category') ?></dt>
<dd>
<ol>
<?php foreach ($_categories as $_category): ?>
<?php if ($_category->getId() != 22): ?> <!-- If statement here, replace category ID -->
<?php if($_category->getIsActive()): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
</li>
<?php endif; ?>
<?php endif; ?> <!-- End new If statement here -->
<?php endforeach ?>
</ol>
</dd>
</dl>
Replace the category ID with the ID of the category you wish to exclude.
To find out the ID of a category go to your Magento Admin panel and Categories, when you click to edit a category at the top left you will see it’s numerical ID.

displaying categories in the left column in magento

I have recently started working in magento, and my boss has given me the task of displaying categories in the left column. I have the static html file which I pasted inside the .phtml file and called it from the xml block and it displays just the static stuff in the left column.
I want them to be dynamic so that the categories can be added or removed from the backend.
The html that I have is in table format and I want to insert the php code into that same html so that the design is not disturbed and it becomes dynamic.
This might be what you're looking for:
<?php if (!Mage::registry('current_category')) return ?>
<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_count = is_array($_categories)?count($_categories):$_categories->count(); ?>
<?php if($_count): ?>
<div class="block block-layered-nav">
<div class="block-title">
<strong><span><?php echo $this->__('Browse By') ?></span></strong>
</div>
<div class="block-content">
<dl id="narrow-by-list2">
<dt><?php echo $this->__('Category') ?></dt>
<dd>
<ol>
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>
<li>
<a href="<?php echo $this->getCategoryUrl($_category) ?>"<?php if ($this->isCategoryActive($_category)): ?> class="current"<?php endif; ?>><?php echo $this->htmlEscape($_category->getName()) ?></a> (<?php echo $_category->getProductCount() ?>)
</li>
<?php endif; ?>
<?php endforeach ?>
</ol>
</dd>
</dl>
<script type="text/javascript">decorateDataList('narrow-by-list2')</script>
</div>
</div>
<?php endif; ?>
I used it here: http://marblesthebrainstore.com

Display a menu with categories, sub-categories and products - Magento

I have been looking to implement a menu system like the following
I have 1 category, Cars, with 2 sub-categories, New and Used
I’d like to display, on the drop down, the main category and then New, with all the products inside as a list and then Used, with all the products in a list.
I have tried using the code in the link provided, but it seemed to include a rollover option, that expanded the menu and the products are not listed below the category.
Thanks
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?>
<ul>
<?php foreach($_categories as $_category): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>">
<?php echo $_category->getName() ?>
</a>
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?>
<?php $_subcategories = $_category->getChildrenCategories() ?>
<?php if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>">
<?php echo $_subcategory->getName() ?>
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Source: http://fishpig.co.uk/magento-tutorials/display-categories-and-subcategories-in-magento

Resources