gridview - add column SELECT filter in grid menu -
i’m trying add select in column “sources” allow filter, code works well, i’m trying add filter without success, can point me in right direction?
until know have:
protected function _preparecollection() { $collection = mage::getresourcemodel('customer/customer_collection') ->addnametoselect() ->addattributetoselect('email') ->addattributetoselect('created_at') ->addattributetoselect('group_id') ->joinattribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left') ->joinattribute('billing_city', 'customer_address/city', 'default_billing', null, 'left') ->joinattribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left') ->joinattribute('billing_region', 'customer_address/region', 'default_billing', null, 'left') ->joinattribute('source', 'customer/source', 'default_billing', null, 'left') ->joinattribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left'); $this->setcollection($collection); return parent::_preparecollection(); }
and
$this->addcolumn('source', array( 'header' => mage::helper('customer')->__('source'), 'type' => 'source', 'index' => 'source' ));
any apreciated thanks
i found solution transform in select option:
$sql = 'select distinct value `....'; $data = mage::getsingleton('core/resource') ->getconnection('core_read')->fetchall($sql); $sotypes=array(); foreach($data $array){ foreach($array $key => $value){ if(!empty($value)){ $so[$value]=$value; } } } $this->addcolumn('invoice_so', array( 'header' => mage::helper('sales')->__('sotypes'), 'index' => 'value', 'width' => '100px', 'type' => 'options', 'options' => $sotypes, ));
Comments
Post a Comment