Opencart (v2.3.0.2) Affiliate area not working. Unable to Register and has a lot of Redirects

Job ID: 33390850

Budget: $10 – $30 USD

We have a website at https://garrysun.com/ which uses Opencart 2.3.0.2. I currently am having various problems in our affiliates area. The first clue I had was that the Affiliates link in the footer (bottom right under Customer Service) wasn't working. It was just taking me to the regular login page instead of the Affiliate login page.
I added a hard coded affiliate link when I just put in the URL of the affiliate login. This is labled Affiliates. Then I have the Test Affiliate Link which is using the $affiliate variable which just takes me to the regular login.

1. The affiliate variable link in the footer is still broken. The one that says "Test Affiliate Link" is using the "$ affiliate" variable to generate that link but it goes to https://garrysun.com/account instead of the affiliate login https://garrysun.com/index.php?route=affiliate/login. Just so you know, the link in the footer that says "Affiliates" is hard coded with the link and not using a variable. You can find the template file here: /public_html/catalog/view/theme/benmart/template/common/footer/footer_center.tpl. You can see what I am talking about in the first part of my screencast in #2 below.

2. Everything seems to be redirecting or not showing as logged in. I can login to my affiliate account but check out all the funkyness that comes with it in this screencast: https://watch.screencastify.com/v/HdRmoWmfQOYkheuKqsgf (this also shows #1 above the funkiness starts at 1:19 mins)
a. If I login on the affiliate login page as an existing affiliate it does take me to https://garrysun.com/?route=affiliate/account but if I go to my account at the top right it shows I am not logged in.
i. I can go to the Tracking Code page and the Payment Options page but the other links don’t see to work.
b. Basically once I login as an affiliate any affiliate account link I go to (my account, affiliates in the footer, etc.) sends me to the customer login page. Once that happens the only way back to the affiliates area is the back button in the browser. In this video (https://watch.screencastify.com/v/01NrZKhiavV3b237R6q2) you can see that the affiliate link in the footer will now take me to the customer login instead of the affiliate login.

3. I am unable to register as an affiliate. I think this probably has something to do with everything that is going on above. Check out this screencast: https://watch.screencastify.com/v/ld0X1AaTPZloKLJi8xPs.
a. If I make a mistake it sends me to the customer registration page with the errors showing. If I register there it would make me a customer, not an affiliate.
b. If I go to the affiliate login and register for an affiliate account correctly, once I submit the application form it sends me to the “Order Complete” screen rather than a screen that says my affiliate application has been submitted and someone will approve it soon.

4. When I try to login as an affiliate, the account that I registered as won't work (they do need to be approved by admin but no affiliate account is created).
a. If I check the admin area it shows that the email I used to register as an affiliate is now as a retail customer rather than an affiliate.
b. The email I get when I register as an affiliate is a standard customer registration confirmation email rather than the affiliate registration/approval emails.
Related categories: PHP HTML Open Cart