1: | <?php
2: | namespace Opencart\Catalog\Controller\Account;
3: | /**
4: | * Class Custom Field
5: | *
6: | * @package Opencart\Catalog\Controller\Account
7: | */
8: | class CustomField extends \Opencart\System\Engine\Controller {
9: | /**
10: | * @return void
11: | */
12: | public function index(): void {
13: | $json = [];
14: |
15: | // Customer Group
16: | if (isset($this->request->get['customer_group_id']) && in_array((int)$this->request->get['customer_group_id'], (array)$this->config->get('config_customer_group_display'))) {
17: | $customer_group_id = (int)$this->request->get['customer_group_id'];
18: | } else {
19: | $customer_group_id = (int)$this->config->get('config_customer_group_id');
20: | }
21: |
22: | $this->load->model('account/custom_field');
23: |
24: | $custom_fields = $this->model_account_custom_field->getCustomFields($customer_group_id);
25: |
26: | foreach ($custom_fields as $custom_field) {
27: | $json[] = [
28: | 'custom_field_id' => $custom_field['custom_field_id'],
29: | 'required' => $custom_field['required']
30: | ];
31: | }
32: |
33: | $this->response->addHeader('Content-Type: application/json');
34: | $this->response->setOutput(json_encode($json));
35: | }
36: | }
37: |

OpenCart API API documentation generated by ApiGen dev-master