Guest User

Untitled

a guest
Nov 24th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. $installer = $setup;
  2. $installer->startSetup();
  3.  
  4. $installer->getConnection()->addColumn(
  5. $installer->getTable('sales_order_grid'),
  6. 'billing_company',
  7. [
  8. 'type' => Table::TYPE_TEXT,
  9. 'nullable' => true,
  10. 'comment' => 'Company Name',
  11. ]
  12. );
  13.  
  14. $setup->endSetup();
  15.  
  16. public function __construct()
  17. {
  18.  
  19. }
  20.  
  21. public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
  22. {
  23. $setup->startSetup();
  24.  
  25. if (version_compare($context->getVersion(), '1.0.1', '<')) {
  26. $connection = $setup->getConnection();
  27. $grid = $setup->getTable('sales_order_grid');
  28. $source = $setup->getTable('customer_grid_flat');
  29.  
  30. $connection->query(
  31. $connection->updateFromSelect(
  32. $connection->select()
  33. ->join(
  34. $source,
  35. sprintf('%s.customer_id = %s.entity_id', $grid, $source),
  36. 'billing_company'
  37. ),
  38. $grid
  39. )
  40. );
  41. }
  42.  
  43. $setup->endSetup();
  44. }
Add Comment
Please, Sign In to add comment