1 - Install API module

Yourviews requires a continuous integration of orders in the store. Unfortunately, howerver, Opencart does not offer a default order integration, being required do install some API module. The module is attached to this document.

IMPORTANT: This plugin should be used in Opencart stores version 1.5.x

a - Using some FTP program, access the root folder of your Opencart installation;

b - Upload folders "catalog" and "admin". They are inside the zip fille attached to this guide.

c - Make a backup of the file: \catalog\model\account\order.php

d - Download the \catalog\model\account\order.php file and, before de last tag add the following:

public function getAllOrders($start = 0, $limit = 20) {
 if ($start < 0) {
  $start = 0;
 if ($limit < 1) {
  $limit = 1;
 $query = $this->db->query("SELECT o.order_id, o.firstname, o.lastname, os.name as status, o.date_added, o.total, o.currency_code, o.currency_value FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id) WHERE o.order_status_id > '0' AND os.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.order_id DESC LIMIT " . (int)$start . "," . (int)$limit);

 return $query->rows;

IMPORTANT: If you received any errors, restore the backup. If you have any questions, please ask help for your technical support.

e - Go to your Opencart admin panel and access Extensions > Product Feeds

f - In "Rest API", click "Edit"

g - In "Status" check "Enabled"

h -  In "Secret Key" type any password. It should be informed to Yourviews.

After enabling the API, give the Secret Key created during the install to Yourviews so we can add it to our integration.

2 - Install the Javacript in the footer of all pages of the store

Yourviews script works in similar way of other famous scripts, such as Facebook. All you have to do is to place the following code in the footer of all pages (usually editing the file /catalog/view/theme/your_theme/template/commom/footer.tpl)

<script type="text/javascript">
    (function () {
        var yvs = document.createElement("script");
        yvs.type = "text/javascript";
        yvs.async = true;
        yvs.id = "_yvsrc";
        yvs.src = "//service.yourviews.com.br/script/CODIGO_DA_LOJA/yvapi.js";
        var yvs_script = document.getElementsByTagName("script")[0];
        yvs_script.parentNode.insertBefore(yvs, yvs_script);

IMPORTANT: Replace "CODIGO_DA_LOJA" by the code that can be found in https://service.yourviews.com.br/admin/store/key

3 - Create a page (optional, but recommended)

Create  a new page using the CMS. It will be used to fill the review form. It's optional but this can help bringing more users back to your site, increasing the repurchase rate.

Follow these steps:

a) In Admin Panel, go to Catalog > Information;

b) In the page list, click "Insert";

c) Fill the the form:

1 - Information title: Avaliações

2 - Description:  Click in "Source-Code" and paste the following code:

<div id="yv-show-form" style="min-height:300px; background-image:url(https://service.yourviews.com.br/static/images/loading.gif);background-repeat:no-repeat">
<br/><br/>Por favor aguarde...
<div class="clear"></div>   

3 - Click Save