Magento 1 Invitations v1.x Developer Guide & API Reference

In this developer documentation for the Magento Invitations Extension, you will find step-by-step instructions, sample code, and API references to fully customize your plugin.

The getUrlWithInviter function allows you to get a URL with an invite parameter.

Using a URL like this, you can be sure that the users who follow this link to access the site, will be recognized as your invitees by the system. In order to add the invite parameter to any URL, you should add the following data in the end of href parameter:

<?php echo '?inviter='.$this->helper('invitations')->getCurrentCustomerId() ?>

In order to get the URL with invite parameter, you should invoke

<?php $url = Mage::helper('invitations')
    ->getUrlWithInviter($route, $params, $customerId) ?>


The getUrlWithInviter method is similar to the Mage::getUrl method. The only difference is the third optional parameter $customerId; if it is not indicated, the current user ID will be used automatically.

Below you will find an example to be used in AddThis:

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style " addthis:url="<?php 
    echo Mage::helper('core/url')->getCurrentUrl()?>
    <?php if ($cId = $this->helper('invitations')->getCurrentCustomerId()) 
        echo '?inviter='.$cId ?>">
        <a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
        <a class="addthis_button_tweet"></a>
        <a class="addthis_button_pinterest_pinit"></a>
</div>
<script type="text/javascript" 
    src="//s7.addthis.com/js/30/addthis_widget.js#pubid=YOUR_PUBID"></script>
<!-- AddThis Button END -->


Below you will find an example how to create ?urrent url with invite parameter input:

<input name="current_url" value="<?php 
    echo Mage::helper('core/url')->getCurrentUrl()?>
    <?php if ($cId = $this->helper('invitations')->getCurrentCustomerId()) 
    echo '?inviter='.$cId ?>" />


Below you will find an example how to create custom url with invite parameter input:

<input name="custom_url" value="http://mydomain.com/<?php 
    if ($cId = $this->helper('invitations')->getCurrentCustomerId()) 
        echo '?inviter='.$cId ?>" />

Setting Redirect for Invitee from an Invite Email

Here’s the step by step instructions on how to redirect invitee to the needed page from invite email:

1. On your server, please copy the file:

/app/design/frontend/base/default/template/invitations/accept.phtml

into the folder with your theme:

/app/design/frontend/PACKAGE_NAME/THEME_NAME/template/invitations/accept.phtml

2. Within the copied file – please find the code:

window.location = '<?php echo $this->getUrl() ?>';

3. Replace the original code with this code:

window.location = 'http://yourstore.com/some-page.html';

where ‘yourstore.com/some-page.html’ is the page you want to redirect the invitee to.

API Reference

Some of the services require additional setup in order to import address books. Please click on the links below to setup your personal API for each service.

Was this article helpful?