Do not Display Product, if child products also out of stock’ is chosen & Top 10

Started by GJC Web Design, August 10, 2012, 18:14:46 PM

Previous topic - Next topic

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jeoff

to All VM developpers. This is a very real bug that people with a clothing webshop WILL run in to!
See my other topics where I try to explain this situation.

GJC Webdesign solved this issue with high priority for our webshop. I suggest you implement this fix in the next release.

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/