Advertisement
nicolaslagios

Find one variant products price on oscommerce 2

Nov 30th, 2024
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.85 KB | Source Code | 0 0
  1. -- additional solution for https://github.com/nicolaslagios/OS-Commerce-v2-export-to-json-xml-array/ --
  2. -- 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 --
  3.  
  4. SELECT
  5.     p.products_id AS id,
  6.     a.products_id AS id_attr,
  7.     p.products_model AS sku,
  8.     p.products_price AS price,
  9.     p.products_weight AS weight,
  10.     a.options_values_price + p.products_price AS actual_price,
  11.     a.options_values_weight + p.products_weight AS actual_weight
  12. FROM
  13.     products p
  14. JOIN
  15.     products_attributes a
  16. ON
  17.     p.products_id = a.products_id
  18. WHERE
  19.     p.products_id IN (
  20.         SELECT
  21.             products_id
  22.         FROM
  23.             products_attributes
  24.         GROUP BY
  25.             products_id
  26.         HAVING
  27.             COUNT(products_id) = 1
  28.     )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement