Posted By

simsevu on 10/20/11


Tagged

mysql magento


Versions (?)

Average discount in magento 1.4.1


 / Published in: MySQL
 

URL: avg-magento-discount

  1. // AVERAGE SAVINGS ON SIMPLE PRODUCTS
  2. SELECT (1-AVG(t1.final_price /t1.price))*100
  3. FROM catalog_product_index_price AS t1
  4. JOIN catalog_product_entity AS t2
  5. ON t1.entity_id = t2.entity_id
  6. WHERE (t1.customer_group_id = 0 AND t1.website_id = 1)
  7. AND (t1.final_price > 0 AND t1.price > 0)
  8. AND t2.type_id = 'simple'
  9.  
  10.  
  11. // AVERAGE PRICE ON SIMPLE PRODUCTS
  12. SELECT AVG(t1.final_price)
  13. FROM catalog_product_index_price AS t1
  14. JOIN catalog_product_entity AS t2
  15. ON t1.entity_id = t2.entity_id
  16. WHERE (t1.customer_group_id = 0 AND t1.website_id = 1)
  17. AND (t1.final_price > 0 AND t1.price > 0)
  18. AND t2.type_id = 'simple'
  19.  
  20. // AVERAGE PRICE ON BUNDLED PRODUCTS
  21. SELECT AVG(t1.min_price)
  22. FROM catalog_product_index_price AS t1
  23. JOIN catalog_product_entity AS t2
  24. ON t1.entity_id = t2.entity_id
  25. WHERE (t1.customer_group_id = 0 AND t1.website_id = 1)
  26. AND (t1.final_price > 0 AND t1.price > 0)
  27. AND t2.type_id = 'bundle'

Report this snippet  

You need to login to post a comment.