Saturday 13 September 2014

How do I keep two divs that are side by side the same height

Step 1 Css

    <style type="text/css">

     html{ height:100%;}

     body{ position:absolute; width:100%; height:100%; padding:0; margin:0; font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#333;}

     .wp{ width:1000px; margin:0 auto; height:100%;}

     .left_part{ background:#eee; color:#333; text-align:center; height:100%; float:left; width:300px;}

     .right_part{ background:#ccc; color:#333; text-align:center; height:100%; float:left; width:700px;}

    </style>


Step 2 Html

<body>
    <div class="wp">
       <div class="left_part"> Left Div <br/> Padding top and bottom not allowd </div>
       <div class="right_part"> Right Div <br/> Padding top and bottom not allowd  </div>
    </div>
 </body>
    

Friday 5 September 2014

Magento get category tree view

Output View


Step 1 Goto theme/layout/catalog.xml put this code in file


    <reference name="left">
    <block type="catalog/navigation" name="category_list_sidebar" template="catalog/navigation/categorymenu.phtml"/>
    </reference>

Step 2 Goto theme/template/catalog/ thane create navigation folder and put categorymenu.phtml file inside.


<?php
    $_helper = Mage::helper('catalog/category');
    $_categories = $_helper->getStoreCategories();
    $currentCategory = Mage::registry('current_category');
    ?>
    <div class="block block-list block-categorys">
        <div class="block-title">
       <strong><span>Category</span></strong>
        </div>
    <div class="block-content">
        <ul class="category_sub">
    <?php if (count($_categories) > 0){ ?>
    
                    <?php
    global $index;
    global $data;
   
    foreach($_categories as $_category){
    
    $check_child_class = check_child_par($_category->getId());
    $collaps = ($check_child_class)? "<span class='show-cat'>+</span>" : "";
    echo "<li class='".$check_child_class."'>";
    echo "<a href='".$_helper->getCategoryUrl($_category)."'>".$_category->getName();
    echo " (".product_count($_category->getId()).")";
    echo "</a>".$collaps;
    echo check_child($_category->getId());
    echo "</li>";
   
    }
    }
    function check_child($cid){
    $_helper = Mage::helper('catalog/category');
    $_subcategory = Mage::getModel('catalog/category')->load($cid);
    $_subsubcategories = $_subcategory->getChildrenCategories();
   
    if (count($_subsubcategories) > 0){
    echo "<ul>";
    foreach($_subsubcategories as $_subcate){
   
    $check_child_class = check_child_par($_subcate->getId());
    $collaps = ($check_child_class)? "<span class='show-cat'>+</span>" : "";
   
    echo "<li class='".$check_child_class."'>";
    echo "<a href='".$_helper->getCategoryUrl($_subcate)."'>".$_subcate->getName();
    echo " (".product_count($_subcate->getId()).")";
    echo "</a>".$collaps;
    echo check_child($_subcate->getId());
    echo "</li>";
    }
    echo "</ul>";
    }else{
    return "";
    }
    }
   
   
    function check_child_par($cid){
   
    $_subcat = Mage::getModel('catalog/category')->load($cid);
    $_subsubcats = $_subcat->getChildrenCategories();
   
    if (count($_subsubcats) > 0){
    return "parent";
    }else{
    return "";
    }
    }
   
    function product_count($cid){
    $products_count = Mage::getModel('catalog/category')->load($cid)->getProductCount();
    return $products_count;
    }
    ?>
    </ul>
    </div>
    </div>

Thursday 4 September 2014

Magento import newsletter subscribers csv

Step 1
Add import.php file in Magento root directory 

Step 2
Add subscribers.csv file in Magento root directory

Step 3
Run import.php file in root directory like ( http://localhost/magento/import.php )

Step 4
Go to admin menu Newsletter > Newsletter Subscribers and finally you subscriber user CSV file import