0

如何在 opencart 2.0 admin.when 创建新订单时删除验证?

在这里,他们使用 curl 函数进行验证。这两天我正在寻找它。

有人可以建议我。我。我为此挣扎。

public function api() {
$json = array();

// Store
if (isset($this->request->get['store_id'])) {
    $store_id = $this->request->get['store_id'];
} else {
    $store_id = 0;
}

$this->load->model('setting/store');

$store_info = $this->model_setting_store->getStore($store_id);

if ($store_info) {
    $url = $store_info['ssl'];
} else {
    $url = HTTPS_CATALOG;
}

if (isset($this->session->data['cookie']) && isset($this->request->get['api'])) {
    // Include any URL perameters
    $url_data = array();

    foreach ($this->request->get as $key => $value) {
        if ($key != 'route' && $key != 'token' && $key != 'store_id') {
            $url_data[$key] = $value;
        }
    }

    $curl = curl_init();

    // Set SSL if required
    if (substr($url, 0, 5) == 'https') {
        curl_setopt($curl, CURLOPT_PORT, 443);
    }

    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLINFO_HEADER_OUT, true);
    curl_setopt($curl, CURLOPT_USERAGENT, $this->request->server['HTTP_USER_AGENT']);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_FORBID_REUSE, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_URL, $url . 'index.php?route=' . $this->request->get['api'] . ($url_data ? '&' . http_build_query($url_data) : ''));

    if ($this->request->post) {
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->request->post));
    }

    curl_setopt($curl, CURLOPT_COOKIE, session_name() . '=' . $this->session->data['cookie'] . ';');

    $json = curl_exec($curl);

    curl_close($curl);
}

$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput($json);

}

4

1 回答 1

-2

create new order让我知道front page storeadmin page?因为它会有不同的脚本。

在管理方面,你可以在文件中看到admin/controller/sale/order.php 你可以检查这个脚本:

protected function validate() {
    if (!$this->user->hasPermission('modify', 'sale/order')) {
        $this->error['warning'] = $this->language->get('error_permission');
    }

    return !$this->error;
}

您可以更改为:

protected function validate() {
    if (!$this->user->hasPermission('modify', 'sale/order')) {
        $this->error['warning'] = $this->language->get('error_permission');
    }

    return true;
}

如果你不需要替换你的核心 opencart 代码,你可以使用 vqmod。

于 2015-02-16T06:10:53.707 回答