SELECT
p.products_id,
p2d.physical_id,
p2d.digital_id,
p.products_download,
p.products_status,
p.products_quantity,
p.products_image,
p.products_tax_class_id,
p.products_date_available,
p.products_free,
pd.products_name,
pd.products_sname,
p2c.categories_id,
c.categories_id,
p.products_price,
dp.products_price AS digital_price,
dp.products_status AS digital_status,
dp.products_date_available AS digital_date_available,
dp.products_free AS digital_free
#pagination
FROM
products p
LEFT JOIN products_2_digital p2d ON (
p.products_id = p2d.physical_id
OR p.products_id = p2d.digital_id
)
LEFT JOIN products_attributes pa USING (products_id)
LEFT JOIN specials s USING (products_id)
LEFT JOIN products_description pd USING (products_id)
LEFT JOIN products_to_categories p2c USING (products_id)
LEFT JOIN categories c USING (categories_id)
LEFT JOIN products dp ON (
p2d.digital_id = dp.products_id
)
LEFT JOIN products pp ON (
p2d.physical_id = pp.products_id
)
LEFT JOIN products_to_categories dp2c ON (
dp2c.products_id = p2d.digital_id
)
WHERE
s.status = 1
AND s.expires_date > '2015-01-31 16:08:36'
AND
(
(
/*Physical only*/
p2d.id IS NULL
)
OR (
/*Digital and Physical*/
p2d.id IS NOT NULL
AND (
p.products_download = 0 /*Physical product in stock*/
OR p.products_download = 1 /*Digital when physical is out of stock*/
AND (pp.products_quantity = 0 OR pp.products_status = 0 /*digital_query*/)
)
)
)
GROUP BY p.products_id
ORDER BY
p.products_date_added DESC The Official 2000 AD Online Store | Subscriptions, Graphic Novels, Comics, Clothing, Merchandise and More...
Earthlet! It is important to note that this site uses cookies in order to function correctly. If you continue to use our site, we'll assume you're happy to receive all cookies on the 2000 AD Store.
Urban Warfare - Limited Edition version
Sorry, no results found!