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/

Tuesday, May 29, 2012

Disabling Google Tracking from a particular system or browser in Google analytic

Hi, We can disable or switch of Google tracking from Google analytic of a particular system or browser just download this file and then edit your Google analytic account and save it place this file in root folder and then run this .html file in browser so this will make Google analytic not track you click in your account so you will get clicks or tracking from other system Note:- Please run in your system in every browser and also run when you clear your cache so it will set your browser not track in Google Just Download the file from this link http://www.magentocommerce.com/boards/viewthread/282323/

Friday, May 18, 2012

Calling block programmatically in magento

Module page



<?php echo $this->getLayout()->createBlock('newmodule/newblock')->setTemplate('newmodule/newblock.phtml')->toHtml(); ?>



Calling Static Block



<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('indentifer')->toHtml() ?>



OR




$block = Mage::getModel('cms/block')->load('identifier');
echo $block->getTitle();
echo $block->getContent();

In CMS PAge

{{block type='core/template' template='callouts/topslider.phtml' }}