Magento忘记密码肥皂API

时间:2015-10-09 05:51:47

标签: php api magento soap

每个人我都是新来的。  我坚持使用Magento API。我正在为我的e-commerece网站创建Magento API。我创建了所有API但是忘记了密码API我没有得到任何解决方案。我使用默认忘记密码控制器,但它没有给我发送更改密码的电子邮件链接检查我的代码,请帮我设置这个忘记密码API。我也搜索所有文件,但得到任何答案。我也发布了我的代码所以请参考它,让我知道我哪里有错误。



<?php
error_reporting(E_ALL); 
ini_set("display_errors", 1);
$email = $_REQUEST['email'];  
require_once ('../app/Mage.php');
Mage::app();
$customer = Mage::getModel('customer/customer')
            ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
            ->loadByEmail($email);
//print_r($customer);


if ($customer->getId()) {
            try {
                $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
                $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
                $customer->setStoreId(Mage::app()->getStore()->getId());
                $customer->sendPasswordResetConfirmationEmail();
				$response['response'] = "success";
				  $response['message']="Password Reset Link Has Been Sent to Your Email Please Check, Your Mail Box!";
				  echo json_encode($response);
				
            } catch (Exception $exception) {
                Mage::log($exception);
            }
        }else{
				  $response['response'] = "failed";
				  $response['message']="Please Enter a Valid Email!";
				  echo json_encode($response);
		}
?>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

最近我工作忘记密码magento api它工作正常但很难我发现我必须将我的忘记密码文件名保存到index.php。制作一个api文件夹并使用index.php的名称保存它

 <?php

if(!empty($_REQUEST['email']))

{
$yourCustomerEmail=$postcode = $_REQUEST['email'];
$customer = Mage::getModel('customer/customer')
        ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
        ->loadByEmail($yourCustomerEmail);
//echo $customer->getId();
        if ($customer->getId()) {

        try {
            $newResetPasswordLinkToken =  Mage::helper('customer')->generateResetPasswordLinkToken();
            $customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
            $customer->sendPasswordResetConfirmationEmail();
$result = array('action'=> 'send','statuscode'=> '200');
             echo json_encode($result);
            } catch (Exception $exception) {
//echo "Exception";
                Mage::log($exception);
        }
    }
    else
    {
$result = array('action'=> 'failed','statuscode'=> '300');
echo json_encode($result);
    }

}
else
{
$result = array('action'=> 'failed','statuscode'=> '300');
echo json_encode($result);
}
        ?>