uc_product_default displays multiple identical products if product node has revisions

Posts: 3
Joined: 11/01/2007
Bug Finder

Hi there.

Just noticed that if you create a revision of a product node, then head to the products page (function uc_product_default) you get a table row for each revision, where you should only get the current revision.

function uc_product_detault in uc_product.module

$result = pager_query(db_rewrite_sql("SELECT n.nid FROM {node} AS n RIGHT JOIN {uc_products} AS p ON n.nid = p.nid WHERE n.status = 1 ORDER BY ". $order), variable_get('uc_product_nodes_per_page', 10), 0, null);

should be:

$result = pager_query(db_rewrite_sql("SELECT n.nid FROM {node} AS n RIGHT JOIN {uc_products} AS p ON n.nid = p.nid AND n.vid = p.vid WHERE n.status = 1 ORDER BY ". $order), variable_get('uc_product_nodes_per_page', 10), 0, null);

Attached is a patch (with a .txt extension to get it past the file upload box!).

Cheers,
Ben

AttachmentSize
multiple_product_list_revision.patch_.txt1000 bytes
Posts: 2267
Joined: 08/07/2007
AdministratoreLiTe!

Thanks for catching that. I'll get it fixed right away. Enjoy your bug finding badge. Smiling