我有這個代碼,我試圖在我的網站上使用prestashop模式創建一個新客戶。但我一直在響應收到錯誤PrestaShop創建客戶
NSString *xmlPath = [[NSBundle mainBundle] pathForResource:@"Login" ofType:@"xml"];
NSString *xmlStr = [[NSString alloc] initWithContentsOfFile:xmlPath encoding:NSUTF8StringEncoding error:nil];
NSString *encodedurlstring = (__bridge NSString*) CFURLCreateStringByAddingPercentEscapes (NULL, (__bridge CFStringRef) xmlStr, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8);
NSString *urlStr = [NSString stringWithFormat:@"http://passkey:@farma-web.it/api/customers/?Xml=%@",encodedurlstring];
NSURL *webURL = [NSURL URLWithString:urlStr];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:webURL];
[request setHTTPMethod:@"POST"];
[request setValue: @"text/xml" forHTTPHeaderField: @"Content-Type"];
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *response = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
NSLog(@"response - %@",response);
,我已附上XML是
<prestashop>
<customers>
<customer>**I DO NOT KNOW WHAT TO WRITE HERE**</customer>
<email>[email protected]</email>
<passwd>12344321</passwd>
<firstname>ABC</firstname>
<lastname>DEF</lastname>
</customers>
</prestashop>
,我得到的響應
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<errors>
<error>
<message><![CDATA[Internal error. To see this error please display the PHP errors.]]></message>
</error>
</errors>
</prestashop>
我卡住了同樣的問題,如果你解決了這個問題,請分享! – lelloman 2013-06-29 09:38:06
嘿,首先在你的prestashop上啓用調試日誌。爲此,請編輯此文件$(PrestashopDirectory)/config/settings.inc.php並設置define('_ PS_MODE_DEV_',** true **); – 2013-07-02 07:00:44
我仍然無法創建新客戶。我現在正在對它進行一些研究。但是我已經成功完成了地址部分,以防您希望在此API中獲得幫助。 – Swati 2013-07-02 08:06:17