Magento: user module: managing multiple tables

I am working on a custom magento module [created by the module creator]. There is a requirement to create a Child table that maintains a relationship to the default table / parent account using primary / foreign key references.

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

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

Please provide me with a way to manage this module.

I just tried the default join clause as shown below:

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

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

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

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

+4
source share
1 answer

What you are asking for is a very advanced aspect of Magento (user code and admin functionality). I would advise you to go through online or in-person training, as it is difficult to describe in response to stackoverflow (I went through training, and this, frankly, is a 10-step process that takes about an hour to just copy / paste the demo code - user work probably will be 4 to 6 hours). Your question is also somewhat incomplete - you need more information if you have problems with sql-specific. You also never want to call selection commands from a block - they must be controlled using models, and you must also call your collections your models.

0
source

Source: https://habr.com/ru/post/1382898/


All Articles