Any questions about Documents Sellers, post it here .

DMS mod_dms_documents does not exclude catergories

  • bzbeauty
  • Topic Author
  • Offline
  • New Member
  • New Member
More
13 years 3 months ago #7039 by bzbeauty
So far I been loving the DMS component and modules. The only problem is for the mod_dms_document there is the option to exclude categories. For Latest Documents (case 0 below) and Popular Documents (case 1 below) it works fine. However for Best Sellers - case 2 which doesn't have the $where, it does not work. I have been trying to figure out how to work it into the sql, but it hasn't been working. Can you please help so that case 2 (Best Sellers) will also exclude those in the $excludecategories list. Thanks
Code:
$where[] = ' d.published = 1 '; if ($categories) { $where[] = ' d.id IN (SELECT document_id FROM #__dms_category_documents WHERE category_id IN ("'.$categories.'")) ' ; } if ($excludeCategories) { $where[] = ' d.id IN (SELECT document_id FROM #__dms_category_documents WHERE category_id NOT IN ('.$excludeCategories.')) ' ; }
Code:
switch ($type) { case 1 : $query = "SELECT d.category_id, d.id, d.thumb, d.title FROM #__dms_documents AS d " . ' WHERE '.implode(' AND ', $where) ." ORDER BY d.hits DESC "; break ; case 2 : $query = "SELECT d.category_id, d.id, d.thumb, d.title, COUNT(o.order_id) as num_sales " ." FROM #__dms_documents AS d " ." LEFT JOIN #__dms_order_item AS o ON d.id = o.document_id GROUP BY d.id ORDER BY num_sales DESC "; break ; case 0 : default: $query = "SELECT d.category_id, d.id, d.thumb, d.title FROM #__dms_documents AS d " . ' WHERE '.implode(' AND ', $where) ." ORDER BY d.created_date DESC "; break ; }

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