Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:50:48+00:00 2026-06-13T07:50:48+00:00

We are in the process of creating a specialty cart where our when a

  • 0

We are in the process of creating a specialty cart where our when a client makes a purchase it logs the Affiliate id in the database at time of purchase. I have created the following code to get the affiliate id/name using the Post Affiliate Pro API.

include ("affiliate/api/PapApi.class.php");
$session = new Gpf_Api_Session("https://www.elitespecialtymeats.com/affiliate/scripts/server.php"); 
if(!$session->login("user", "password")){ die("Cannot login. Message: ".$session->getMessage()); }
$clickTracker = new Pap_Api_ClickTracker($session);
try {
    $clickTracker->track();
    $clickTracker->saveCookies();
    if ($clickTracker->getAffiliate() != null){ $affid=$clickTracker->getAffiliate()->getValue('username'); }
    else{ $affid=''; }
}catch (Exception $e){
    $affid='';
}

I am trying to figure out the best way of adding that id into the purchase. I think it may be best to add it in tpl_checkout_success_default.php where they log the purchase into PAP. My issue is that I dont know enough about the system to implement the code.

My best guess is

 $db->Execute("UPDATE ".TABLE_ORDERS_TOTAL." SET affid='$affid' where orders_id = '".(int)$orders->fields['orders_id']."' AND class in ('ot_coupon', 'ot_gv', 'ot_subtotal', 'ot_group_pricing', 'ot_quantity_discount')");

Will this work or will i mess something up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:50:49+00:00Added an answer on June 13, 2026 at 7:50 am

    First of all, using the API you are loading affiliate username ( …getValue(‘username’) ), not affiliate ID as you stated in the first paragraph. You should use getValue(‘userid’); (for affiliate ID) or getValue(‘refid’); (for referral ID).

    The database command you are trying to use will only work in case the the table TABLE_ORDERS_TOTAL has a column called ‘affid’. You can add it manually to the table…

    I am wondering why are you doing something like this… It seems like you want to use the ID for some special purpose later. Do you want to give a commission to the original referring person even the customer removed all the cookies or clicked another affiliate’s banner meanwhile? If so, you should use Lifetime commissions instead:
    http://support.qualityunit.com/541587-Lifetime-commissions

    In case you need any other help, feel free to contact our online support.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in the process of creating a double-linked list, and have overloaded the operator=
I'm in the process of creating an app. I'd like to have a pared
I'm in the process of creating database scripts for an existing database. I'm trying
I have a C process creating several pThreads. To sleep and wake the threads
I am in process of creating my first app and have some confusion over
I'm in the process of creating my own framework and have been looking at
i am in process of creating a image catlogue for a client, i was
I'm in the process of creating an android app that makes extensive use of
I'm in the process of creating a client for a web service. I keep
I'm in the process of creating a game, and up until now, I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.