Posted By


simsevu on 10/20/11

Tagged


Statistics


Viewed 681 times
Favorited by 0 user(s)

Average discount in magento 1.4.1


/ Published in: MySQL
Save to your folder(s)



Copy this code and paste it in your HTML
  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'

URL: avg-magento-discount

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.