I have this currently as the sql to show the products which works well and allows sorting using the standard CE Phoenix sort listings dropdowns.
Code: Select all
$listing_sql = sprintf(<<<'EOSQL'
SELECT m.*, %s
FROM
products_description pd
INNER JOIN products p ON p.products_id = pd.products_id
LEFT JOIN manufacturers m ON p.manufacturers_id = m.manufacturers_id
LEFT JOIN specials s ON p.products_id = s.products_id
LEFT JOIN (SELECT products_id, COUNT(*) AS attribute_count FROM products_attributes GROUP BY products_id) a ON p.products_id = a.products_id
WHERE p.products_status = 1
AND p.products_quantity > 0
AND p.products_restocked_date IS NOT NULL
AND p.products_restocked_date >= NOW() - INTERVAL %d DAY
AND pd.language_id = %d
EOSQL
, Product::COLUMNS, (int)$days_limit, (int)$_SESSION['languages_id']);
$default_column = 'PRODUCT_LIST_ID';
$sort_order = 'd';I have tried adding to the bottom
Code: Select all
ORDER BY p.products_restocked_date DESC
EOSQLCan anyone suggest an improvement to that sql or a change that would work.