Page tree
Skip to end of metadata
Go to start of metadata

Use this guide in case you store up-to-date orders data in Magento.

Configuring integration in Magento

Server-side modification

1. Download the archive and then copy the files to the corresponding folders on the server where Magento is installed.

2. In your store database you should create the roistat_integration table. To do this, execute the following request:

CREATE TABLE IF NOT EXISTS `roistat_integration` (
  `username` varchar(255) NOT NULL,
  `passwd` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)

3. In the sales_flat_order table you should create the roistat_visit field. To do this, execute the following request:

ALTER TABLE `sales_flat_order` ADD `roistat_visit` VARCHAR( 255 ) CHARACTER SET ucs2 COLLATE ucs2_general_ci NULL DEFAULT NULL COMMENT 'Roistat Visit'

4. In the app/design/adminhtml/default/default/template/sales/order/view/info.phtml file find the following code snippet (the 90th line or so):

<?php if($_order->getGlobalCurrencyCode() != $_order->getBaseCurrencyCode()): ?>
	<td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getGlobalCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
	<td class="value"><strong><?php echo $_order->getBaseToGlobalRate() ?></strong></td>
<?php endif; ?>
<?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?>
	<td class="label"><label><?php echo Mage::helper('sales')->__('%s / %s rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></label></td>
	<td class="value"><strong><?php echo $_order->getBaseToOrderRate() ?></strong></td>
<?php endif; ?>

Insert the following code snippet immediately after this line and before the </table> tag:

<!-- ROIstat -->
	<td class="label"><label>ROIstat ID:</label></td>
        <td class="value">
			#roistat-status {
				display: none;
			#roistat-status.saved {
				display: block;
				color: green;
		<input id="roistat-promocode" type="text" value="<?php echo $_order->getRoistatVisit(); ?>">
		<input id="roistat-submit" type="submit" value="Save" style="font-size: 12px;"> <span id="roistat-status">Saved</span>
		<script type="text/javascript">
			$('roistat-submit').observe('click', respondToClick);
			function respondToClick(event) {
			var param = $F('roistat-promocode');
			new Ajax.Request('<?php echo $this->getUrl('admin_export/adminhtml_exportbackend/update/'); ?>?order_id=<?php echo $_order->getId(); ?>&roistat=' + param, {
			    onSuccess: function(response) {
<!-- END ROIstat -->

Save the file.

Complete the setup via the admin panel

5. In the admin panel navigate to System Configuration Design Footer Miscellaneous HTML and set up the Roistat tracking code that you can copy from Roistat Settings  Tracking Code:


6. Navigate to Roistat Settings and set up your username and password.


The username and password should be unique and shouldn't coincide with your administrator login details or any other. It is crucial for protecting your orders data from being lost or corrupted.

Configuring integration in Roistat

Configure Roistat access to Opencart

7. Open SettingsIntegrations and choose Magento from the Available integrations drop-down menu.

8. The integration settings page will then open.

Enter the URL of your website into the corresponding field, e.g. http://mysite.com .

Enter the same username and password that you created in paragraph 6.

Click Save to apply the changes.

Once you have specified all the information needed and saved it by clicking Save, Magento deal statuses will be imported to Roistat.

Arrange statuses

Once Magento has integrated with Roistat, you'll need to arrange the statuses uploaded:

  • Not registered: waste leads or duplicate deals. Do not delete such deals to provide reliable statistics. You can gather them all in one status, e.g. Waste.

  • Processing: deals being in process, not completed, e.g. negotiations or product packaging.

  • Paid: deals that are paid or very likely to be paid.

  • Rejected: when a client rejects the purchase or requests a refund.

Just drag and drop a status to the box you wish.

Roistat will track your achievements (the Paid group) and forecast possible achievements (the Processing and Paid statuses) basing on the grouping principle.

  • No labels