ecommerce/product/product.module
Line 1123 and 1159 (product_overview() and product_quicklist()):

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

When I use this query with the hook_db_rewrite_sql() I get an error:

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT DISTINCT(n.nid), n.title, p.* FROM node as n, ec_product as p LEFT JOIN mmoderation mm ON mm.nid = n.nid WHERE (mm.status IN(1, 0)) AND ( n.vid = p.vid AND n.status = 1 ) ORDER BY p.nid ASC LIMIT 0, 50 in /home/xxx/includes/database.mysql.inc on line 174.

The problem is this part of the query:

FROM {node} as n, {ec_product} as p

It would be better a JOIN.

Comments

foripepe’s picture

Eg:

  $sql = 'SELECT n.nid, n.title, p.* FROM {node} AS n INNER JOIN {ec_product} AS p ON n.vid = p.vid WHERE n.status = 1'. tablesort_sql($header);