I would like to start learning the API of Virtuemart.
I am reading https://api.virtuemart.net, but nothing what I do works.
Does anybody have an example how to start with the API?
I added "include "testapi.php";" at the beginning of "administrator/components/com_virtuemart/views/orders/tmpl/orders.php". So when I open de Virtuemart orders list, the script "testapi.php" is called.
the array $this->orderslist contains all orders
the member 0 contains information about the last order ($this->orderslist[0])
The following vmJsApi works (it is a copy from orders.php)
$order = $this->orderslist[0];
echo vmJsApi::date ($order->created_on, 'LC2', TRUE) ."<br>";
In https://api.virtuemart.net several classes are given. For example the following. But this is not working (I tried several classes).
$q = VirtuemartViewOrders::display ($order);
echo "q = ". $q .".<br>";
Also the first vmJsApi parameters, I cannot find in the api.virtuemart.net website.
I think I am on the wrong track. But where?
why do you need API?
I would like to:
- interface between an ERP system and Virtuemart (Orders, products, stock, clients)
- Write an interface between several Virtuemart webshops to have products in those webshops or to move products between webshops (products, categories)
- To learn more about programming in PHP with classes.
The APi is to use in Joomla. If you want connect an ERP, you have to use (joomla) plugins, you have no external APi for Virtuemart.
You have some extensions that can render a list of product with some filters, but what you want to do is a big task(hundreds Hours of dev)
I see that you do not a PHP expert, so first you have to understand MVC, Joomla and after VIrtuemart before trying to create your own API
I know I have to write a plugin. I already created two MVC's in Joomla. With PHP, SQL and calls to the ERP with its API. (So I am an expert wanebee, see my signature)
I like the way, an API works. Just ask some information and get an answer. Without need for knowledge of the SQL database or array structures.
To get rid of the SQL queries I would like to use API's. Therefor I made the above (very simple, without plugin) example and tried several formats of the line. But none are working.
Clearly I miss something.
Edit: If found the class vmJsApi and played around with it. This works.
I would like to use the class, mentioned in https://api.virtuemart.net/annotated.html.
How can I call these classes?
if you want connect ERP you have to write your custom class in your plugin.
(we connected SAP, KTK, online app on mobile with VirtueMart).
Or you can use existing solutions
- with Xml/CSV files (+ cron) - we connected Cesar, Helios
- with DB - we connected Pohoda, MoneyS4
We don't use API VM.
If you click on the function details, you see that this list is only a function list of other plugins .
For eg BatchDelete :
The documentation for this class was generated from the following file:
plugins/vmcalculation/avalara/classes/BatchSvc/BatchDelete.class.php
You have no way to communicate with Vm directly using an API
OK, thanks.
No API, just function calls.
That is right