Recent Posts


Customer Confirmation


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

This one’s a little un-intuitive. At first.

There are times where you’ll want to programmatically check if a customer is confirmed. To do this you’d instantiate a customer object like this

$customer = Mage::getModel('customer/customer')->getCollection()

or like this

$customer = Mage::getModel('customer/customer')->load(197);
$customer = Mage::getModel('customer/customer')->loadByEmail('');

However, if you dump out the data of a confirmed customer,


you won’t see a confirmation value. Maybe it’s EAV, so you add all the attributes to the select

$customer = Mage::getModel('customer/customer')->getCollection()

Still Nothing. You might spent a lot of time cursing EAV and listeners, wondering where-the-heck the confirmation value is stored, and how-the-heck you’re supposed to load it from a customer object.

However, if you load a customer that hasn’t been confirmed and dump out the object’s data, you’re going to see something like this

  'confirmation' => string '700df1' (length=6)

which is a hint to what’s really going on.

There is a confirmation attribute associate with each object, but (in retrospect) it should have been named confirmation_key. Magento uses the attribute to store the key value that’s passed into the system when a customer click the confirmation link in their email.

That means if there’s a value in confirmation, then the customer is not confirmed, meaning if confirmation is empty then the customer is confirmed. The reason you don’t see any value in there for a confirmed customer is Magento removes the value after a customer is confirmed, so there’s nothing for EAV to load.

A little counter intuitive, but once you understand the intent of the attribute (store the confirmation key), it makes a lot more sense.

Copyright © Alan Storm 1975 – 2022 All Rights Reserved

Originally Posted: 8th July 2011