合并magento客户

时间:2011-07-14 19:44:03

标签: magento

有没有办法在Magento合并客户帐户?我有一个客户的电子邮件已损坏(或他们说),所以他们创建了一个新帐户。我希望能够将旧客户的历史合并到新客户中。这可能吗?

3 个答案:

答案 0 :(得分:1)

假设您有权创建MySQL存储例程并且您拥有information_schema数据库,则以下代码将合并客户。请注意,在创建例程之后,您需要使用客户的entity_id作为参数来运行它。

drop procedure if exists merge_customers;
delimiter //
create procedure merge_customers(
  id1 int unsigned, -- the customer to keep
  id2 int unsigned) -- the record to delete
begin
declare done int default false;
declare tbl_name, col_name varchar(255);
declare c cursor for
  select table_name, column_name
  from information_schema.key_column_usage
  where table_schema = database()
    and referenced_table_name = 'customer_entity'
    and referenced_column_name = 'entity_id';
declare continue handler for not found set done = true;
open c;
read_loop: loop
  fetch c into tbl_name, col_name;
  if done then
    leave read_loop;
  end if;
  set @str = concat(
    'UPDATE IGNORE ', tbl_name,
    ' SET ', col_name, ' = ', id1,
    ' WHERE ', col_name, ' = ', id2
  );
  prepare stmt from @str;
  execute stmt;
  deallocate prepare stmt;
end loop;
close c;
delete from customer_entity where entity_id = id2;
end//
delimiter;

答案 1 :(得分:0)

您可以退还一个帐户的订单(实际上不退还任何费用),并使用支票付款方式(实际上不收取任何费用)在另一个帐户下提交相同的订单。这样,如果直接更改了数据库,就会有活动的纸质记录。

另外,问问自己这个人可能没有好处吗?你有多确定他们是谁?只要知道他们的宠物的名字或任何一个秘密问题,只能证明他们已经看到了第一个人的Facebook页面。电子邮件遭到“损坏”甚至意味着什么?

答案 2 :(得分:0)

我正在寻找同样的事情。绝对是必要的扩展。

我目前在两个表Customer_ID&中的phpMyAdmin中手动更改sales_flat_order sales_flat_order_grid。您可以在magento Admin中找到客户ID,在客户部分的第二列中找到该客户ID。

但这非常耗费时间,如果有人可以写一个模块,那就太棒了,我付出代价。

相关问题