Community Documentation

Fix E-Commerce Quicklist

Last updated March 18, 2008. Created by weedoo on March 18, 2008.
Log in to edit this page.

For some reason the admin/store/products/quicklist was NEVER giving me a list of available products, after searching for a while I looked in the code and saw the query asked to the db was right (tested with navicat) but for some reason drupal didn't get any results. I searched info on the db_rewrite_sql function on api.drupal.org and I fount this interesting line (on the Description section) -> "Do not use FROM table1, table2 syntax, use JOIN instead."

Original query :
$sql = 'SELECT * FROM {node} n, {ec_product} p WHERE n.vid = p.vid AND n.status = 1'. tablesort_sql($header);

My fix :
$sql = 'SELECT * FROM {node} n LEFT JOIN {ec_product} p ON n.vid = p.vid WHERE n.status = 1'. tablesort_sql($header);

Guess what, it works !

Hope I will help someone with that.

Olivier

About this page

Drupal version
Drupal 5.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.