Skip to content

Instantly share code, notes, and snippets.

@philwinkle
Created March 17, 2015 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philwinkle/8840d68d76fcebc2fd22 to your computer and use it in GitHub Desktop.
Save philwinkle/8840d68d76fcebc2fd22 to your computer and use it in GitHub Desktop.
SELECT 1 AS `status`,
`e`.`entity_id`,
`e`.`type_id`,
`e`.`attribute_set_id`,
`cat_index`.`position` AS `cat_index_position`,
`e`.`name`,
`e`.`short_description`,
`e`.`sku`,
`e`.`price`,
`e`.`special_price`,
`e`.`special_from_date`,
`e`.`special_to_date`,
`e`.`small_image`,
`e`.`thumbnail`,
`e`.`color`,
`e`.`color_value`,
`e`.`news_from_date`,
`e`.`news_to_date`,
`e`.`url_key`,
`e`.`required_options`,
`e`.`image_label`,
`e`.`small_image_label`,
`e`.`thumbnail_label`,
`e`.`msrp_enabled`,
`e`.`msrp_display_actual_price_type`,
`e`.`msrp`,
`e`.`tax_class_id`,
`e`.`price_type`,
`e`.`weight_type`,
`e`.`price_view`,
`e`.`shipment_type`,
`e`.`links_purchased_separately`,
`e`.`links_exist`,
`e`.`giftcard_amounts`,
`e`.`allow_open_amount`,
`e`.`open_amount_min`,
`e`.`open_amount_max`,
`e`.`availablity_shipipping`,
`e`.`availablity_shipipping_value`,
`e`.`upc`,
`e`.`coverage`,
`e`.`coverage_value`,
`e`.`recall`,
`e`.`bestseller_rank`,
`e`.`health_condition`,
`e`.`plenti_ineligibility`,
`price_index`.`price`,
`price_index`.`tax_class_id`,
`price_index`.`final_price`,
IF(price_index.tier_price IS NOT NULL, Least(price_index.min_price,
price_index.tier_price),
price_index.min_price) AS `minimal_price`,
`price_index`.`min_price`,
`price_index`.`max_price`,
`price_index`.`tier_price`,
`e`.`sku`,
`promotion`.`up_coupon_upc`
FROM `catalog_product_flat_1` AS `e`
INNER JOIN `catalog_category_product_index` AS `cat_index`
ON cat_index.product_id = e.entity_id
AND cat_index.store_id = 1
AND cat_index.visibility IN( 2, 4 )
AND cat_index.category_id = '3'
INNER JOIN `catalog_product_index_price` AS `price_index`
ON price_index.entity_id = e.entity_id
AND price_index.website_id = '1'
AND price_index.customer_group_id = 0
INNER JOIN `custom_promotion` AS `promotion`
ON ( promotion.sku = e.sku )
ORDER BY `e`.`bestseller_rank` ASC
LIMIT 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment