/app/code/community/Devinc/Groupdeals/sql/groupdeals_setup/mysql4-install-0.1.0.php

https://bitbucket.org/acidel/buykoala · PHP · 128 lines · 110 code · 15 blank · 3 comment · 0 complexity · f74e147c5ea656c5805fca2fb3d263d0 MD5 · raw file

  1. <?php
  2. $installer = $this;
  3. // Create attribute set and deal attributes
  4. Mage::getModel('groupdeals/groupdeals')->createAttributeSet();
  5. // Add tables
  6. $installer->startSetup();
  7. $installer->run("
  8. DROP TABLE IF EXISTS {$installer->getTable('groupdeals')};
  9. CREATE TABLE {$installer->getTable('groupdeals')} (
  10. `groupdeals_id` int(11) unsigned NOT NULL auto_increment,
  11. `product_id` int(11) NOT NULL,
  12. `merchant_id` int(11) NOT NULL,
  13. `country_id` varchar(255) NOT NULL default '',
  14. `region` varchar(255) NOT NULL default '',
  15. `city` varchar(255) NOT NULL default '',
  16. `date_from` date NULL,
  17. `date_to` date NULL,
  18. `time_from` varchar(255) NOT NULL default '',
  19. `time_to` varchar(255) NOT NULL default '',
  20. `minimum_qty` int(11) NOT NULL,
  21. `sold_qty` int(11) NOT NULL,
  22. `maximum_qty` int(11) NOT NULL,
  23. `coupon_barcode` text NOT NULL default '',
  24. `coupon_merchant_address` int(11) NOT NULL,
  25. `coupon_merchant_contact` int(11) NOT NULL,
  26. `coupon_number` int(11) NOT NULL,
  27. `coupon_expiration_date` date NULL,
  28. PRIMARY KEY (`groupdeals_id`)
  29. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  30. DROP TABLE IF EXISTS {$installer->getTable('groupdeals_merchants')};
  31. CREATE TABLE {$installer->getTable('groupdeals_merchants')} (
  32. `merchants_id` int(11) unsigned NOT NULL auto_increment,
  33. `name` text NOT NULL default '',
  34. `description` text NOT NULL default '',
  35. `website` text NOT NULL default '',
  36. `email` text NOT NULL default '',
  37. `facebook` text NOT NULL default '',
  38. `twitter` text NOT NULL default '',
  39. `phone` text NOT NULL default '',
  40. `mobile` text NOT NULL default '',
  41. `business_hours` text NOT NULL default '',
  42. `address` text NOT NULL default '',
  43. `redeem` text NOT NULL default '',
  44. `paypal_email` varchar(255) NOT NULL default '',
  45. `authorize_info` text NOT NULL default '',
  46. `bank_info` text NOT NULL default '',
  47. `other` text NOT NULL default '',
  48. `status` int(11) NOT NULL,
  49. PRIMARY KEY (`merchants_id`)
  50. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  51. DROP TABLE IF EXISTS {$installer->getTable('groupdeals_subscribers')};
  52. CREATE TABLE {$installer->getTable('groupdeals_subscribers')} (
  53. `subscriber_id` int(11) unsigned NOT NULL auto_increment,
  54. `store_id` int(11) NOT NULL,
  55. `email` varchar(255) NOT NULL default '',
  56. `city` varchar(255) NOT NULL default '',
  57. PRIMARY KEY (`subscriber_id`)
  58. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  59. DROP TABLE IF EXISTS {$installer->getTable('groupdeals_notifications')};
  60. CREATE TABLE {$installer->getTable('groupdeals_notifications')} (
  61. `notification_id` int(11) unsigned NOT NULL auto_increment,
  62. `groupdeals_id` int(11) NOT NULL,
  63. `website_id` int(11) NOT NULL,
  64. `type` varchar(255) NOT NULL default '',
  65. `unnotified_subscriber_ids` text NOT NULL default '',
  66. `notified_subscriber_ids` text NOT NULL default '',
  67. `status` varchar(255) NOT NULL default '',
  68. PRIMARY KEY (`notification_id`)
  69. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  70. DROP TABLE IF EXISTS {$installer->getTable('groupdeals_coupons')};
  71. CREATE TABLE {$installer->getTable('groupdeals_coupons')} (
  72. `coupon_id` int(11) unsigned NOT NULL auto_increment,
  73. `groupdeals_id` int(11) NOT NULL,
  74. `order_id` int(11) NOT NULL,
  75. `coupon_code` varchar(255) NOT NULL default '',
  76. `status` varchar(255) NOT NULL default '',
  77. PRIMARY KEY (`coupon_id`)
  78. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  79. ");
  80. //Create configuration
  81. $installer->setConfigData('groupdeals/configuration/enabled', 1);
  82. $installer->setConfigData('groupdeals/configuration/header_links', 1);
  83. $installer->setConfigData('groupdeals/configuration/homepage_deals', '');
  84. $installer->setConfigData('groupdeals/configuration/sidedeals_number', '3');
  85. $installer->setConfigData('groupdeals/configuration/pdf_attachment', 1);
  86. $installer->setConfigData('groupdeals/configuration/countdown_type', 1);
  87. $installer->setConfigData('groupdeals/countdown_configuration/display_days', 0);
  88. $installer->setConfigData('groupdeals/countdown_configuration/bg_main', '#F6F6F6');
  89. $installer->setConfigData('groupdeals/countdown_configuration/bg_color', '#333333');
  90. $installer->setConfigData('groupdeals/countdown_configuration/alpha', '70');
  91. $installer->setConfigData('groupdeals/countdown_configuration/textcolor', '#FFFFFF');
  92. $installer->setConfigData('groupdeals/countdown_configuration/txt_color', '#333333');
  93. $installer->setConfigData('groupdeals/countdown_configuration/sec_text', 'SECONDS');
  94. $installer->setConfigData('groupdeals/countdown_configuration/min_text', 'MINUTES');
  95. $installer->setConfigData('groupdeals/countdown_configuration/hour_text', 'HOURS');
  96. $installer->setConfigData('groupdeals/countdown_configuration/days_text', 'DAYS');
  97. $installer->setConfigData('groupdeals/js_countdown_configuration/bg_main', '#F6F6F6');
  98. $installer->setConfigData('groupdeals/js_countdown_configuration/textcolor', '#333333');
  99. $installer->setConfigData('groupdeals/js_countdown_configuration/days_text', 'day(s)');
  100. $installer->setConfigData('groupdeals/notifications/email_sender', 'general');
  101. $installer->setConfigData('groupdeals/notifications/email_new_deal', 1);
  102. $installer->setConfigData('groupdeals/notifications/email_new_deal_template', 'groupdeals_notifications_email_new_deal_template');
  103. $installer->setConfigData('groupdeals/notifications/email_limit_met', 1);
  104. $installer->setConfigData('groupdeals/notifications/email_limit_met_template', 'groupdeals_notifications_email_limit_met_template');
  105. $installer->setConfigData('groupdeals/notifications/email_deal_over', 1);
  106. $installer->setConfigData('groupdeals/notifications/email_deal_over_template', 'groupdeals_notifications_email_deal_over_template');
  107. $installer->setConfigData('system/cron/schedule_generate_every', 1);
  108. $installer->setConfigData('system/cron/schedule_ahead_for', 1);
  109. $installer->setConfigData('system/cron/schedule_lifetime', 30);
  110. $installer->setConfigData('system/cron/history_cleanup_every', 120);
  111. $installer->setConfigData('system/cron/history_success_lifetime', 120);
  112. $installer->setConfigData('system/cron/history_failure_lifetime', 120);
  113. $installer->endSetup();