首页 > 代码库 > magento开发 -- 修改当前用户的客户组

magento开发 -- 修改当前用户的客户组

$customer = Mage::getSingleton(‘customer/session‘)->getCustomer();

$customer->setData( ‘group_id‘, ‘2‘);

$customer->save();


同理,你也可以修改用户的其它信息

 

[Magento SQL] 获取指定用户组,每个客户历史总订单数量和销售金额

SELECT customer_id,group_id,email,SUM(grand_total) AS total_amount,COUNT(*) AS orders_num FROM sales_flat_order_grid
LEFT JOIN customer_entity ON customer_entity.entity_id = sales_flat_order_grid.customer_id
WHERE `status`=‘complete‘ AND customer_id IS NOT NULL AND customer_entity.group_id = 1
GROUP BY customer_id
ORDER BY orders_num DESC

 

from: 网络

magento开发 -- 修改当前用户的客户组