I was wondering if there is a forum add-on for CS-Cart? I sell custom gaming computers and having a forum or blog would be nice to interact with my customers.
Thanks,
VGC
There really is no “addon” for cs-cart, but you can get an excellent forum software at [URL]http://simplemachines.org/[/URL].
Matt, Simple Machines looks good. And its free too.
Have you been able to integrate Simple Machines into/with CS-Cart: one login for both, etc.?
No I haven’t tried yet. However, it might be easy to construct a mod for it.
Here are the member table fields and the corresponding cs-cart user table fields. The given cs-cart fields are the only required ones to register on an SMF forum.
ID_MEMBER
memberName *user_login*
dateRegistered *timestamp*
posts
ID_GROUP
lngfile
lastLogin *last_login*
realName *firstname* *lastname*
instantMessages
unreadMessages
buddy_list
pm_ignore_list
messageLabels
passwd *password*
emailAddress *email*
personalText
gender
birthdate
websiteTitle
websiteUrl
location
ICQ
AIM
YIM
MSN
hideEmail
showOnline
timeFormat
signature
timeOffset
avatar
pm_email_notify
karmaBad
karmaGood
usertitle
notifyAnnouncements
notifyOnce
notifySendBody
notifyTypes
memberIP
memberIP2
secretQuestion
secretAnswer
ID_THEME
is_activated
validation_code
ID_MSG_LAST_VISIT
additionalGroups
smileySet
ID_POST_GROUP
totalTimeLoggedIn
passwordSalt
Here’s my solution. However, it will try to enter duplicate usernames if a customer tries to create one. This is why I’m not going to use this mod.
- Make sure this is at the bottom of the store config.php (before “?>”)
```php
class database {
public $db = false;
function _construct($db_host,$db_user,$db_pass,$db_name) {
$connection = mysql_connect($db_host,$db_user,$db_pass);
if($connection) {
$dbase = mysql_select_db($db_name,$connection);
if($dbase) {
$this->db = true;
return true;
} else {
$this->db = false;
return false;
}
} else {
$this->db = false;
return false;
}
}
function select($fields, $tableName, $where=“”, $groupby=“”, $orderby=“”, $limit=“”, $showerrors=false) {
$data = array();
if (!$this->db) {
if ($showerrors) {
echo “Unable to select database.
\n”;
}
return $data;
} else {
$fieldCount = count($fields);
$sql = “SELECT " . implode(”,“,$fields) . " FROM $tableName” . (($where == “”)?“”:" WHERE $where") . (($groupby == “”)?“”:" GROUP BY $groupby") . (($orderby == “”)?“”:" ORDER BY $orderby") . (($limit == “”)?“”:" LIMIT " . $limit);
$result = mysql_query($sql);
if (!$result) {
if ($showerrors) {
echo “Sorry, could not get " . $tableName . " at this time.
\n”;
}
} else {
if (mysql_num_rows($result) == 0) {
if ($showerrors) {
echo “Sorry, there are no " . $tableName . " at this time, please try back later.
\n”;
}
} else {
$n = 0;
while($row=mysql_fetch_array($result, MYSQL_ASSOC)) {
for ($j=0; $j<$fieldCount; $j++) {
$field = $fields[$j];
if(substr_count($field,“AS”) > 0) {
$field = preg_replace('/.+AS[^A-Z]+([A-Z]+)[^A-Z]{0,1}/i’, ‘\1’, $field);
}
$data[$n][$j] = $row[$field];
}
$n = $n + 1;
}
}
}
}
return $data;
}
function non_select_query($query,$showerrors = false) {
if (!$this->db) {
if ($showerrors) {
echo “Unable to select database.”;
}
return false;
} else {
$result = mysql_query($query);
if (!$result) {
if ($showerrors) {
echo “There was an error in your SQL syntax.
\n
\n$query”;
}
return false;
} else {
return true;
}
}
}
}
```2. In “/include/common/profiles.php”
AFTER
```php
$redirect_url = fn_create_profile($user_data, @$shipping_eq_billing, (defined(‘AJAX_REQUEST’) ? true : false), $notify_customer, $auth);
```ADD
```php
$database = new database(‘host’,‘user’,‘password’,‘forum_database’);
$database->non_select_query(“INSERT INTOsmf_members
(ID_MEMBER
,memberName
,dateRegistered
,posts
,ID_GROUP
,lngfile
,lastLogin
,realName
,instantMessages
,unreadMessages
,buddy_list
,pm_ignore_list
,messageLabels
,passwd
,emailAddress
,personalText
,gender
,birthdate
,websiteTitle
,websiteUrl
,location
,ICQ
,AIM
,YIM
,MSN
,hideEmail
,showOnline
,timeFormat
,signature
,timeOffset
,avatar
,pm_email_notify
,karmaBad
,karmaGood
,usertitle
,notifyAnnouncements
,notifyOnce
,notifySendBody
,notifyTypes
,memberIP
,memberIP2
,secretQuestion
,secretAnswer
,ID_THEME
,is_activated
,validation_code
,ID_MSG_LAST_VISIT
,additionalGroups
,smileySet
,ID_POST_GROUP
,totalTimeLoggedIn
,passwordSalt
) VALUES (NULL, ‘$user_data[user_login]’, '” . strtotime(date(“m/d/Y”)) . “‘, ‘0’, ‘0’, ‘’, ‘0’, ‘$user_data[firstname] $user_data[lastname]’, ‘0’, ‘0’, ‘’, ‘’, ‘’, MD5(’$user_data[password1]'), ‘$user_data[email]’, ‘’, ‘0’, ‘0001-01-01’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘0’, ‘1’, ‘’, ‘’, ‘0’, ‘’, ‘0’, ‘0’, ‘0’, ‘’, ‘1’, ‘1’, ‘0’, ‘2’, ‘’, ‘’, ‘’, ‘’, ‘0’, ‘1’, ‘’, ‘0’, ‘’, ‘’, ‘0’, ‘0’, ‘’);”);
```
Looks good! I’ll give it a try once I get the website up live in the next couple of days.
Thanks,
VGC
Looking forward to hear how it turned-out.
how about now ?