Magento Module: Refer a Friend

A custom refer-a-friend module with unique customization options.


This module was developed as a replacement for an existing referral program extension that was not compatible with custom order processing workflows of the target Magento instance. The features of this module did not aim to provide advanced rulesets like other well known extensions, but instead focused on using better event-based actions to manage referral credits, and providing better frontend content controls.


Configuring the integration

Viewing referral statistics

Managing existing transactions

Editing an existing open transaction

Viewing an existing closed transaction

Assigning a customer to a new transaction

Customer referral credit dashboard

Technical Features

Code Sample

protected function _processRelatedTransaction(Groove_ReferAFriend_Model_Account $account, Mage_Sales_Model_Order $order)
    $helper = Mage::helper('referafriend');

    if ( $order->getBaseGrandTotal() < $helper->getReferralOrderMinimum() ) {

    $transactions = Mage::getResourceModel('referafriend/transaction_collection')
        ->addFieldToFilter('referral_id', $account->getId());

    foreach ($transactions as $transaction) {
        $transaction->setState(Groove_ReferAFriend_Model_Transaction::STATE_OPEN) // Unlock without save
            ->setLinkedDetail('order_id', $order->getIncrementId())
            ->close($helper->__('Credit applied for referral signup.'));

Static Analysis