1: | <?php
2: | namespace Opencart\Catalog\Model\Marketing;
3: | /**
4: | * Class Marketing
5: | *
6: | * @package Opencart\Catalog\Model\Marketing
7: | */
8: | class Marketing extends \Opencart\System\Engine\Model {
9: | /**
10: | * Get Marketing By Code
11: | *
12: | * @param string $code
13: | *
14: | * @return array<string, mixed>
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: | * Add Report
24: | *
25: | * @param int $marketing_id
26: | * @param string $ip
27: | * @param string $country
28: | *
29: | * @return void
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: |

OpenCart API API documentation generated by ApiGen dev-master