I have just had a look at the tables - scrap my previous post :)
A small bit of php code should do the trick. Am I correct in thinking it would have to do the following :
For each record in the customer table :
1. Extract the customers_id
2. Insert a new record into the reward_customer_points table with the extracted customers_id copied into the corresponding field and a points value inserted into the reward_points field
Would this bit of code do the trick to add 200 points to each customer? :
PHP Code:
<?PHP
$user_name = "username";
$password = "password";
$database = "databasename";
$server = "localhost";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM customers";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
$custid=$db_field['customers_id'];
$SQLINSERT = "INSERT INTO reward_customer_points (customers_id, reward_points)"
. " VALUES ('$custid', 200)";
$rows = mysql_query($SQLINSERT);
if(!$rows) {
$message = "Insert error: " . mysql_error();
}
}
mysql_close($db_handle);
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
?>
Last edited by snowy2007; 9 Jun 2009 at 06:45 PM.
Quick question - I searched the thread but haven't found anything on it.
If I have Dual Pricing installed, it is possible to NOT allow my wholesale customers to accumulate points or would this be a custom bit of code?
Thanks!
Excellent!
Here's something to think about: Can you think of a way of doing this :
1. Give all customers the 200 points on Friday
2. If they haven't spent them (or some of them) by Sunday evening then take the 200 points away from them (time limited points offer basically).
Also, is there any easy way of turning the module off on a temporary basis - It is on the site now but I don't really want customers to be earning points until I send a newsletter out announcing it later this week.
I have ideas for a Campaign addon which would do things like that, as well as say double points for certain items ordered within a particular period and Reward Points being worth more (again it would be time based).
As for switching off the mod- Just uninstall the Order Total modules and switch off any of the Reward Point sideboxes under Layout Manager.
Bookmarks