title: Prestashop product features PHP SQL
body: <p>We are wanting to do a quick compare on the product page that compares the current product and then the two top sellers in that category after that. I have all the SQL to get the current product and the two that are top sellers, but am having trouble adding the features to those. This is what I am facing.</p>
  
  <p>This is just as an example. This SQL would pull the product features within a category.</p>
  
  <pre><code>SELECT ps_product.id_product, ps_feature_lang.name, ps_feature_value_lang.value FROM ps_product LEFT JOIN ps_feature_product ON ps_feature_product.id_product = ps_product.id_product LEFT JOIN ps_feature_lang ON ps_feature_lang.id_feature = ps_feature_product.id_feature LEFT JOIN ps_feature_value_lang ON ps_feature_value_lang.id_feature_value = ps_feature_product.id_feature_value WHERE ps_product.id_category_default = '6' AND ps_feature_lang.id_feature IS NOT NULL
  </code></pre>
  
  <p>It returns</p>
  
  <pre><code>id_product | name | value
   9          Height  5
   9          Width   5
   9          Depth   5
   9          Weight  5
  10          Height  10
  </code></pre>
  
  <p>I have tried to group by id_product, but of course that will only show on of the values from the features list for that product. I have also tried putting them into arrays by products, but can't get them to line up correctly on the front end.</p>
  
  <p>I wasn't sure if prestashop already had a built in function to pull product features</p>