1

I am working with custom grid. I have a literal value I need to pass to _prepareColumns(). Rather than setting up a custom renderer, I want to just add the literal value to the main collection.

In mysql it would be something like:

SELECT *, "my literal value" as "my_column" from some_table;

Is there any way I can add this to:

$collection = Mage::getModel('me/mymod')->getCollection();

Else, is there another way I can pass a value from _prepareCollection() to _prepareColumns() without using custom renderer?

0

please try something like this:

$collection = Mage::getModel('me/mymod')->getCollection();
    $collection->getSelect()
        ->columns(
            array(
                new Zend_Db_Expr("\"my literal value\" as `my_column`")
            )
        );

If I understand you right - this is way you need.

Hope it's helpfull.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.