title: OpenCart - remove one category with subcategories from product query
body: <p>I've been working to change the query in <code>getProducts($data = array())</code> method.</p>
  
  <p>So.. In specific controller I added <code>exclude_category_id =&gt; 65</code> in <code>$data</code> array, which I pass to <code>getProducts($data)</code>.</p>
  
  <pre><code>$data = array(
      'sort'  =&gt; 'p.date_added',
      'order' =&gt; 'DESC',
      'start' =&gt; 0,
      'limit' =&gt; $setting['limit'],
      'exclude_category_id' =&gt; 65
  );
  </code></pre>
  
  <p>In <code>model/catalog/product.php</code> in <code>public function getProducts($data = array())</code> I added this code:</p>
  
  <pre><code>if (!empty($data['filter_category_id'])) {
      if (!empty($data['filter_sub_category'])) {
          $sql .= " FROM " . DB_PREFIX . "category_path cp LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (cp.category_id = p2c.category_id)";         
      } else {
          $sql .= " FROM " . DB_PREFIX . "product_to_category p2c";
      }
  
      if (!empty($data['filter_filter'])) {
          $sql .= " LEFT JOIN " . DB_PREFIX . "product_filter pf ON (p2c.product_id = pf.product_id) LEFT JOIN " . DB_PREFIX . "product p ON (pf.product_id = p.product_id)";
      } else {
          $sql .= " LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id)";
      }
  } else if(!empty($data['exclude_category_id'])){
  
      // THIS ELSE IF IS ADDED BY ME
  
      $sql .= " FROM " . DB_PREFIX . "product_to_category p2c";
      $sql .= " LEFT JOIN " . DB_PREFIX . "product p ON (p2c.product_id = p.product_id)";
  }else {
      $sql .= " FROM " . DB_PREFIX . "product p";
  }
  </code></pre>
  
  <p>Deeper in that method I added also:</p>
  
  <pre><code>if(!empty($data['exclude_category_id'])){
      $sql .= " AND p2c.category_id != '" . (int)$data['exclude_category_id'] . "'";
  }
  </code></pre>
  
  <p>But products from category with <code>ID = 65</code> are still visible. Anyone have any idea how to do that? </p>