<?php echo Mage::getModel('catalog/layer')->getCurrentCategory()->getName(); ?>
<?php echo Mage::getModel('catalog/layer')->getCurrentCategory()->getId(); ?>
public function deleteallAction()
{
$cartHelper = Mage::helper('checkout/cart');
$items = $cartHelper->getCart()->getItems();
foreach ($items as $item)
{
$itemId = $item->getItemId();
$cartHelper->getCart()->removeItem($itemId)->save();
}
$this->_redirectReferer(Mage::getUrl('*/*'));
}
<block type="catalog/product_view" name="product_video" as="product_video" template="catalog/product/view/video.phtml"/>
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
this block. getChildHtml('product_video'); ?>
You will need to create a new directory, named “directory” and create a new file called “currency-top.phtml“:
/app/design/frontend/template/default/YOUR-TEMPLATE-NAME/template/directory/currency-top.phtml and write the following code in it :-
<?php if($this->getCurrencyCount()>1): ?>
<div class="box language-switcher" style="margin-left:15px">
<label for="select-language">Your Currency: </label>
<select name="currency" onchange="changeCurrency(this)">
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<option value="<?php echo $_code ?>"<?php if($_code==$this->getCurrentCurrencyCode()): ?> selected="selected"<?php endif; ?>>
<?php echo $_name ?> - <?php echo $_code ?>
</option>
<?php endforeach; ?>
</select>
</div>
<script type="text/javascript">
//<![CDATA[
function changeCurrency(sObject){
if(sObject.value){
setLocation('<?php echo $this->helper('directory/url')->getSwitchCurrencyUrl() ?>currency/'+sObject.value);
}
}
//]]>
</script>
<?php endif; ?>
/app/design/frontend/template/default/YOUR-TEMPLATE-NAME/layout/page.xml
Add currency_top block after store_language block inside header block of page.xml present around line #66 :-
<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="directory/currency" name="currency_top" template="directory/currency-top.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>
</block>
Add getChildHtml(‘currency_top’) below getChildHtml(’store_language’) in
/app/design/frontend/template/default/YOUR-TEMPLATE-NAME/template/page/html/header.phtml like below :-
<?php echo $this->getChildHtml('store_language') ?>
<?php echo $this->getChildHtml('currency_top') ?>
<?php
$_category = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);
$helper = Mage::helper('catalog/category');
?>
<ul>
<?foreach ($collection as $cat):?>
<?php if($_category->getIsActive()):?>
<?php
$cur_category = Mage::getModel('catalog/category')->load($cat->getId());
$_img = $cur_category->getImageUrl();
?>
<li>
<a href="<?php echo $helper->getCategoryUrl($cat);?>">
<img src="<?php echo $_img?>" title="$cat->getName()"/>
<cite><?php echo $cat->getName();?></cite>
</a>
</li>
<?php endif?>
<?php endforeach;?>
</ul>
It seems my posts lately are always in relation to solving a problem or answering a question for someone else. If you’re looking for a way to display categories in the sidebar, change category display, or create a category menu then this post is probably for you.
The first thing you need to do is create a block in your layout. Navigate to /app/design/frontend/default/default/layout/catalog.xml
The first thing in your layout is a definition of the default layout noted by the comment “Default layout, loads most of the pages” depending on where you want to put your category nav (right sidebar, left sidebar, footer, etc) you’ll need to define the block a little differently. I’m going to do it with the left sidebar so you see what’s going on.
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav"
template="catalog/navigation/left_nav.phtml" />
</reference>
Okay, so what i did was locate the left sidebar which is referenced simply as “left” inside those tags i define my block type and template. The next thing you’ll want to do is create that template file, note that i defined it within /app/design/frontend/default/default/template/catalog/navigation/left_nav.phtml so i will need to create that file.
Once I’ve created the file, it’s time to put in my code to populate my links automatically of all my categories:
<h2>Browse</h2>
<div class="block">
<ul id="nav_category" class="nav_category">
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php echo $this->drawItem($_category) ?>
<?php endforeach ?>
</ul>
</div>
<?php echo $this->getChildHtml('topLeftLinks') ?>
If you want to take this a step further, you can target subcategories based on current page with this little script
<?php $obj = new Mage_Catalog_Block_Navigation();
$store_cats = $obj->getStoreCategories();
$current_cat = $obj->getCurrentCategory();
$current_cat = (is_object($current_cat) ? $current_cat->getName() : '');
foreach ($store_cats as $cat) {
if ($cat->getName() == $current_cat) {
echo '<li class="current"><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a>\n<ul>\n";
foreach ($obj->getCurrentChildCategories() as $subcat)
{
echo '<li><a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a></li>\n";
}
echo "</ul>\n</li>\n";
} else {
echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a></li>\n";
}
}
?>
How to Setup a Dual Currency Magento Shop
Login as admin and select System->Configuration, then select ’Currency Setup’ from GENERAL section,
then select Base currency, Default display currency, allowed currencies (press Control Key and Click the needed currencies) and ’Save Config’
Now come to "System->Manage Currencies’ menu
Click in Import currencies to load the exchange rate(s).
You are done. Visit the frontend and reload (you may need to refresh your cache) to see the drop down added to your product pages.
i am using
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}
in my home cms
At last I found the solution
{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}
this code is work fine but I had some misunderstanding. I have solve it to go
Catalog > Manage Products edit or add a product go to the general -> Set Product as New from Date and set a updated date then you can see the new product in your home page.