我试图创建一个POS系统,将显示的情况下,产品,订单,登录详细信息,发货细节和付款在一个单一的页面。我已经提取了产品,并在同一页中创建了一个购物车,并创建了一个登录/创建帐户,发货和付款块。我想在登录块中创建一个客户,而不必重定向到另一个页面。我能够使用表格中的以下代码提取客户的详细信息。
$customerModel = Mage::getModel('customer/customer'); //get customer model
$customerCollection = $customerModel->getCollection();
$customers = array();
$i = 0;
foreach ($customerCollection as $customer)
{
$customer = $customerModel->load($customer->getId());
$customers[$i]['name'] = $customer->getName();
$customers[$i]['email'] = $customer->getEmail();
$customers[$i]['password'] = $customer->getPassword();
$i++;
}
foreach($customers as $k => $v)
{
$html.= 'Customer name :'.$v['name']. 'Customer Email :'.$v['email'].'Password:'.$v['password'];
}如何通过代码创建客户,以及如何在不重定向到另一个页面的情况下对用户进行身份验证并提取其所有详细信息。
发布于 2014-03-07 14:06:02
您必须连接一些aJax才能注册用户。
$customer = Mage::getModel('customer/customer');
$customer->setFirstname('Joe');
$customer->setLastname('Bro');
$customer->setEmail('joebro@yahoo.com');
$customer->setPassword('');
$customer->save();
return $customer->getId();只需查看app/code/core/Mage/Customer/controllers/AccountController.php
也可以在保存用户后返回ID,并
$session = Mage::getSingleton('customer/session');
$session->loginById($customer->getId());https://stackoverflow.com/questions/22242653
复制相似问题