I found the error. In your controller/product.php you have
function download() {
$file_id = JRequest::getInt('file_id');
if(!$file_id){ return false; }
$fileClass = hikashop_get('class.file');
$fileClass->download($file_id);
return true;
}
And in classes/file.php
$orderClass = hikashop_get('class.order');
$order = $orderClass->get($order_id);
if(empty($order) || $order->order_user_id != $user_id){
$app->enqueueMessage(JText::_('ORDER_NOT_FOUND'));
$this->error_type = 'no_order';
return false;
}
But you do not pass $order_id in to download method of file. You need to add either
function download() {
$file_id = JRequest::getInt('file_id');
if(!$file_id){ return false; }
$order_id = JRequest::getInt('order_id', 0);
$fileClass = hikashop_get('class.file');
$fileClass->download($file_id, $order_id);
return true;
}
or
$orderClass = hikashop_get('class.order');
if(!$order_id) $order_id = JRequest::getInt('order_id', 0);
$order = $orderClass->get($order_id);
if(empty($order) || $order->order_user_id != $user_id){
$app->enqueueMessage(JText::_('ORDER_NOT_FOUND'));
$this->error_type = 'no_order';
return false;
}