Closed (fixed)
Project:
Ubercart
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
11 Oct 2011 at 14:22 UTC
Updated:
25 Oct 2011 at 19:30 UTC
Jump to comment: Most recent file
Noted when fixing #1305634: Deduplicate uc_cart_get_item() and uc_cart_get_contents()
$result = db_query("SELECT c.*, n.title, n.vid FROM {node} n INNER JOIN {uc_cart_products} c ON n.nid = c.nid WHERE c.cart_id = :id ORDER BY c.cart_item_id ASC", array(':id' => $cid));
foreach ($result as $item) {
$product = node_load($item->nid);
We don't need the join at all; we can just get the title and vid from the node_load() result.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1306124-cart-query.patch | 1.37 KB | longwave |
| #1 | 1306124-cart-query.patch | 1.41 KB | longwave |
Comments
Comment #1
longwaveComment #2
longwaveCommitted to 7.x.
Comment #3
longwaveComment #4
longwaveCommitted.
Comment #5
longwaveOops, this breaks the case where nodes are deleted but remain in the cart. Perhaps we should have a test for that!
Comment #6
longwaveFixed in both branches, and added a test to ensure deleted nodes don't show up in the cart.