Magento SOAP WebService->;用户登录


Magento SOAP WebService -> User Login

我正在编写一个用于移动设备和magento之间通信的web服务,我正在使用magento提供的SOAP web服务,但是,我在用户身份验证方面迷失了方向,我需要对我的系统用户(而不是api用户)进行身份验证。这里面有线索吗?

您不能使用SOAP Api在magento中记录用户帐户,因为它不支持该功能,您必须以另一种方式处理它,可能会覆盖Mage Customer中名为AccountController.php的控制器文件。

尝试添加一个新的方法,该方法可以使用JSON变量与服务器通信。

您可以使用RESTapi对客户进行身份验证。http://www.magentocommerce.com/api/rest/introduction.html

这种方法似乎更方便,因为您可能会收到一个产品列表,其中包含已登录客户的应用目录规则(假设由客户组应用)。SOAP API不提供这样的功能(您只能以管理员用户的身份接收产品列表)。

使用此

$mageFilename = 'app/Mage.php';
require_once $mageFilename;
$app = Mage::app('default'); 
Mage::app();
$user = "snjha77@gmail.com";
$pass = "admin123";
$session = Mage::getSingleton( 'customer/session' );
    Mage::app()->getStore()->setWebsiteId(1);
    try
    {
        $session->login( $user, $pass);
        $customer = $session->getCustomer();
        //echo "valid";
        $userID = $session->getCustomer()->getId();
    $return_array['customer_id'] = $userID;
        $return_array['status'] = 1;
        $return_array['message'] = "Login is valid";
        echo json_encode($return_array);
        } catch( Exception $e ) {
            $return_array['status']= 0;
        $return_array['message']="Login is invalid";
        echo json_encode($return_array);
              }

不,你不能那样做。如果您可以通过FTP访问文件,则可以获取数据库配置文件的_file_content,然后从外部源连接到数据库并执行用户访问检查。

自行承担风险。也许它无效。但你可以试试