News:

Looking for documentation? Take a look on our wiki

Main Menu

Starting with API

Started by Zilvermeeuw, May 29, 2021, 18:08:52 PM

Previous topic - Next topic

Zilvermeeuw

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?
If I never done it, I think I am able to do it.

Zilvermeeuw

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?
If I never done it, I think I am able to do it.

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Zilvermeeuw

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.
If I never done it, I think I am able to do it.

Studio 42

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

Zilvermeeuw

#5
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 I never done it, I think I am able to do it.

pinochico

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.

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

Studio 42

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

Zilvermeeuw

OK, thanks.

No API, just function calls.
If I never done it, I think I am able to do it.

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products