Is it possible to add orders, made with a specific e-mail address to a newly created account?
I have customers who have purchased several times, but only with the last order they created an account.
they used the same mail address for every order. how can i add these orders to the account?
I have customers who have purchased several times, but only with the last order they created an account.
they used the same mail address for every order. how can i add these orders to the account?
Last edited by fourgood on Mon Dec 19, 2011 7:59 pm, edited 1 time in total.
Try the attached file.
Upload it to your store root then run it in a browser.
BACKUP your order table in your database first.
Upload it to your store root then run it in a browser.
BACKUP your order table in your database first.
Attachments
Code: Select all
<?php
require_once('config.php');
require_once(DIR_SYSTEM . 'startup.php');
// Registry
$registry = new Registry();
// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
// Config
$config = new Config();
$registry->set('config', $config);
// Database
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$registry->set('db', $db);
$query = $db->query("SELECT DISTINCT email, customer_id as cid FROM `" . DB_PREFIX . "order` WHERE customer_id > 0");
foreach ($query->rows as $row){
$query2 = $db->query("UPDATE `" . DB_PREFIX . "order` SET customer_id = '". (int)$row['cid'] ."' WHERE LCASE(email) = '".strtolower($row['email'])."'");
}
echo 'done';
@unlink('runonce.php');
Code: Select all
WHERE customer_id > 0");
I`ve solved it!
Code: Select all
$query = $db->query("SELECT DISTINCT email, customer_id as cid FROM `order` WHERE customer_id > 0");
foreach ($query->rows as $row){
$query2 = $db->query("UPDATE `order` SET customer_id = '". (int)$row['cid'] ."' WHERE LCASE(email) = '".strtolower($row['email'])."' AND customer_id = 0");
}
Who is online
Users browsing this forum: No registered users and 14 guests