2016-05-02 13 views
0

Magentoの残りアピモジュールのユーザーレビューや管理コントローラ機能に通常のHTMLフォームからのデータをポストする方法: -以下のように私は1つのHTMLフォームを作成している

<form action="http://localhost:81/magento/api/rest/forgetpass" method="post"> 
 
    <input type="text" name="apikey" placeholder="Api Key"/> 
 
    <br/> 
 
    <input type="text" name="email" placeholder="Email"/> 
 
    <br/> 
 
    <input type="submit" value="Submit"/> 
 
</form>

このファイルの場所です。 - C:\ xamppの\ htdocsに\ Magentoの\ api_files \

testapi.php今すぐマイゲストコントローラ機能がある: -

<?php 
 

 
/** 
 
* Override for Magento's Catalog REST API 
 
*/ 
 
error_reporting(-1); 
 

 
// Same as error_reporting(E_ALL); 
 
ini_set('error_reporting', E_ALL); 
 
class Esoft_ExtendRestApi_Model_Api2_Forgetpass_Rest_Guest_V1 extends Mage_Api2_Model_Resource { 
 

 
    /** 
 
    * Retrieve the attribute options 
 
    * @return attribute options 
 
    */ 
 
    
 
    protected function _update($data) 
 
    { 
 
     $email = $data["email"]; 
 
     try 
 
     { 
 
      $customer = Mage::getModel('customer/customer') 
 
        ->setWebsiteId(1) 
 
        ->loadByEmail($email); 
 
      $customer->getRpToken(); 
 
      $customer->sendPasswordResetConfirmationEmail(); 
 
      
 
      $array = array("status" => "200", "error" => "Email sent successfully."); 
 
      return json_encode($array);  
 
     } catch (Exception $e) { 
 
      $array = array("status" => "500", "error" => $e->getMessage()); 
 
      return json_encode($array); 
 
     }  
 
    } 
 
    
 
    protected function _retrieve() 
 
    { 
 
     //code 
 
    } 
 

 
    /** 
 
    * TODO 
 
    * 
 
    * @return int 
 
    */ 
 
    protected function _retrieveCollection() 
 
    { 
 
     //code 
 
    } 
 
}

は今、私が何をしたいのか、私はこのコントローラ機能へのHTMLフォームからのデータを渡したいです。

は、私がデータを提出しようとするが、それは言う: -

<magento_api> 
 
<messages> 
 
<error> 
 
<data_item> 
 
<code>403</code> 
 
<message>Access denied</message> 
 
</data_item> 
 
</error> 
 
</messages> 
 
</magento_api>

+0

みんなを助けることを願っています.... :) –

答えて

0

はイエスその後、 あなたのモジュールに役割を割り当ててください場合は、api2.xmlを作成した手順の下に従います。

system->web services->REST Role guest 

その後、モジュールと特権を確認します。

system->web services->REST Attribute guest 

これは誰も私を助けて

+0

おかげで私は試してみて、あなたが知っているだろう –

関連する問題