Installing on Opencart 1.5.6

To install the Followprice button on your Opencart 1.5.6 site you will need to copy two blocks of code.

First Step: Copy the following code to the file “catalog/controller/product/product.php” on your site’s directory.
/* Followprice start */
$this->data['fp_title'] = $product_info['name'];
$this->data['fp_quantity'] = $product_info['quantity'];
$this->data['fp_availability'] = '1';
} else {
$this->data['fp_availability'] = '0';
$this->data['fp_href'] = $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id']);
$this->data['fp_price'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')), '', '', false);
} else {
$this->data['fp_price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')), '', '', false);
$this->data['fp_currency'] = $this->session->data['currency'];
/* Followprice end */

This code must be placed on the index function, after the variables $product_info and $url are the declared. If you never changed this file before, you can paste the code after the line 232, or as an alternative after the line with the code “$data['heading_title'] = $product_info['name'];

Second step: Copy the following code to the file “catalog/view/theme/theme_name/template/product/product.tpl” on your site’s directory. “theme_name” must be the name of the theme you’re using. Usually the name is “default”.
<!-- Followprice start -->
<div class="fp-button"
data-product-title="<?php echo $fp_title; ?>"
data-product-id="<?php echo $product_id; ?>"
data-product-url="<?php echo $fp_href; ?>"
data-product-image="<?php echo $popup; ?>"
data-product-price="<?php echo $fp_price; ?>"
data-product-currency="<?php echo $fp_currency; ?>"
data-product-availability="<?php echo $fp_availability; ?>"
data-product-stock="<?php echo $fp_quantity; ?>"
data-product-manufacture="<?php echo $manufacturer; ?>">
<script>(function() { var _f = document.createElement("script");_f.type = "text/javascript"; _f.async = true; _f.src =""; var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(_f, s);})();</script>
<!-- Followprice end -->
You should place this code where you wish your button to be displayed. Usually stores like to position the button after the product’s price or after the “add to cart” button.

Third Step: Insert store key.

After copying both blocks of code you just need to replace your_store_key with your real store key on the second code block. You can find your store key on the “Tools>Button” menu on your Followprice account.

Your Followprice button should be now up and running! Simple right?

Feedback and Knowledge Base