Answer the question
In order to leave comments, you need to log in
How to create a table through one-to-many magento ORM?
How to create a table through one-to-many magento ORM? There is a Promotion and 100-1000000 products can be tied to it. Shares table added next. thus:
$installer = $this;
$table = $installer->getTable('webpromotions/promotions');
$installer->startSetup();
$installer->getConnection()->dropTable($table);
$tablePromotions = $installer->getConnection()
->newTable($table)
->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
'identity' => true,
'nullable' => false,
'primary ' => true,
))
->addColumn('promotions_name', Varien_Db_Ddl_Table::TYPE_VARCHAR, '255',
))
->addColumn('description', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
'nullable' => false,
))
->addColumn('image', Varien_Db_Ddl_Table::TYPE_VARCHAR, '255', array(
'nullable' => false,
))
->addColumn('is_enabled', Varien_Db_Ddl_Table::TYPE_TINYINT, '255', array(
'nullable' => false,
))
->addColumn('sort_order', Varien_Db_Ddl_Table::TYPE_VARCHAR, '255' , array(
'nullable' => false,
))
->addColumn('static_blocks', Varien_Db_Ddl_Table::TYPE_TEXT, null,array(
'nullable' => false,
))
->addColumn('category', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
'nullable' => false,
))
->addColumn('promotions_products', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
'nullable' => false,
));
$installer->getConnection()->createTable($tablePromotions);
$installer->endSetup();
How can I link a table to this table in which it will be possible to store the id of the products that are linked to this promotion? Thank you)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question