motabik Posted February 25, 2015 Share Posted February 25, 2015 HiI develop import data from excel to prestashop with API.I have little problem with images management.What I create to send and import image for products.Communications is ready and I haven't any problemHere is my code.pathImage = "image=c:\Users\Downloads\blade.jpg"Dim TargetUrl As StringTargetUrl = "http://MyPresta/api/images/products/2"Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")HTTPReq.Option(4) = 13056 'HTTPReq.Open "get", TargetUrl, FalseHTTPReq.SetCredentials "user", "password", 0HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"HTTPReq.send (pathImage)MsgBox (HTTPReq.responseText) Link to comment Share on other sites More sharing options...
razvy Posted June 21, 2016 Share Posted June 21, 2016 Hi! Did you succeed? Can you help me with a VBA sample to update the stock and status of a product? Thanks! Link to comment Share on other sites More sharing options...
motabik Posted June 21, 2016 Author Share Posted June 21, 2016 Yes, I wrote program to add, update all products, generate photos,and updated stock, price, status, etc.But I do this not API, becauce it not working good.I installed odbc for mysql and created connection with ADODBthen I can update any table in database.here you have simple code.Private Const PrestaAccessMySql As String = "Driver={MySQL ODBC 3.51 Driver}; Server=serverDomain; Database=databaseName; Uid=databaseLogin; Pwd=databasePassword;"If you connect with other driver you must change Driver=Driver={MySQL ODBC 5.3 ANSI Driver}or otherFunction doQuery(ByRef txQuery As String) As IntegerDim conn As ADODB.ConnectionDim rst As ADODB.RecordsetOn Error GoTo transErrorSet conn = New ADODB.Connectionconn.Open PrestaAccessMySqlSet rst = New ADODB.Recordsetrst.Open txQuery, conndoQuery = 1conn.CloseExit FunctiontransError:doQuery = 0 conn.RollBack rst.Close conn.Close MsgBox Err.descriptionEnd Functiongood luck Link to comment Share on other sites More sharing options...
razvy Posted October 29, 2016 Share Posted October 29, 2016 Hi, I couldn't figure it out... Could you please provide me more detailed instructions? I only need a simple example, then I can develop it. For example I need to change the quantity of the product with ID 111111 from 1 to 0 and also de-activate the same product. Could you please send me an .xlsm file as example? Thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now