合并magento客户

问题描述:

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

您可以退还一个账户的订单(实际上不退还任何费用),并使用支票付款方式(实际上不收取任何费用)在另一个账户下提交相同的账户。这样你就可以直接修改数据库,而不会发生活动的痕迹。

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

+0

yuck。如果我找到或想出解决方案,我会添加一个答案。 –

假设您有权创建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; 

我在找同样的东西。绝对是需要的延伸。

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

但是这非常耗时,如果有人可以编写一个模块,我会付出代价的。