خطای پایگاهدادهٔ وردپرس : [Unknown column 'wc_product_meta_lookup.stock_status' in 'order clause']SELECT SQL_CALC_FOUND_ROWS ss_posts.ID
FROM ss_posts LEFT JOIN ss_term_relationships ON (ss_posts.ID = ss_term_relationships.object_id) INNER JOIN ss_postmeta ON ( ss_posts.ID = ss_postmeta.post_id ) LEFT JOIN ss_wc_product_meta_lookup AS hello_wc_lookup ON (ss_posts.ID = hello_wc_lookup.product_id) LEFT JOIN ss_postmeta AS pardis_regular ON (ss_posts.ID = pardis_regular.post_id AND pardis_regular.meta_key = '_regular_price')
WHERE 1=1 AND (
ss_posts.ID NOT IN (
SELECT object_id
FROM ss_term_relationships
WHERE term_taxonomy_id IN (32372)
)
AND
ss_term_relationships.term_taxonomy_id IN (227,31521,31522,31523,31524,31525,33169,33170,33171,33172,33173,33174,33175,33176,33177,33178,33179,33180,33181,33182,33183,33184,33185,33186,33187,33188,33189,33190,33191,33192,33193,33194,33195,33196,33197,33198,33199,33200,33201,33202,33203,33204,33205,33206,33207,33208,33209,33210,33211,33294)
) AND (
ss_postmeta.meta_key = '_sale_price'
) AND ((ss_posts.post_type = 'product' AND (ss_posts.post_status = 'publish')))
GROUP BY ss_posts.ID
ORDER BY
CASE
WHEN (wc_product_meta_lookup.stock_status = 'instock' OR wc_product_meta_lookup.stock_status IS NULL OR wc_product_meta_lookup.stock_status = '')
AND wc_product_meta_lookup.min_price IS NOT NULL AND wc_product_meta_lookup.min_price > 0 THEN 0
WHEN wc_product_meta_lookup.stock_status = 'instock' OR wc_product_meta_lookup.stock_status IS NULL OR wc_product_meta_lookup.stock_status = '' THEN 1
WHEN wc_product_meta_lookup.stock_status = 'outofstock' THEN 2
ELSE 1
END ASC
, CASE
WHEN CAST(pardis_regular.meta_value AS DECIMAL(20,4)) > 0
AND CAST(hello_wc_lookup.min_price AS DECIMAL(20,4)) > 0
AND CAST(pardis_regular.meta_value AS DECIMAL(20,4)) > CAST(hello_wc_lookup.min_price AS DECIMAL(20,4))
THEN ((CAST(pardis_regular.meta_value AS DECIMAL(20,4)) - CAST(hello_wc_lookup.min_price AS DECIMAL(20,4))) / CAST(pardis_regular.meta_value AS DECIMAL(20,4)))
ELSE 0
END DESC, ss_posts.ID DESC
LIMIT 0, 30