Solving the issue if seller not logged in Opencart Multivendor API
API of an extension means that it would provide any data in JSON form which can be used in building any Mobile Application or any software and to get Data from any third party Extension, website, etc. API would simply return the response for any specific request in JSON form. Complete Multi Vendor Marketplace for OpenCart comes with API for Seller and Customer data where Purpletree multivendor has been used.
Most of the APIs provided with Complete Multi Vendor Marketplace for OpenCart is available for Seller only, however, some customer Data can also be fetched which contains Seller information and for detail, you can view the detailed Documentation for API for Purpletree Multivendor Marketplace at https://s3.ap-south-1.amazonaws.com/pts-doc/purpletree-multivendor-api-opencart.pdf.
For all the Seller APIs to work properly Seller must be logged in, and the session needs to be maintained with each API request. In-Browser customer/seller Session is maintained by the web browser itself, but in the case of API, there is no web browser involved in requests. Each API request can be made through any Application so to maintain the session you have to write your own set of logic for that in your application coding. For customer and seller, the API assumes that opencart session is available with seller/customer logged in. Values from opencart session are used to fetch corresponding data.
Complete Multi Vendor Marketplace for OpenCart doesn’t come with Seller Login API or Customer Login API. As we use customer session only for getting seller details, we assume that the Customer which is the seller is already logged in and application is managing the customer session accordingly. So to use the API for Complete Multi Vendor Marketplace for OpenCart Seller must be Logged in and if the seller is logged and you want to get any data from Seller you can simply use any API of Seller which is available in our extension as explained in Documentation of API for Purpletree Multivendor Marketplace.
If you want to Create a Mobile Application using Purpletree multivendor Data, you can simply buy our Mobile Application for Opencart 3 (Multilingual) which is a prebuilt app you just need to purchase and send us the details of your Opencart site. Complete Multi Vendor Marketplace for OpenCart is supported in our Mobile application if it is also purchased. This means if purchase Mobile Application for Opencart 3 (Multilingual) and Complete Multi Vendor Marketplace for OpenCart then you can use the app from the seller side also as seller options would be available in the Mobile Application.
Technical Solution suggestion
If you are using any other application means other than Purpletree Mobile app you need to maintain customer session as by sending Session ID with each request, means when Seller/Customer is logged in to their account using your API (Please Note this API is not provided by Purpletree). Get Session ID in response from Customer login and use that Session ID with each API request and handle that session-id in opencart accordingly. If you use it properly then you would get customer or seller Data which request Logged in by the Customer/Seller to fetch that Data. OR you can simply Buy our Mobile Application for Opencart 3 (Multilingual) which handles all the requests and mobile app is one of the best ready to launch apps provided for Opencart.
Along with Session ID with each Purpletree Multivendor API, you needs to send an extra parameter in the header for API to work properly which would be purpletreemultivendor and the value would be set as below from admin:
- Login to Admin panel > System > Users > API.
- Create a new API, enter the username as purpletreemultivendor and generate an API key and use this API key in value for a header in each API request.
- Set the Status to Enable and add your IP address or any other as it is required filed in API and Save it
More details of Purpletree Complete Opencart Multivendor extension can be found here.