title: Magento - How to add a custom render to a custom column in the orders grid?
body: <p>For a Magento website, I would like to show custom options in the orders grid in the backoffice.</p>
  
  <p>Currently, I've successfully added a custom column to the grid with the help of <a href="http://www.atwix.com/magento/column-to-orders-grid/" rel="nofollow">this guide</a> and <a href="http://www.atwix.com/magento/adding-sku-column-to-orders-grid/" rel="nofollow">this guide</a>, using a module to avoid to rewrite the core classes.</p>
  
  <p>Now, I've a long string appearing in a column and I would like to serialize it to have the custom options, but I can't manage to use a custom renderer.</p>
  
  <p>/app/code/local/Atwix/ExtendedGrid/Helper/Data.php :</p>
  
  <pre><code>public function getProductOptionsColumnParams()
  {
      return array(
          'header' =&gt; 'Products Options',
          'index' =&gt; 'product_options',
          'type' =&gt; 'text',
          'renderer' =&gt; array('Atwix_ExtendedGrid_Model_Observer', 'render'),
      );
  }
  </code></pre>
  
  <p>I've added a renderer which links to the Model Observer (/app/code/local/Atwix/ExtendedGrid/Model/Observer.php), but this doesn't work, it only shows a white page instead of the table...</p>
  
  <p>Where did I do a mistake ? The "render" function cannot be in the Observer ? I tried to create a class which extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract in /app/code/local/Mage/Adminhtml/Block/Sales/Order (near to Grid.php) but it doesn't work either.</p>
  
  <p>UPDATE 1 :</p>
  
  <p>It doesn't work, I've created the file <code>/app/code/local/Atwix/ExtendedGrid/Block/Adminhtml/ExtendedGrid/Renderer/Renderer.php</code> with the code :</p>
  
  <pre><code>class Atwix_ExtendedGrid_Block_Product extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
  {
      public function render(Varien_Object $row) {
          $value =  $row-&gt;getData($this-&gt;getColumn()-&gt;getIndex());
          return '&lt;span style="color:red;"&gt;'.$value.'&lt;/span&gt;';
      }
  }
  </code></pre>
  
  <p>And in /app/code/local/Atwix/ExtendedGrid/Helper/Data.php I have this code :</p>
  
  <pre><code>class Atwix_ExtendedGrid_Helper_Data extends Mage_Core_Helper_Abstract
  {
      /**
       * parameters for addColumnAfter method
       * @return array
       */
      public function getSkusColumnParams()
      {
          return array(
              'header' =&gt; 'SKUs',
              'index' =&gt; 'skus',
              'type' =&gt; 'text',
              'filter_condition_callback' =&gt; array('Atwix_ExtendedGrid_Model_Observer', 'filterSkus'),
          );
      }
      /**
       * parameters for addColumnAfter method
       * @return array
       */
      public function getProductOptionsColumnParams()
      {
          return array(
              'header' =&gt; 'Products Options',
              'index' =&gt; 'product_options',
              'type' =&gt; 'text',
              'renderer' =&gt; array('Atwix_ExtendedGrid_Block_Product', 'render'),
          );
      }
  }
  </code></pre>