close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Referral system

Thread began 11/08/2011 11:19 am by wbrooks199805 | Last modified 3/19/2012 12:46 pm by Awemaker | 3163 views | 6 replies |

wbrooks199805

Referral system

Hi, Trying to add a referral system on the site. It needs to be put on the success page.

Do I put the code below on the checkout success page or the cart_readonly.php page? I see that the read only cart is called in and has the WA store cart values. Do I use them?

<img src="http://myclient.zferral.com/e/1?rev=$rev&customerId=$customerId&uniqueId=$uniqueId&coupon=$coupon" style="border: none; display: none" alt=""/>

These are the values.

$rev (required) &#8211; Total value of the transaction
$customerId (required) &#8211; ID of customer who completed the event
$uniqueId (optional) &#8211; A unique ID (i.e. order id, payment id or something similar). HIGHLY Recommended for security
$info (optional) &#8211; Additional information about the order (it is only visible in your dashboard, near the recorded commissions)
$coupon (optional) &#8211; Affiliate coupon

Sign in to reply to this post

Jason ByrnesWebAssist

use the cart_readonly.php page.


you can use the cart Grand Total binding fro the $rev, the customer ID should be store in the UserID session variable, the order ID will be stored in the OrderID session, looks like the info ond coupon values are up to you.

Sign in to reply to this post

Awemaker

Integrating JAM by JROX into PS 4.51

I'm trying to integrate JAM by JROX, arguably the most popular affiliate software out there.

Now, I'm a total PHP noob (but that's why I've spent $1700+ on WebAssist products), and I've read the above.

The attached screenshot is the JAM code generator, and it only wants 2 variables: the Sale Amount Variable and the Transaction ID Variable.

I'd rather the Sale Amount Variable be after the discount's applied, but before the sales tax & the shipping are added. I see a nice sub-total on the cart_readonly.php, but I don't think it's a variable. If I could make one there, what would the (very simple) code be?

I know to put the code that it outputs onto the cart_readonly.php page, but I ask you for exactly the right strings to put in the boxes, in quotes which I'll not include.

Lastly, I don't see a reference to the "Transaction ID Variable" on this page. What to use? I'd want Order ID, but that's a database entry, is it not?

I know this is rather simple stuff- 2 variables and perhaps 2 lines of code, but it is beyond me. Can we solve this once for the masses? (And me, of course!)

Thanks in advance for all you do!

Sign in to reply to this post

Jason ByrnesWebAssist

the order id is stored in a session, the code for the order ID session is:

php:
$_SESSION['OrderID']




the code for the subtotal is after discounts would be:

php:
$WA_Store_Cart->TotalColumn("TotalPrice")-$WA_Store_Cart->GetDiscounts()
Sign in to reply to this post

Awemaker

Working with your response--

Thank you, sir.

So, please check me here-- as I say, total noob at PHP:

If I include a line like this in the cart_readonly.php that takes what you gave me and rolls it into 2 unique variables (I used my initials to make them so, as I don't know the variable set):

<?php
$EPCtrans_id=$_SESSION['OrderID'];
$EPCamount=$WA_Store_Cart->TotalColumn("TotalPrice")-$WA_Store_Cart->GetDiscounts();
?>

Then pop $EPCtrans_id and $EPCamount into my JAM code-making thing to get this and put it after the above line:

$JAMIntegrate = file_get_contents("http://mydomain.com/affiliate_directory/sale.php?amount=".$EPCamount."&trans_id=".$EPCtrans_id."&custom_mid=".$_COOKIE['jrox']."");

I should be good to go (assuming that JAM works)? That's question #1.

Question #2: Could I have put the 2 things you gave me *directly* into the JAM code-making thing?

Question #3 (the really important one): Please confirm: nothing in the store could run the cart_readonly.php page at some later date and give the commission again? What if they hit "refresh"? (Please, just answer for the WebAssist side of things, as I doubt you know JAM.)

Thanks very much for running this by the Mega-Mind!

Sign in to reply to this post

Jason ByrnesWebAssist

I've never worked with JAM so I can really give definitive answers for 1 and 2.

1) That looks correct.

2) I dont see why not

3) to ensure that the code only runs when the checkout has processed, i'd probably add the code to the webassist/plugins/shopping_cart/store_cart.php file, just before this code block:

php:
<?php

// WA eCart Redirect
if ($WA_Store_Cart->redirStr != "")     {
  
header("Location: ".$WA_Store_Cart->redirStr);
}
?>
Sign in to reply to this post

Awemaker

Final Solution for JAM in PowerStore 4.51

OK, this was hellish for me because I was a PHP noob. (Note the past tense.)

What I finally did is steeped in a healthy dose of PHP superstition, but it works.

Nothing I did worked on the JAM PHP integration, and I still don't know why, and maybe I never will. I ended up going with the image tag implementation, but that was meant for an HTML page, not a PHP page, but I adjusted it to work on a PHP page.

First, I found that JAM has good code to avoid duplicate commissions, so putting the image tag on the checkout_success.php page is just fine.

I did set the necessary variables as my own session variables over in the /webassist/plugins/shopping_cart/cart_readonly.php page, and there I did the math that Jason provided. I put this right before the final <script> tag:

<?php
// Affiliate Code Math Here
$_SESSION['EPCtrans_id']=$_SESSION['OrderID'];
$_SESSION['EPCamount']=$WA_Store_Cart->TotalColumn("TotalPrice")-$WA_Store_Cart->GetDiscounts();
?>

(My initials are EPC.)

Then, on the checkout_success.php, I put this code right after this line:

</h1>
<div class="contentBox ps_pod1 borderColor">

(this is the inserted code now):

<?php
$FINALtrans_id=$_SESSION['EPCtrans_id'];
$FINALamount=$_SESSION['EPCamount'];
?>

<?php
echo ('<img border="0" src="https://mydomain.com/affiliate_folder/sale.php?amount='.$FINALamount.'&trans_id='.$FINALtrans_id.'" width="1" height="1">')
?>

As I said, superstitious, but this went on for 4 days for me. Then I learned about escaping the quotes. I could have just written--

<?php
echo ('<img border="0" src="https://mydomain.com/affiliate_folder/sale.php?amount='.$_SESSION['EPCamount'].'&trans_id='.$_SESSION['EPCtrans_id'].'" width="1" height="1">')
?>

-- and done it in one line. Maybe I could have done the "math" here as well (probably), but I went through a bit of hell with this, so I hope it helps you if you need it. It works!

Also, note the "https://" action. My PowerStore is secure, but if your's isn't, drop the "s" and make it "http://". Good luck!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...