Skip to content

Instantly share code, notes, and snippets.

@trabulium
Last active May 11, 2017 03:56
Show Gist options
  • Save trabulium/899e730b06105cbc1e09f3ec3cea4bd8 to your computer and use it in GitHub Desktop.
Save trabulium/899e730b06105cbc1e09f3ec3cea4bd8 to your computer and use it in GitHub Desktop.
Export Magento Reviews in Stamped.io format
select distinct cpe.entity_id product_id_maybe, cpe.sku product_id, CONCAT('http://www.domain.com/', cur.request_path) productUrl, cpev.value productUrl, null reviewphotosUrl, rov.percent rating_percent, rov.value rating_of_5, rd.title title, rd.nickname author, ce.email, rd.detail body, r.created_at, CONCAT('http://www.domain.com', cpev2.value) productImageUrl
from review as r
LEFT JOIN review_detail rd on r.review_id = rd.review_id
LEFT JOIN catalog_product_entity cpe on r.entity_pk_value = cpe.entity_id
LEFT JOIN catalog_product_entity_int cpei on cpei.`entity_id` = cpe.entity_id
LEFT JOIN catalog_product_entity_varchar cpev on cpev.entity_id = cpe.entity_id
LEFT JOIN catalog_product_entity_varchar cpev2 on cpev2.entity_id = cpe.entity_id
LEFT JOIN rating_option_vote rov on rov.review_id = r.review_id
LEFT JOIN customer_entity ce on ce.entity_id = rd.customer_id
LEFT JOIN core_url_rewrite cur on cur.product_id = cpe.entity_id
where cur.category_id is NULL
AND cpei.attribute_id = 96 AND cpei.`value` <> 2
AND cur.request_path IS NOT NULL
AND cpev2.attribute_id = 85
AND cpev.attribute_id = 97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment