private function importPrestashopCustomer() { $this->clearCustomerFilters(); $this->checked_groups = Tools::getValue('groups'); $this->checked_langs = Tools::getValue('langs'); $this->checked_categories = Tools::getValue('tree-categories'); $this->checked_products = Tools::getValue('tree-products'); $this->active_address = Tools::getValue('subscriptions_campaign_active'); $inserts = array(); if ($this->checked_groups) { foreach ($this->checked_groups as $group) { $inserts[] = array('campaign_id' => $this->campaign_id, 'group_id' => (int) $group); } } if (!empty($inserts)) { Db::getInstance()->insert('expressmailing_sms_groups', $inserts); } $inserts = array(); if ($this->checked_langs) { foreach ($this->checked_langs as $lang) { $inserts[] = array('campaign_id' => $this->campaign_id, 'lang_id' => (int) $lang); } } if (!empty($inserts)) { Db::getInstance()->insert('expressmailing_sms_langs', $inserts); } $inserts = array(); if ($this->checked_categories) { foreach ($this->checked_categories as $category) { $inserts[] = array('campaign_id' => $this->campaign_id, 'category_id' => (int) $category); } } if (!empty($inserts)) { Db::getInstance()->insert('expressmailing_sms_categories', $inserts); } $inserts = array(); if ($this->checked_products) { foreach ($this->checked_products as $product) { $inserts[] = array('campaign_id' => $this->campaign_id, 'product_id' => (int) $product); } } if (!empty($inserts)) { Db::getInstance()->insert('expressmailing_sms_products', $inserts); } DB::getInstance()->update('expressmailing_sms', array('campaign_active' => (int) $this->active_address), 'campaign_id = ' . $this->campaign_id); // Rebuilt the recipients selection // -------------------------------- $req = 'INSERT IGNORE INTO ' . _DB_PREFIX_ . 'expressmailing_sms_recipients (campaign_id, target, col_0, col_1, col_2, col_3, col_4, source) SELECT campaign_id, target, col_0, col_1, col_2, col_3, col_4, source FROM (' . DBMarketing::getCustomersSmsRequest($this->campaign_id, $this->checked_langs, $this->checked_groups, $this->active_address, $this->checked_products, $this->checked_categories) . ' ) AS recipients'; if (!DB::getInstance()->execute($req)) { $this->errors[] = DB::getInstance()->getMsgError(); } }