Tuesday, October 23, 2012

Magento module direct download link

If there is problem to install the magento extension through the magento connect ,then you can download the module zip file using extension key using the following url


http://freegento.com/ddl-magento-extension.php


Enjoy!!!!!!

Wednesday, October 17, 2012

How to get default configuration store scope setting value in mgento

Hi Guys,

One day i need to pull the country collection of selected in the Allow country list in under general tab for default configuration store scope but not getting any clue for this. After 4-5 hours review the code and database table finally  i success to do this. I don't know this is right way or not but it works . it may helpsome who want to such a things.......

////////////////////////////////////

             $rr= Mage::getConfig()->getNode('general/country/allow','default');
$rr=explode(',',$rr);
$options =Mage::getModel('directory/country')->getCollection()
->addFieldToFilter('country_id',array('in'=>$rr))
->load()
->toOptionArray();


///////////////////////////////////////
 This line       $rr= Mage::getConfig()->getNode('general/country/allow','default');  help to choose the country id string for default scope value. And then we can get the selected country's  list.


enjoy!!!!!

Friday, July 13, 2012

How to add breadcrumb on contact us page in magento

If want to add breadcrumbs on the contact us page ,
open the layout file of your theme contacts.xml and serach the following code between
 the
   <contacts_index_index translate="label">
.......
......
</contacts_index_index>

and add the following line of code


<reference name="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo>
                <label>Home</label>
                <title>Home</title>
                <link>/</link>
            </crumbInfo>
        </action>
        <action method="addCrumb">
            <crumbName>Contacts</crumbName>
            <crumbInfo>
                <label>Contact Us</label>
                <title>Contact Us</title>
            </crumbInfo>
        </action>
    </reference>


Tuesday, July 10, 2012

How to remove customer data only from session in magento

If you want to remove only customer data from the magento session you can try like

Mage::getSingleton('customer/session')->unsetAll() ;


and enjoy!!!!!!!

Thursday, April 19, 2012

Magento User Sessions Mixed Up ,full page cache

One day I faced a new problem in magento enterprise edition. When a new user create account and goes to my account section the welcome message display right ...but when user goes to others CMS pages the welcome messages change with another name. I was very frestrated with this problem and after digging 1 hour finally I overcome this probelm.
The realy problem was that ful page caching was on in admin caching section.

admin->system->caching management


I disable that one and everything become correct.

Hope this will help someone.

Cheers!!!!!!!!

Friday, April 6, 2012

How to show cutomer street address in Admin Grid like street1 and Street2 :Solved

Hi
I search everywhere to show the street address in customer grid in admin end But no found any solution for this.
Finally I review the code and make a new way to do this .

1. copy file Grid.php form ...app\code\core\Mage\Adminhtml\Block\Customer\Grid.php  to .....app\code\local\Mage\Adminhtml\Block\Customer\Grid.php



2. open the customer 's Grid.php in ....app\code\local\Mage\Adminhtml\Block\Customer\Grid.php

and add the follwing code in _prepareColumns() function

\\\\\\\\\\\\\\\\\\\\\


 $this->addColumn('street1', array(
          'header'    => Mage::helper('customer')->__('Street 1'),
          'index'     => 'entity_id',
 'renderer'=> new Mage_Adminhtml_Block_Customer_Renderer_Street1()
         ));
$this->addColumn('street2', array(
          'header'    => Mage::helper('customer')->__('Street 2'),
          'index'     => 'entity_id',
 'renderer'=> new Mage_Adminhtml_Block_Customer_Renderer_Street2()
         ));


\\\\\\\\\\\\\\\\\\\\\\\

2. make a directory in  ....app\code\local\Mage\Adminhtml\Block\Customer\     named  Renderer

and create two files in  ....app\code\local\Mage\Adminhtml\Block\Customer\Renderer\

Street1.php
for code
\\\\\\\\\\\\\\\\

class Mage_Adminhtml_Block_Customer_Renderer_Street1 extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{

public function render(Varien_Object $row)
{
$value =  $row->getData($this->getColumn()->getIndex());

 $customer = Mage::getModel('customer/customer')
 ->load($value); //put customer id here

$data = array();

 foreach ($customer->getAddresses() as $address)
 {

    $data = $address->getStreet(1);

 

 }
 if(empty($data))
 {
 return '';
 }else{
 return $data;
 }



}

}


\\\\\\\\\\\\\\\\\

and second one is Street2.php

\\\\\\\\\\\\\\\\\\\\\\\\\\\\

class Mage_Adminhtml_Block_Customer_Renderer_Street2 extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{

public function render(Varien_Object $row)
{
$value =  $row->getData($this->getColumn()->getIndex());

 $customer = Mage::getModel('customer/customer')
 ->load($value); //put customer id here

$data = array();

 foreach ($customer->getAddresses() as $address)
 {

    $data = $address->getStreet(2);

    //var_dump($data);

 }
if(empty($data))
 {
 return '';
 }else{
 return $data;
 }

}

}

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


and that all done.


Enjoy!!

Thursday, April 5, 2012

Store view is not listing in admin magento: SOLVED

In magento 1.6.X there may be a that multiple store listing not comes in admin end.
i comes to accross this issue and find out the solution
go to file ...app\code\core\Mage\Adminhtml\Block\Widget\Grid.php


and replace this code



public function getRowUrl($item)
    {
        $res = parent::getRowUrl($item);
        return ($res ? $res : '#');
    }

with



public function getRowUrl($item)
    {
        $res = parent::getUrl($item);
        return ($res ? $res : '#');
    }


and enjoy!!!!!!!

Monday, April 2, 2012

Change toolbar select to label magento


  <div style="float:left;width: 54%;">
    <div class="amount" style="float: left; ">
            <?php if($this->getLastPageNum()>1): ?>
                <?php echo $this->__('Viewing Items %s-%s of %s ', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
            <?php else: ?>
<?php echo $this->__('Viewing Items %s-%s of %s ', $this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
            <?php endif; ?>
        </div>

        <div class="limiter" style="float: right; padding-right: 34px;">
            <label><?php echo $this->__('View') ?></label> &nbsp;&nbsp;
           <?php $cnt=1;?>
            <?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?>
                <a href="<?php echo $this->getLimitUrl($_key) ?>">
                    <?php echo $_limit ?>
                </a><?php echo ($cnt==4?'':'&nbsp;|&nbsp')?>
<?php $cnt++; ?>
  <?php endforeach; ?>
           &nbsp; <?php //echo $this->__('per page') ?>
        </div>

    </div>

Friday, March 23, 2012

How to call a .phtml block file into another .phtml file in magento

you can call a .phtml block file into another .phtml  like

<?php echo $this->getLayout()->createBlock('catalog/product_list_related')->setTemplate('catalog/product/list/related.phtml')->toHtml();
 

?>

Wednesday, March 21, 2012

How to get product attribute in .phtml file


you can Access the product attribute in the .phtml file like...

<?php echo $_product->getResource()->getAttribute('Attribute_code')->getFrontend()->getValue($_product); ?>