Advertisement
RiseAgainst0

Untitled

Dec 13th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. SELECT
  2. cpe.entity_id "Product id",
  3. ccet1.store_id "Store id",
  4. cpe.sku "Sku",
  5. cpev.value "Product name",
  6. cpe.type_id "Product type",
  7. eas.attribute_set_name "Attribute set name",
  8. cpip.price "Base price",
  9. cpip.final_price "Final price",
  10. currency.value "Currency",
  11. ccet1.value "Description",
  12.  
  13. CASE WHEN cpev2.value IS NULL OR cpev2.value = 'no_selection'
  14. THEN ''
  15. ELSE concat(url.value, 'media/catalog/product', cpev2.value) END "Image url",
  16.  
  17. CASE WHEN urlSuffix.value IS NULL
  18. THEN concat(url.value, cpeuk.value)
  19. ELSE concat(url.value, cpeuk2.value, '.', urlSuffix.value) END "Link"
  20.  
  21. FROM (catalog_product_entity cpe,
  22. #currency
  23. (SELECT ccd.value
  24. FROM core_config_data ccd
  25. WHERE ccd.path = 'currency/options/default') AS currency,
  26.  
  27. #base url
  28. (SELECT ccd.value
  29. FROM core_config_data ccd
  30. WHERE scope_id = 1 AND ccd.path = 'web/unsecure/base_url') AS url,
  31.  
  32. #product url suffix
  33. (SELECT ccd2.value
  34. FROM core_config_data ccd2
  35. WHERE ccd2.path = 'catalog/seo/product_url_suffix') AS urlSuffix
  36. )
  37.  
  38. #attribute set name
  39. LEFT JOIN eav_attribute_set eas
  40. ON cpe.attribute_set_id = eas.attribute_set_id
  41.  
  42. #description
  43. LEFT JOIN catalog_product_entity_text ccet1
  44. ON cpe.entity_id = ccet1.entity_id
  45.  
  46. #base and final price
  47. LEFT JOIN catalog_product_index_price cpip
  48. ON cpe.entity_id = cpip.entity_id
  49.  
  50. #name
  51. LEFT JOIN catalog_product_entity_varchar cpev
  52. ON cpe.entity_id = cpev.entity_id
  53.  
  54. #image
  55. LEFT JOIN catalog_product_entity_varchar cpev2
  56. ON cpe.entity_id = cpev2.entity_id
  57.  
  58. #url key for a store
  59. LEFT JOIN catalog_product_entity_url_key cpeuk
  60. ON cpe.entity_id = cpeuk.entity_id
  61.  
  62. #url key for the default store
  63. LEFT JOIN catalog_product_entity_url_key cpeuk2
  64. ON cpe.entity_id = cpeuk2.entity_id
  65.  
  66. WHERE
  67. #description
  68. ccet1.store_id IN (1) AND ccet1.attribute_id = 72
  69. #price
  70. AND cpip.website_id = ccet1.store_id AND cpip.customer_group_id = 1
  71. #name
  72. AND cpev.store_id = ccet1.store_id AND cpev.attribute_id = 71
  73. #image
  74. AND cpev2.store_id = 0 AND cpev2.attribute_id = 85
  75. #url key by store id
  76. AND cpeuk.store_id = ccet1.store_id
  77. #url key for default store
  78. AND cpeuk2.store_id = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement