SMF Shop
SMFShop => Coding => Topic started by: joomla.cc on November 10, 2006, 04:55:06 pm
-
Hey,
I thought I might be able to help a little. Inside Display.template.php file, I found this:
//I couldn't find where all these $message['member'][whatever] variables
//are set, so I just send an extra database query to get the member's
//money. Can someone tell me where (file and line) the $message variables
//are set?
global $ID_MEMBER, $db_prefix;
$result_money = db_query("SELECT money
FROM {$db_prefix}members
WHERE ID_MEMBER = {$message['member']['id']}
LIMIT 1", __FILE__, __LINE__);
$row_money = mysql_fetch_array($result_money, MYSQL_ASSOC);
Well, here is some tips.
Since we do not welcome database calls inside a template file, I suggest the following change:
Remove the bit I quoted above, and replace $row_money['money'] with $message['member']['credit'].
Next:
Open $sourcedir/Load.php
Find: mem.ID_POST_GROUP, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline,
Replace with: mem.ID_POST_GROUP, mem.lngfile, mem.ID_GROUP, mem.timeOffset, mem.showOnline, mem.money,
Find: mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin,
Replace with: mem.birthdate, mem.ICQ, mem.AIM, mem.YIM, mem.MSN, mem.posts, mem.lastLogin, mem.money,
Find: 'local_time' => timeformat(time() + ($profile['timeOffset'] - $user_info['time_offset']) * 3600, false),
Add After: 'credit' => $profile['money'],
Obviously not many would care, I know, but for the sake of clean coding, hope this will give you some directions to where extra member variables can be set.
Good luck. O0
Alex
Joomla! Cyber Community (http://www.joomla.cc)
-
Don't know about daniel, but I did this and it is awesome...so many queries removed!
-
Hi,
Thanks for that... I was going to do this, but never got around to finding out how. :P.
I'll probably implement this in the next release, but the problem is how will it edit the previous installs? Should the next upgrade package remove the code from Display.template.php?
-
This has been implemented in the latest development version of SMFShop (Revision 37)
-
Good to hear that, Daniel. And glad I could help :) Is there anything to mention using PayPal to supply credit amount?
-
In your development plans for SMFShop I mean :)
-
People have been asking about PayPal implementations in SMFShop since the day it came out :P. Unfortunately, I'm not really sure how to implement it...
(My 'TODO' list is still very very long and not many things have been done :P)