Delphiµ÷ÓÃMagento's Webservice
×î½üÐèÒª½«Magento(¹úÍâ±È½Ï³öÃûµÄ¿ªÔ´PHP+MySQLµç×ÓÉÌÎñÍøÕ¾)ÓëÒ»¸öERP½øÐÐÕûºÏ£¬¾ÍÐèÒªµ÷ÓÃMagentoµÄWebservice¡£
MagentoÌṩ2Ì×api¡£
×¢£ºÈç¹ûÐèҪͬ¹¹µ÷ÓÃÐèҪʹÓõÚ1¸öwsdl£¬ÈçÒì¹¹³ÌÐòµ÷ÓÃÐèʹÓõÚ2¸öwsdl¡£
1.http://xxx.xxxxxxx.xxx/magento/api/soap/?wsdl
2.http://xxx.xxxxxxx.xxx/magento/api/v2_soap/?wsdl
µ÷Óò½Öè
Ò»¡¢ÔÚMagentoÖд´½¨µ÷ÓÃWebserviceµÄÓû§ÃûÓëÃÜÂë(½øÈëMagentoºǫ́¹ÜÀí->System->Web Services->Users)£¬ÔÚ´´½¨Óû§Ç°ÏÈÉè¼ÆÒ»¸ö½ÇÉ«(½øÈëMagentoºǫ́¹ÜÀí->System->Web Services->Roles)£¬ÓÃÀ´¶Ôµ÷ÓÃWebserviceµÄȨÏÞ½øÐÐÏÞÖÆ
¶þ¡¢ÔÚDelphi¶ËÓÃWSDL Import¹¤¾ß½øÐе¼È룬µ¼Èëºó»á×Ô¶¯Éú³ÉÏà¹Ø¶ÔÏóµÄÀàÐÅÏ¢
Èý¡¢Ê¹ÓÃMagentoµÄ½Ó¿Ú£¬µ÷ÓÃlogin¡¢salesOrderInfoµÈº¯Êý
Àý1£ºËÑË÷Ïà¹Ø×´Ì¬µÄ¶©µ¥
procedure TFrmSiteManagement.getOrderList;
var
P:Mage_Api_Model_Server_V2_HandlerPortType;
sessionID:WideString;
filterOn:filters;
aE:associativeEntity ;
aA:associativeArray;
orderList:salesOrderEntityArray;
order:salesOrderEntity;
i:Integer;
begin
P:= HTTPRIO1 as Mage_Api_Model_Server_V2_HandlerPortType;
//filter
filterOn:=filters.Create;
SetLength(aA,1);
aE:=associativeEntity.Create;
aE.key:='status';
aE.value:='Pending';
aA[0]:=aE;
filterOn.filter:=aA;
try
try
sessionID:= P.login('apiuser','apiuser');
orderList:=P.salesOrderList(sessionID,filterOn);
for i:=low(orderList) to high(orderList) do
begin
sessionID:= P.login('apiuser','apiuser');
order:=P.salesOrderInfo(sessionID,orderList[i].increment_id);
addContent(i,order) ;
end;
except
on E:Exception do
begin
ShowMessage(E.Message);
end;
end;
finally
P:=nil;
aE.Free;
SetLength(aA,0);
end;
end;
Àý2£ºLoad¶©µ¥Ã÷ϸ
var
P:Mage_Api_Model_Server_V2_HandlerPortType;
sessionID:WideString;
order: salesOrderEntity;
begin
P:= HTTPRIO1 as Mage_Api_Model_Server_V2_HandlerPortType;
try
try
sessionID:= P.login('apiuser
Ïà¹ØÎĵµ£º
ö¾ÙÀàÐÍ
¡¡¡¡Pascal³ÌÐò²»½öÓÃÓÚÊýÖµ´¦Àí£¬»¹¸ü¹ã·ºµØÓÃÓÚ´¦Àí·ÇÊýÖµµÄÊý¾Ý¡£ÀýÈ磬ÐÔ±ð¡¢Ô·ݡ¢ÐÇÆÚ¼¸¡¢ÑÕÉ«¡¢µ¥Î»Ãû¡¢Ñ§Àú¡¢Ö°ÒµµÈ¡£
1¡¢Ã¶¾ÙÀàÐ͵͍Òå
¸ñʽ:¡¡type ö¾ÙÀàÐͱêʶ·û=(±êʶ·û1,±êʶ·û2,¡,±êʶ·ûn)
2¡¢Ã¶¾ÙÀàÐÍÊý¾ÝÌØµã
¢Ù ö¾ÙÔªËØÖ»ÄÜÊDZêʶ·û£»
ÀýÈ磬ÏÂÁÐÀàÐͶ¨ÒåÊǺϷ¨µÄ£º
¡¡ ......
¼¼Êõ½»Á÷,DH½²½â. Õâ¸ö¹¤¾ßÊǺÃÔçºÃÔçÒÔǰдµÄ,ÎÒÕâ¸öϲ»¶Ôڼұ߿´µçÓ°±ßдд´úÂë»òÕß¿´µç×ÓÊé,ËùÒÔ¾³£»á½«ÍøÒ³ÒƵ½ÆÁÄ»µÄ×óÉϽǻòÕßÓÒÉϽÇ,¶øÇÒÒªÖö¥.ËùÒÔ¾ÍдÁËÕâÑùÒ»¸ö¹¤¾ß,Õâ¸ö¹¤¾ßÖ÷ÒªÊǶԾä±úµÄ²Ù×÷,»¹ÓоÍÊÇ´°ÌåÑùʽÒÔ¼°¼¸¸öAPIµÄÀý×Ó,±È½Ï»ù´¡. Õû¸öÎļþÔÚ here(Can't Input Chinese:() ÏÂÃæ°Ñ´úÂëÌù³öÀ´,Ï£Íû ......
type
TTurboRecord = record
strict private
fNameValue : integer;
function GetName: string;
public
NamePrefix : string;
constructor Create(const initNameValue : integer) ;
property Name : string read GetName;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
......
ÓÅÐãµÄÊý¾Ý¿âÓ¦ÓÃÓ¦µ±³ä·Ö¿¼ÂÇÊý¾Ý¿â·ÃÎʵÄËÙ¶ÈÎÊÌ⡣ͨ³£¿ÉÒÔͨ¹ýÓÅ»¯Êý¾Ý¿â¡¢ÓÅ»¯ ²éѯÓï¾ä¡¢·ÖÒ³²éѯµÈ;¾¶ÊÕµ½Ã÷ÏÔµÄЧ¹û¡£¼´Ê¹ÊÇÕâÑù£¬Ò²²»¿É±ÜÃâµØ»áÔÚ²éѯʱÉÁÏÖÒ»¸ö´øÓÐ SQL·ûºÅµÄɳ©£¬¼´Êó±ê±ä³ÉÁ˲éѯµÈ´ý¡£×î¿ÉÁ¯µÄÊÇÓû§£¬Ëû£¨Ëý£©ÔÚ´ËʱֻÄÜÎÞÄεصȴý¡£Óöµ½¼±ÐÔ×ӵ쬏ɴàÔÚ´Ëʱ³¢ÊÔ WindowsÖÐµÄÆäËüÓ¦ÓóÌÐ ......
ÒÔCaps Lock¼ü¾ÙÀý£¬ÆäËü(VK_NUMLOCK),Ààͬ£º
ÅжÏ״̬£º
·½·¨1
Level: integer;
Level := GetKeyState(VK_CAPITAL);
if Level = 0 then
//ûÁÁ
else
//ÁÁÁË(1)
·½·¨2
KeyState : TKeyBoardState;
GetKeyboardState(KeyState);
if KeySt ......