Showing posts with label header. Show all posts
Showing posts with label header. Show all posts

Tuesday, September 20, 2011

How to add CSS and JS files in magento header?

Open your page.xml file and add the below lines
skin_csscss/YOURCSSFILENAME.css
skin_jsjs/YOURJSFILENAME.js
Refresh your cache. Thats it. You are done.

Monday, September 12, 2011

How to Show Language Switcher in Magento Header or Footer?

Step 1: Create a new phtml file "template/page/switch/stores-top.phtml" and write the following code in it:
<?php if(count($this->getGroups())>1): ?>
<div class="language-switcher" style="margin-left:15px">
    <label for="<span class="store" id="switcher">select</span>-store"><?php echo $this->__('Select Store') ?>: </label>
    <select id="select-store" onchange="location.href=this.value">
    <?php /*foreach ($this->getStores() as $_store): ?>
        <span class="IL_AD" id="IL_AD1">option value</span>="<?php echo $_store->getUrl('') ?>"<?php if($_store->getId()==$this->getCurrentStoreId()): ?> <span class="IL_AD" id="IL_AD4">selected</span>="selected"<?php endif; ?>><?php echo $_store->getName() ?></option>
    <?php endforeach;*/ ?>
    <?php foreach ($this->getGroups() as $_group): ?>
        <?php $_selected = ($_group->getId()==$this->getCurrentGroupId()) ? 'selected="selected"' : '' ?>
        <option value="<?php echo $_group->getHomeUrl() ?>" <?php echo $_selected ?>><?php echo $this->htmlEscape($_group->getName()) ?></option>
    <?php endforeach; ?>
    </select>
</div>
<?php endif; ?>
Step 2: Add store_switcher_top block after store_language block inside header block of "page.xml" present around line number 66.


    
    
    
    

step 3: Add getChildHtml('store_switcher_top') below getChildHtml('store_language') in "template/page/html/header.phtml" like below.
$this->getChildHtml('store_language');
$this->getChildHtml('store_switcher_top');

Configurable products options are empty after moving my cart side bar to header?

I have explained Moving Cart from Right Sidebar to Header in this tutorial. After moving my cart to header I have noticed configurable options are not shown up in header. To display configurable product options do the following.

Edit your "template/checkout/cart/sidebar/default.phtml" file.
Find the line if ($_options = $this->getOptionList()):

Replace with the following
$_product = Mage::getModel('catalog/product')->load($this->getProduct()->getId());
$config = new Mage_Catalog_Helper_Product_Configuration();  
if ($_options = $config->getConfigurableOptions($_item)): 
Thats it. You are done.