Tuesday, October 16, 2012

Get Magento Version in Magento Programmatically


If you need to get your Magento project version Programmatically use below code



$m= new Mage;
$version=$m->getVersion();
echo $version;


Wednesday, August 29, 2012

Sunday, July 29, 2012

Adding Custom Add to cart button in Magento


Hi,

we can create custom add to cart link or button from product id you can use below code


<button onclick="setLocation('<?php echo $this->getAddToCartUrl($_item) ?>')" class="button btn-cart" title="Add to Cart" type="button"><span><span>Add to Cart</span></span></button>

Tuesday, June 26, 2012

Happy Hours Module OR Hourly base promostion in Magento


Hi,
Happy Hours module
in this module

  1.  we can select days and between time only in that time and days discount can apply
  2. Select discount %
  3. Apply completed catalog products
  4. It can apply for special price or original price which you can set from back end

More detail contact me

Thursday, June 7, 2012

Displaying Subcategory or Top Level Subcategory in Left Nevegation in magento

Hi, Some time we need to display all Subcategory of the current category that is the level2 of current category’s subcategory so to solve this issue just set your current category id or just get current category id and set to $currentCategoryID variable i keep this file in root and run in browser you can make it use of this code and call in left navigation in list page



<?php

 define('MAGENTO', realpath(dirname(__FILE__)));
 require_once MAGENTO . '/../app/Mage.php';
 Mage::app();
 $currentCategoryID=99;
 
 function getParentTopCategory($category)
    {
        if($category->getLevel() == 2){
            return $category;
        } else {
            $parentCategory = Mage::getModel('catalog/category')->load($category->getParentId());
            return getParentTopCategory($parentCategory);
        }
    }
 function Subcategory($subcats){
 
  echo '<ul>'; foreach($subcats as $_category)
        {
           // $_category = Mage::getModel('catalog/category')->load($subCatId);
            if($_category->getIsActive())
            {
                $caturl = $_category->getURL();
                $catname = $_category->getName();
     echo '<li>';
                echo '<a href="'.$caturl.'" title="'.$catname.'">'.$catname.'</a>';
    echo '</li>';
     $subcats3 = $_category->getChildrenCategories();
      if ($subcats3) {
      Subcategory($subcats3);
      }
     
    
    
     
     
            }
        }
  echo '</ul>';
 
 }

  //  $openCatId =  getParentTopCategory(Mage::getModel('catalog/category')->load($currentCategoryID))->getId();
  //OR you can use below code to get parent catgeory id of lavel 2 
  
 $path=explode('/',Mage::getModel('catalog/category')->load($currentCategoryID)->getPath());
 $openCatId= $path[2];
    $cat = Mage::getModel('catalog/category')->load($openCatId);
    
    $subcats = $cat->getChildrenCategories();
    
    if ($subcats) {
        foreach($subcats as $_category)
        {
            if($_category->getIsActive())
            {
                $caturl = $_category->getURL();
                $catname = $_category->getName();
                echo '<a href="'.$caturl.'" title="'.$catname.'">'.$catname.'</a><br>';
     $subcats2 = $_category->getChildrenCategories();
    
    //  exit;
      if ($subcats2) {
      Subcategory($subcats2);
      }
            }
        }
        
    }
 ?>


http://www.magentocommerce.com/boards/viewthread/283368/