一页客户登录并在magento中展示详细信息(自定义扩展)

时间:2014-03-07 05:56:31

标签: php magento zend-framework magento-1.8

我正在尝试创建一个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'];
            }

如何通过代码创建客户,如何验证用户身份并提取他/她的所有详细信息,而无需重定向到其他页面。

1 个答案:

答案 0 :(得分:0)

你必须连接一些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());