Guest User

Untitled

a guest
Jul 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. **$_productCollection = $block->getLoadedProductCollection();**
  2. SELECT `e`.*,
  3. IF(at_status.value_id > 0, at_status.value, at_status_default.value) AS
  4. `status`,
  5. `cat_index`.`position` AS
  6. `cat_index_position`
  7. FROM `catalog_product_entity` AS `e`
  8. INNER JOIN `catalog_product_entity_int` AS `at_status_default`
  9. ON ( `at_status_default`.`entity_id` = `e`.`entity_id` )
  10. AND ( `at_status_default`.`attribute_id` = '87' )
  11. AND `at_status_default`.`store_id` = 0
  12. LEFT JOIN `catalog_product_entity_int` AS `at_status`
  13. ON ( `at_status`.`entity_id` = `e`.`entity_id` )
  14. AND ( `at_status`.`attribute_id` = '87' )
  15. AND ( `at_status`.`store_id` = 1 )
  16. INNER JOIN `catalog_category_product_index` AS `cat_index`
  17. ON cat_index.product_id = e.entity_id
  18. AND cat_index.store_id = 1
  19. AND cat_index.visibility IN( 3, 2, 4 )
  20. AND cat_index.category_id = '2'
  21. WHERE ( IF(at_status.value_id > 0, at_status.value, at_status_default.value) IN
  22. ( 1 ) )
  23. ORDER BY `e`.`entity_id` DESC
  24.  
  25. **foreach ($_productCollection as $_product):**
  26. SELECT `e`.*,
  27. IF(at_status.value_id > 0, at_status.value, at_status_default.value) AS
  28. `status`,
  29. `cat_index`.`position` AS
  30. `cat_index_position`,
  31. `stock_status_index`.`stock_status` AS
  32. `is_salable`
  33. FROM `catalog_product_entity` AS `e`
  34. INNER JOIN `catalog_product_entity_int` AS `at_status_default`
  35. ON ( `at_status_default`.`entity_id` = `e`.`entity_id` )
  36. AND ( `at_status_default`.`attribute_id` = '87' )
  37. AND `at_status_default`.`store_id` = 0
  38. LEFT JOIN `catalog_product_entity_int` AS `at_status`
  39. ON ( `at_status`.`entity_id` = `e`.`entity_id` )
  40. AND ( `at_status`.`attribute_id` = '87' )
  41. AND ( `at_status`.`store_id` = 1 )
  42. INNER JOIN `catalog_category_product_index` AS `cat_index`
  43. ON cat_index.product_id = e.entity_id
  44. AND cat_index.store_id = 1
  45. AND cat_index.visibility IN( 3, 2, 4 )
  46. AND cat_index.category_id = '2'
  47. INNER JOIN `cataloginventory_stock_status` AS `stock_status_index`
  48. ON e.entity_id = stock_status_index.product_id
  49. AND stock_status_index.website_id = 0
  50. AND stock_status_index.stock_id = 1
  51. WHERE ( IF(at_status.value_id > 0, at_status.value, at_status_default.value) IN
  52. ( 1 ) )
  53. AND ( stock_status_index.stock_status = 1 )
  54. ORDER BY `e`.`entity_id` DESC
Add Comment
Please, Sign In to add comment