Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- additional solution for https://github.com/nicolaslagios/OS-Commerce-v2-export-to-json-xml-array/ --
- -- This is a quick solution for products with only one variant that receive the original price without adding the weight and cost of the variant --
- SELECT
- p.products_id AS id,
- a.products_id AS id_attr,
- p.products_model AS sku,
- p.products_price AS price,
- p.products_weight AS weight,
- a.options_values_price + p.products_price AS actual_price,
- a.options_values_weight + p.products_weight AS actual_weight
- FROM
- products p
- JOIN
- products_attributes a
- ON
- p.products_id = a.products_id
- WHERE
- p.products_id IN (
- SELECT
- products_id
- FROM
- products_attributes
- GROUP BY
- products_id
- HAVING
- COUNT(products_id) = 1
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement