Opencart Marketplace In Version 3

Opencart Marketplace In Version 3

Today we will see about Opencart Marketplace at admin panel in Opencart Version 3. Opencart added the Marketplace which are useful for the store admin for searching, installing, downloading, commenting  and filter the Opencart extensions from admin panel instead of visiting their official sites.

Work-Flow:

Opencart added the marketplace directory to the admin/controller. Their are marketplace.php which gets the information about the extensions from Opencart official site through the curl in JSON Format.

Opencart Marketplace Api, validate the store domain to access the full feature of Marketplace API. Opencart uses the HMAC signature validator process for validating the store. Opencart creates the query string for signature through API Name string, Opencart User Name, Host Name, Version, Current Timestamps . It generates the signature through the Opencart Secret Key.

//Generating Query String for signature
$string  = 'marketplace/api/list' . "\n";
$string .= $this->config->get('opencart_username') . "\n";
$string .= $this->request->server['HTTP_HOST'] . "\n";
$string .= VERSION . "\n";
$string .= $time . "\n";

//Generating Signature through Hmac using Opencart Secret Key
$signature = base64_encode(hash_hmac('sha1', $string, $this->config->get('opencart_secret'), 1));

After generating the signature it creates the url from username,domain,version,time,signature and other filters of extension such as filter category, filter license, page etc. and after then it sends the curl request to the Marketplace API of Opencart Official site and get the corresponding information about the extension.

$curl = curl_init(OPENCART_SERVER . 'index.php?route=marketplace/api' . $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FORBID_REUSE, 1);
curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($curl, CURLOPT_POST, 1);

Opencart secret key can be generated from the Opencart Official site by registering the store by clicking on You Stores under the Purchase section and configured it at your own store for get more feature access of the Opencart Marketplace API.

 

After that store admin can configure them and can access the Marketplace Api from the admin panel.