public function createRealtime()
 {
     $checkLOF = xtc_db_query("\tSELECT table_name\n\t\t\t\t\t\t\t\t\tFROM information_schema.tables\n\t\t\t\t\t\t\t\t\tWHERE `table_name` = 'idealo_realtime_update' AND `table_schema` LIKE '" . DB_DATABASE . "';");
     $result = xtc_db_fetch_array($checkLOF);
     if (empty($result)) {
         xtc_db_query("\t\n\t\t\t\t\t\t\tCREATE TABLE `idealo_realtime_update`(\n\t\t\t\t\t\t\tid INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id),\n\t\t\t\t\t\t\tproducts_id int(11),\n\t\t\t\t\t\t\tevent varchar (20))\n\t\t\t\t\t\t");
         $sql = "DROP TRIGGER IF EXISTS `idealo_update`;";
         xtc_db_query($sql);
         $sql = "CREATE TRIGGER `idealo_update` AFTER UPDATE ON `products` FOR EACH ROW INSERT INTO `idealo_realtime_update` (`products_id`, `event`) VALUES (OLD.products_id, 'UPDATE');";
         xtc_db_query($sql);
         $sql = "DROP TRIGGER IF EXISTS `idealo_insert`;";
         xtc_db_query($sql);
         $sql = "CREATE TRIGGER `idealo_insert` AFTER INSERT ON `products` FOR EACH ROW INSERT INTO `idealo_realtime_update` (`products_id`, `event`) VALUES (new.products_id, 'INSERT');";
         xtc_db_query($sql);
         $sql = "DROP TRIGGER IF EXISTS `idealo_delete`;";
         xtc_db_query($sql);
         $sql = "CREATE TRIGGER `idealo_delete` AFTER DELETE ON `products` FOR EACH ROW INSERT INTO `idealo_realtime_update` (`products_id`, `event`) VALUES (OLD.products_id, 'DELETE');";
         xtc_db_query($sql);
         $tools = new tools();
         $sql = "CREATE TABLE `idealo_realtime_setting` (`idealo` varchar(10)";
         $sql2 = "INSERT INTO `idealo_realtime_setting` VALUES(''";
         $idealo_shipping = new idealo_shipping();
         $this->shipping = $idealo_shipping->shipping;
         foreach ($this->shipping as $ship) {
             $active = 'idealo_' . $ship['country'] . '_active';
             $sql .= ", `" . $active . "` varchar(10)";
             $sql2 .= ", '0'";
             $costs = 'idealo_' . $ship['country'] . '_costs';
             $sql .= ", `" . $costs . "` varchar(300)";
             $sql2 .= ", ''";
             $free = 'idealo_' . $ship['country'] . '_free';
             $sql .= ", `" . $free . "` varchar(20)";
             $sql2 .= ", ''";
             $type = 'idealo_' . $ship['country'] . '_type';
             $sql .= ", `" . $type . "` varchar(10)";
             $sql2 .= ", ''";
         }
         $idealo_payment = new idealo_payment();
         $this->payment = $idealo_payment->payment;
         foreach ($this->payment as $pay) {
             $active = 'idealo_' . $pay['db'] . '_active';
             $sql .= ", `" . $active . "` varchar(10)";
             $sql2 .= ", '0'";
             $countries = 'idealo_' . $pay['db'] . '_countries';
             $sql .= ", `" . $countries . "` varchar(10)";
             $sql2 .= ", ''";
             $fix = 'idealo_' . $pay['db'] . '_fix';
             $sql .= ", `" . $fix . "` varchar(10)";
             $sql2 .= ", ''";
             $percent = 'idealo_' . $pay['db'] . '_percent';
             $sql .= ", `" . $percent . "` varchar(10)";
             $sql2 .= ", ''";
             $shipping = 'idealo_' . $pay['db'] . '_shipping';
             $sql .= ", `" . $shipping . "` varchar(10)";
             $sql2 .= ", '0'";
         }
         $sql .= ", `idealoMinorderprice` varchar(10), `idealoMinorder` varchar(10), `idealoMinorderBorder` varchar(10), `idealoExportAttributes` varchar(1000));";
         $sql2 .= ", '', '', '', '');";
         xtc_db_query($sql);
         xtc_db_query($sql2);
     }
     xtc_db_query("CREATE TABLE `" . IDEALO_REALTIME_CRON_TABLE . "` ( `id` INT NOT NULL AUTO_INCREMENT, `create_at` timestamp, `to_execute` timestamp, PRIMARY KEY(id));");
     xtc_db_query("INSERT INTO `" . IDEALO_REALTIME_CRON_TABLE . "` (`create_at`, `to_execute`) VALUES (current_timestamp, ADDTIME(current_timestamp, '0:30:0'));");
     $communication = new Communication();
     $communication->createErrorTable();
 }