This error occurs with the 'Do not Display Product, if child products also out of stock’ chosen and VM frontpage Top 10 enabled
500 error with Joomla debug on
No Top 10 results when debug off
JDatabaseMySQL::query: 1052 - Column 'product_sales' in order clause is ambiguous
File administrator/components/com_virtuemart/models/product.php around line 404
(@version $Id: product.php 6255 2012-07-11 10:26:02Z Milbo $)(Version 2.0.8e)
When ‘Do not Display Product, if child products also out of stock’ is chosen in Configuration->ShopFront-> Action when a Product is Out of Stock an extra JOIN is made to the product and search query
LEFT OUTER JOIN `jos_virtuemart_products` children ON p.`virtuemart_product_id` = children.`product_parent_id`
This means there are 2 possible instances now of ‘product_sales’ but the WHERE clause is missing a TABLE ALIAS for ‘product_sku’ causing the ‘Column 'product_sales' in where clause is ambiguous’ error.
Original code line 245
$orderBy = ' ORDER BY product_sales ';
Code Added line 245
$orderBy = ' ORDER BY p.product_sales ';
ORDER BY is now
ORDER BY p.product_sales DESC