public function createIndexFields() { $fields = Cmsearch::getFields(); $s_fields = array(); foreach ($fields as $key => $val) { $s_fields[$this->sanitize($key)] = ''; } $url = $this->url . '/scheme/createfields?catalog=products'; $url = str_replace('api.', 'admin.', $url); $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, Tools::jsonEncode(array($s_fields))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSLCERT, $this->cert); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8')); $data = curl_exec($ch); if (curl_errno($ch)) { return false; } unset($data); return true; }