Showing posts with label show. Show all posts
Showing posts with label show. Show all posts

Wednesday, September 28, 2011

How to show only first name in magento welcome message?

Comment the welcome message code in "template/page/html/header.phtml" and Use the below code to show first name only.
$customer = Mage::getSingleton('customer/session')->getCustomer()->getData();
if(Mage::getSingleton('customer/session')->isLoggedIn()){
   echo $this->__('Welcome, %s!', $customer['firstname']);
}else{
   echo $this->__('Welcome Guest');
}

Monday, September 19, 2011

How to show all the manufactures or brand list in magento left sidebar?

create a manufacturers.phtml file under "app/design/frontend/default/YOURTHEME/template/catalog/product"
<?php
/*
 * Manufacturers Listing on sidebar
 * @category    design
 * @package     base_default
 */
?>

<div>
  <div>
    <h4><span>Our Brands</span></h4>
  </div>
  <div>
  <?php
    $product = Mage::getModel('catalog/product');
    $attributes = Mage::getResourceModel('eav/entity_attribute_collection')
                  ->setEntityTypeFilter($product->getResource()->getTypeId())
                  ->addFieldToFilter('attribute_code', 'manufacturer');
    $attribute = $attributes->getFirstItem()->setEntity($product->getResource());
    $manufacturers = $attribute->getSource()->getAllOptions(false);
   ?>
    <ul id="manufacturer_list">
      <?php foreach ($manufacturers as $manufacturer): ?>
      <li><a href="<?php echo Mage::getBaseUrl(); ?>catalogsearch/advanced/result/?manufacturer[]=<?php echo $manufacturer['value'] ?>"><?php echo $manufacturer['label'] ?></a></li>
      <?php endforeach; ?>
    </ul>
  </div>
  <div></div>
</div> 
Add the below code in your "/app/design/frontend/default/YOURTHEME/layout/catalog.xml" file.



Thats it you are done.

Wednesday, September 14, 2011

How to show country flag in Magento language or currency dropdown?

Edit your page.xml file ("app/design/frontend/default/YOURTHEME/layout/page.xml")
Around line 58 change
 
to
 
Note: You have to place your country flag images under "skin/frontend/default/YOURTHEME/images/flag/flag_FLAGNAME.jpg"..
Using firebug in mozilla find out the image name and place the image in apprpriate folder.

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');