
Hello, dear readers of Habr. This material is a continuation of a series of articles on how to build a VPS hosting from scratch based on the RUVDS White Label API. And today we look at the popular Joomla CMS and one of the most popular ecommerce solutions for it -
VirtueMart .
Virtuemart
Generally speaking, the extension exists quite a long time ago (the first version was released in 2005).
The product grew and developed together with CMS Joomla and
currently has quite a wide functionality.
Let's take a look at the pros and cons of the Virtuemart 3 plugin.
pros
- gratuity
- custom fields
- one-click order form
- multicurrency
- simple order process
- flexible and powerful access control system
- a lot of payment methods available out of the box
')
Minuses
- cumbersome code and performance issues
- there is no simple API for integration with external services
- default supported payment systems are west oriented (paypal, skill, 2checkout)
- relatively small community (~ 317,127 people registered in the official forum , the repository is not very active, and the number of developers involved is small (for comparison, 470 developers in the woocommerce repository, which is 10 times more)
- low speed of adding new functionality (a consequence including the previous paragraph)
- security issues caused by the popularity of both CMS Joomla and the virtuemart extension itself
Features adaptation for vps-hosting
Payment acceptance
The procedure is the same as when using other bundles, such as
wordpress and woocommerce . In order to integrate with the
paymaster aggregator already
familiar to us , download the
free extension . The paymaster extension setting is described in detail at the same link.
Deactivate guest purchase mechanism
Go to Virtuemart> Configuration> Checkout and set the flag "Only registered users can checkout".
Setting pages
After installing the Virtuemart plugin, we have the opportunity to use specialized pages in the menu. In order to make a showcase from the main page, go to Menus> Manage and edit the menu with the home alias. We need to change the Menu Item Type to one of the types provided by Virtuemart:
- Account Maintenance
- Category Layout
- Displays vendor contact
- Displays vendor details
- Displays vendors
- Front page
- List Orders
- Manufacturer Default Layout
- Manufacturer Details Layout
- Product Details Layout
- Shopping cart
- User Edit Address
- View vendor TOS
We chose Category Layout and standard Joomla design (version 3.5) and, after adding the main
VPS configurations, the main page looks like this:

Processing paid orders
So, we have the same tasks:
- initiate server creation using the RuVDS Whitelabel API and provide the client with all the necessary information about the creation process (server ID, creation phase, creation progress, server configuration)
- after creating the server, provide the necessary data for the connection, as well as the server management capabilities and information about the end date of the calculation period
What is available for integration
- automatically generated API documentation for Virtuemart 2 (in the article we are reviewing version 3)
- api2cart service - unified API for online stores (from $ 500 per month)
- free component SOAP-services for Virtuemart 3 (a somewhat reduced version, but its functionality is quite enough for our tasks)
Let's stop on the last version. After installing this plugin, the following SOAP services are available:
- VM_Categories
- VM_Order
- VM_Product
- VM_SQLQueries
- VM_Users
- VM_Upload
Their wsdl are available by url (an example for a service that manages product categories):
http: // host / administrator / components / com_vm_soa / services /VM_CategoriesWSDL.php
We will need 3 - VM_Order, VM_Product and VM_SQLQueries.
Unfortunately, when using this integration method, the hooks mechanism is not available to us. Therefore, we will periodically select orders with the appropriate status and initiate the creation of servers of the desired configuration.
Let's write a simple script in PHP, which will create the server after paying for the order:
<?php function getApplicationSettings() { return [ 'login' =>'admin', 'password'=>'admin', 'orderServiceWsdl'=>'http://localhost/administrator/components/com_vm_soa/services/VM_OrderWSDL.php', 'productServiceWsdl' =>'http://localhost/administrator/components/com_vm_soa/services/VM_ProductWSDL.php' ]; } function getCompleteOrders($limitStart = 0, $limitEnd=1000) { $applicationSettings = getApplicationSettings(); $loginInfo = new stdClass; $loginInfo->login=$applicationSettings['login']; $loginInfo->password=$applicationSettings['password']; $loginInfo->isEncrypted="Y"; $loginInfo->lang=null; $orderServiceClient = new SoapClient($applicationSettings['orderServiceWsdl']); $getOrderFromStatusRequest = new stdClass; $getOrderFromStatusRequest->limite_start = $limitStart; $getOrderFromStatusRequest->limite_end = $limitEnd; $getOrderFromStatusRequest->status = 'F';
Next, using any task scheduler, for example, cron, we set up the launch of this script with the necessary periodicity.
Results
In general, a bunch of Joomla 3 + Virtuemart 3 looks like a fairly functional and powerful tool as a basis for organizing your VPS hosting. Immediately "out of the box" is available a lot of settings of everything that you can imagine. But is it required when reselling, say, 3-10 popular configurations of
virtual servers ?
In the next article, we will look at CMS Drupal and one of its most popular eCommerce extensions, and perhaps the new CMS is more suitable for you for this task. See you again!