Category: magento 2

magento 2, Magento 2 Dev Guide Book Note, Magento Module

Magento 2: How to call any template block from phtml file?

  https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts In Magento 1.x, you could call/print any module’s template block in any other template (phtml) file with the following code: 1 2 3 4 echo $this->getLayout()           ->createBlock('newmodule/newblock')           ->setTemplate('newmodule/newblock.phtml')           ->toHtml(); In Magento 2.x, it’s slightly different. Below is the...

magento 2

Install table setup in Magento 2

$table = $setup->getConnection() ->newTable($setup->getTable('mjweb_customer_rewards')) ->addColumn('id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, array( 'identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true, ), 'Id') ->addColumn('customer_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, array( 'nullable' => false, 'unsigned' => true, 'nullable' => false, ), 'Customer ID') ->addColumn('rewards_point', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,...