1: | <?php
|
2: | namespace Opencart\Catalog\Model\Marketing;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Marketing extends \Opencart\System\Engine\Model {
|
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: |
|
16: | public function getMarketingByCode(string $code): array {
|
17: | $query = $this->db->query("SELECT DISTINCT * FROM `" . DB_PREFIX . "marketing` WHERE `code` = '" . $this->db->escape($code) . "'");
|
18: |
|
19: | return $query->row;
|
20: | }
|
21: |
|
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: |
|
31: | public function addReport(int $marketing_id, string $ip, string $country = ''): void {
|
32: | $this->db->query("INSERT INTO `" . DB_PREFIX . "marketing_report` SET `marketing_id` = '" . (int)$marketing_id . "', `store_id` = '" . (int)$this->config->get('config_store_id') . "', `ip` = '" . $this->db->escape($ip) . "', `country` = '" . $this->db->escape($country) . "', `date_added` = NOW()");
|
33: | }
|
34: | }
|
35: | |