The Drupal module Ubercart Affiliate v2 allows an e-commerce site based on Ubercart to track product sales that were generated thanks to affiliates, and calculate commissions earned by the affiliates on those sales.
Setting up Affiliates on an e-commerce site
Create a role to manage the users that would be the affiliates for the e-commerce site. Navigate to Administration » People » Permissions » Roles or follow the link /admin/people/permissions/roles. Add a role named 'affiliate'.
Grant permission to this role to Act as an Affiliate for the module Ubercart Affiliate v2. Navigate to Administration » People » Permissions » Permissions or follow the link /admin/people/permissions. For the other two actions Adjust User Commissions and Administer Affiliates, choose an appropriate role, like Administrator.
At this point, the e-commerce site administrator can invite each affiliate to register with the Drupal website, or create the users himself. Navigate to Administration » People » Add User or follow the link /admin/people/create. Check the affiliate role checkbox.
Edit the user just created and assign a sales commission percentage.
Setting up a downline of Affiliates
The module Ubercart Affiliate v2 supports setting up a hierarchy of affiliates. An affiliate who recruits others to the e-commerce site can create a downline, and earn commission based on sales generated by the downline of affiliates. Navigate to Administration » People » List » Edit User » Affiliate Center » Downline or follow the link /user/userid/affiliate/downline.