5

I am working on magento custom module [created by module creator]. There is a requirement to create a Child table which maintains the relation to the default/parent table by means of primary/foreign key references.

There is a one-to-many relation from parent-to-child table.

I need to have the Grid interface and Edit interface to update/save all relevant data.

Please, provide me the way to manage this module.

I have just tried the join clause on default data collection as below:

===============================

In protected function _prepareCollection() At "\app\code\local\Klimaire\WarrantyRegProd\Block\Adminhtml\WarrantyRegProd\"

$collection->getSelect()->joinLeft('warrantyregprod_child','main_table.warrantyregprod_id = warrantyregprod_child.warrantyregprodID', 'warrantyregprod_child.prodcode');

===============================

1 Answers1

0

What you are asking for is a very advanced aspect of Magento (custom Admin code and functionality). I would suggest you go through online or in-person training as this is far to complex to describe in a stackoverflow answer (I went through training, and this is honestly a 10-step process that takes about an hour just to copy/paste demo code -- custom work will probably be anywhere from 4-6 hours to complete). Your question is also somewhat incomplete -- need more info if you are having sql-specific problems. You also never want to call select statements from a Block - these should be managed by Models, and you should also call your collections from your Models.

Mark Shust at M.academy
  • 6,300
  • 4
  • 32
  • 50
  • Hii Mark, Thanks for reply..! :) Question: how can I assign the child table values in text-box/[input elements] while one is editing the record of default/parent table? I have tried to do it but, it does not take the assigned value. Please, help in this. – user1064021 Nov 25 '11 at 05:44