Any questions about Documents Sellers, post it here .

mydocs view not working

  • Daniele Grassi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
14 years 1 month ago #2547 by Daniele Grassi
mydocs view not working was created by Daniele Grassi
Hi,

mydocs view is not working, even if the user has some order linked to him. Error given is "No valid database connection You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY a.ordering LIMIT 0, 20' at line 1 SQL=SELECT a.* FROM jos15_dms_documents AS a WHERE a.published = 1 AND a.id IN ( ) ORDER BY a.ordering LIMIT 0, 20
No valid database connection You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 SQL=SELECT COUNT(*) FROM jos15_dms_documents AS a WHERE a.published = 1 AND a.id IN ( )"

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #2548 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re:mydocs view not working
Hi
Could you submit a support ticket contains your site information so that I can check it for you ? No one reported this issue before .

Thanks,
Tuan

Please Log in or Create an account to join the conversation.

  • Daniele Grassi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
14 years 1 month ago #2549 by Daniele Grassi
Replied by Daniele Grassi on topic Re:mydocs view not working
I checked again, and the problem happens when the user doesn't have a purchased item. I solved it changing the buildContentsWhere function in mydocs model to

$docs = DMSHelper::getDownloadableDocs(false) ;
$docs = array_merge($docs, $docs) ;
$where = array() ;
$where[] = ' a.published = 1 ';
$whereIN = implode(',', $docs);
if ($whereIN === '') {
$where[] = ' false';
} else {
$where[] = ' a.id IN ( '. $whereIN . ')' ;
}
$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
return $where;

Please Log in or Create an account to join the conversation.

More
14 years 1 month ago #2550 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re:mydocs view not working
Oh
Thanks so much for sharing the code . I will update this fix and update the latest code to server .

Thanks,
Tuan

Please Log in or Create an account to join the conversation.