I have made a custom status and test if it is 2 and on that basis am trying to delete the main image of a product. At first I didn't know that cURL needs special treatment if working with sessions and I got redirected to the admin login screen. This modification is supposed to go into the file admin/controller/catalog/product
(using VQMod of course). Only now I'm getting NULL
for response.
if((int) $this->request->post['status'] == 2) {
if(isset($this->request->post['image'])) {
$params = array(
'path' => $this->request->post['image']
);
$defaults = array(
CURLOPT_URL => $this->url->link('common/filemanager/delete', 'token=' . $this->session->data['token'], 'SSL'),
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_COOKIESESSION => true,
CURLOPT_COOKIEJAR => 'cookie-jar',
CURLOPT_COOKIEFILE => '/home/u32807/tmp'
);
$ch = curl_init();
curl_setopt_array($ch, $defaults);
$ouput = curl_exec($ch);
if($output === false) {
echo 'Curl error: ' . curl_error($ch);
die();
}
else {
var_dump($output);
die();
}
}
}
I tried commenting out CURLOPT_POSTFIELDS
and also I tried feeding it an empty array, but still NULL
. There must thus be something wrong with the way I have set up the connection but I do not know where to start to debug it. Hewp pweeze! :/ OpenCart version is 1.5.6.4.