docs/api/source-catalog.model.account.activity.html
| 1: | <?php |
| 2: | namespace Opencart\Catalog\Model\Account; |
| 3: | /** |
| 4: | * Class Activity |
| 5: | * |
| 6: | * @package Opencart\Catalog\Model\Account |
| 7: | */ |
| 8: | class Activity extends \Opencart\System\Engine\Model { |
| 9: | /** |
| 10: | * Add Activity |
| 11: | * |
| 12: | * @param string $key |
| 13: | * @param array<string, mixed> $data |
| 14: | * |
| 15: | * @return void |
| 16: | */ |
| 17: | public function addActivity(string $key, array $data): void { |
| 18: | if (isset($data['customer_id'])) { |
| 19: | $customer_id = $data['customer_id']; |
| 20: | } else { |
| 21: | $customer_id = 0; |
| 22: | } |
| 23: | |
| 24: | $this->db->query("INSERT INTO " . DB\_PREFIX . "customer\_activity SET customer\_id = '" . (int)$customer_id . "', key = '" . $this->db->escape($key) . "', data = '" . $this->db->escape(json_encode($data)) . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', date_added = NOW()"); |
| 25: | } |
| 26: | |
| 27: | /** |
| 28: | * Delete Activity |
| 29: | * |
| 30: | * @param int $customer_id |
| 31: | * |
| 32: | * @return void |
| 33: | */ |
| 34: | public function deleteActivities(int $customer_id): void { |
| 35: | $this->db->query("DELETE FROM " . DB\_PREFIX . "customer\_activity WHERE customer\_id = '" . (int)$customer_id . "'"); |
| 36: | } |
| 37: | } |
| 38: | |
OpenCart API API documentation generated by ApiGen dev-master