1

How to get field value in adminhtml grid based on other table? For example I have in table id of record from another table which have field "name" and need to show field "name" instead of id.

2

you have to override the _prepareCollection() method in your Grid.php file to add desired join conditions to entity collection.

Depending on entity type (EAV or Flat) you can use different join methods.

I suggest you to take inspiration from Magento itself; here are some files where you can look at to find some examples:

  • /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php
  • /app/code/core/Mage/Adminhtml/Block/Customer/Grid.php
  • /app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php

After joining new fields remember also you have to add related columns by overriding the _prepareColumns() method.

Hope it helps.

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.