Jul 24, 2012
kalpesh

Magento: Add customer Facebook, Twitter, Google+, Pinterest handles

It’s always a good idea to get as much information as you get from customer. Adding customer’s social networking usernames are common in most of the sites, which can allow you to post content to their wall regarding any purchase customer made. It helps you to get more visibility of your store in front of customer’s friends and whoever visits their page.

So, you will need to add these in database, so that it can reflect to the customer’s account:

1
2
3
4
5
6
7
8
9
10
11
12
13
$installer = $this;
$installer->startSetup();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('customer', 'facebook', array(
    'label'     => 'Facebook',
    'type'      => 'varchar',
    'input' => 'text',
    'default'   => '',                      
    'visible'   => true,
    'required'  => false,
    'unique'    => true,
    'user_defined'  => true,
));

Continue reading »

Jul 21, 2012
kalpesh

Magento: How to run/set cron in Magento

Ever came with the requirement where you need to set cron for periodically running certain jobs automatically? If you are new to cron in Magento, this blog post is going to help you out. Cron is a time-based job scheduler in Unix-like computer operating systems.

There are basically two crons: one is system’s cron (Unix, where it will trigger the specified file, for each specified time (in terms of minute, hour, day, week, year) AND another is Magento’s internal cron where it will decide which file and method to call to complete the operation.
Continue reading »

Jul 21, 2012
kalpesh

Migrate magento to new server / domain / database / host

Move or migrate magento to new server, domain, database, host, anything by following the steps below.

To configure your Magento with a new domain, you will need to do following steps:

– Copy whole Magento project from current server and paste it to the new server.
You can do server-to-server transfer. First, tar.gz your magento project
tar -cvf magento.tar.gz magento
Then copy it to your new server from old server
scp magento.tar.gz root@your.ip.address.here:/var/www/.

– Backup the database (Admin -> System -> Tools -> Backup)
You can also take backup through phpMyAdmin, or by mysql.
mysqldump -u user -p database > /path/to/keep/db.sql

– Logout from your old server. Login to new server.
Extract the file magento.tar.gz that you sent from old server
tar -zxvf magento.tar.gz
Continue reading »

Jul 19, 2012
kalpesh

Magento Interview questions and answers

Magento Interview questions and answers for freshers as well as experienced developers.

1. Explain Magento’s MVC architecture

First of all, what is MVC?

MVC stands for Model-View-Controller. Any application that separates it’s data access, business logic and user interface is called MVC. There can be two types of MVC: convention-based and configuration-based. Example, cakePHP is convention-based, i.e. you just need to follow the instructions of the core system to get your module ready in just few lines. Magento is configuration-based, i.e. you need to specify each and every thing to your module’s config file in order to get it work. Magento has controllers (for request/response routing), Block (for rendering content), Model (for business logic), Resource/Mysql4 (for database operations), etc (for module-specific configuration files), Helper (for common functions), sql (for setup scripts), layout (for connecting block with templates for each controller action) and template/.PHTML file (for Presentation i.e. View).
Continue reading »

Jul 12, 2012
kalpesh

Magento add radio / checkbox button to admin grid

Add custom column in admin Grid which will show radio/checkbox button. I know this is weird, but some people need this as a requirement. Here I will show you how you can have radio button or checkbox button that you can have directly in your grids.

For radio button,

1
2
3
4
5
6
7
8
$this->addColumn('some_id', array(
            'header_css_class' => 'a-center',
            'header'    => Mage::helper('adminhtml')->__('Some Header'),
            'type'      => 'radio',
            'html_name' => 'items[]',
            'align'     => 'center',
            'value'    => array('1')
        ));

Continue reading »

Pages:«1...24252627282930...35»

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications