I’ve the below mentioned code where I have to check if the attribute in as mentioned in question above is really a buyer attribute or buyer address attribute.
How do you make sure that?
private $custom_columns = array();
public function __construct()
{
parent::__construct();
$this->setId(‘customerGrid’);
$this->setUseAjax(true);
$this->setDefaultSort(‘email’);
$this->setDefaultLimit(’200′);
$this->setSaveParametersInSession(true);
$attributeIds = Mage::getStoreConfig(‘sectionname/group/field’);
$this->custom_columns = array($attributeIds);
}
$attributeIds gives back attribute codes like street basically if I choose Home Address, gender if I choose Gender and so forth. Ok now what condition ought to be put
to be able to know whether confirmed attribute is buyer or address attribute?
// Prepare Collection addition to store custom fields
foreach ($this->custom_columns as $col)
{
//Some Condition if its a Customer attribute
collection->addAttributeToSelect($col);
//else some condition if its a Customer address attribute
$collection->joinAttribute($col, “customer_address/$col”, ‘default_billing’, null, ‘left’);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
Among the finest to be aware what individuals conditions could be. Hope this can be more clearer to you.