Closed (fixed)
Project:
e-Commerce
Component:
store.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Jun 2005 at 15:30 UTC
Updated:
12 Oct 2005 at 22:20 UTC
I noticed some wasted DB access in store.module store_user_history():
$name = db_result(db_query('SELECT name FROM {users} WHERE uid = %d', $uid));
$title = t('%username\'s order history', array('%username' => $name));
The required user name can be found in the global $user variable which is already available within the function to get the user id. So the code can be changed to:
$title = t('%username\'s order history', array('%username' => $user->name));
The second related issue is to how the pages title is set. The module is currently passing the title as a 3rd parameter:
print theme('page', $output, $title);
This error is made across the majority of e-commerce package modules.
Which as far as I can tell not supported anywhere (at least in v4.6). The corrected code should read:
drupal_set_title($title);
print theme('page', $output);
I'd submit a patch but my store.module is still hacked up and there's too many differences from current CVS version.
Comments
Comment #1
matt westgate commentedThat query is there because the admin can browse the user's history and we want to set the user name.
I updated the code to use drupal_set_title($title). Thanks.
Comment #2
(not verified) commentedComment #3
(not verified) commentedComment #4
(not verified) commentedComment #5
Méléis commentedComment #6
(not verified) commentedComment #7
(not verified) commentedComment #8
(not verified) commentedComment #9
(not verified) commented