unexpected[it]

Professional IT Blog

  • 7th, Jul 2010

Magento Report with Column with Fixed Text

Tags: , , , ,

    protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel('customer/customer_collection')
            ->addNameToSelect()
            ->addAttributeToSelect('email')
            ->addAttributeToSelect('created_at')

            ->joinAttribute('billing_company', 'customer_address/company', 'default_billing', null, 'left')
            ->joinAttribute('billing_street', 'customer_address/street', 'default_billing', null, 'left')
            ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing', null, 'left')
            ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing', null, 'left')
            ->joinAttribute('billing_city', 'customer_address/city', 'default_billing', null, 'left')
            ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing', null, 'left');

		//This line will add a default text 'No' to all column
		$collection->addExpressionAttributeToSelect('rentable', "CONCAT('No')", array("email"));            

        $this->setCollection($collection);
        //echo $collection->getSelectSql();

        return parent::_prepareCollection();
	}

© 2010 unexpected[it]. All Rights Reserved.

This blog is powered by Wordpress and a modified version of Magatheme