Dynamic Magento Grid built with database query

This is my first time asking a question here so, be nice;p .. I’m working with Magento (and Zend Framework) for the first time and I’m trying to build a custom grid that will populate based off of a manually written query. I’m trying to extend the Mage_Core_Model_Mysql4_Collection_Abstract to allow a query to be loaded into it and then parse the select fields in the extended Grid class to make it dynamic… Is this even possible or am I beating a dead horse? I’ve been at it for a week now and I’m not getting anywhere. The problem seems to be that inside the __Model_mysql4_Collection class has to be initialized with a resource model using _init() in the constuct

One thought on “Dynamic Magento Grid built with database query”

  1. As a learning exercise use the module creator to make an admin grid page and see how that is done. Or even modify it’s output to get what you need.

    There will be a grid container block, a grid block (with _prepareCollection and _prepareColumns methods), a model, a resource model (representing a single record) and a collection resource model (representing several records).

    Providing your own _init methods shouldn’t be any sort of problem. Perhaps you’d like to post your config.xml and code so far as a pastebin or something.

Leave a Reply

Your email address will not be published. Required fields are marked *