خطای پایگاهدادهٔ وردپرس : [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 (15,49,114,174,175,2602,2603,2604,2616,2758,2759,2760,5594,5595,5596,5597,5603,5605,6674,6685,6686,6688,6752,6753,8648,8672,8673,8674,8675,8682,8684,8685,8686,8687,8688,8792,8797,8798,16563,20339,23008,23017,23032,23045,25506,33454,33455)
) 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