PDA

View Full Version : Post Back Variables


dingle
21st August 2004, 08:16 PM
Hi Mark..

I use a different processor to the ones mentioned in your script and I currently utilize their post-back option.. I'm going to try to write this myself.. is there a list of variables the script requires on sales and where I can post it (script or db) to?

mark
23rd August 2004, 10:51 PM
Hello,

if you look at /scripts/worldpay.php, it is example of quite simple callback script.

The only real thing you should call to regiser sale is:

$saleReg = new SaleRegistrator();

if($saleReg->decodeData($CookieValue))
$saleReg->registerSale($TotalCost, $OrderID, $ProductID);


The first function wil decode the data (it must be in cookie value format, affiliate id separated by underquote with campaign id, for example 2_1)

If it is succesfull, call register sale, with parameters $TotalCost, $OrderID, $ProductID.
OrderID and ProductID are nor required, you can put '' there instead.
TotalCost is required for percentage comission.

I think the best approach is to start with worldpay.php script and customize it to your payment processor.
Btw. which processor do you use?

regards,

mark

dingle
23rd August 2004, 11:27 PM
Hello,

if you look at /scripts/worldpay.php, it is example of quite simple callback script.

The only real thing you should call to regiser sale is:

$saleReg = new SaleRegistrator();

if($saleReg->decodeData($CookieValue))
$saleReg->registerSale($TotalCost, $OrderID, $ProductID);


The first function wil decode the data (it must be in cookie value format, affiliate id separated by underquote with campaign id, for example 2_1)

If it is succesfull, call register sale, with parameters $TotalCost, $OrderID, $ProductID.
OrderID and ProductID are nor required, you can put '' there instead.
TotalCost is required for percentage comission.

I think the best approach is to start with worldpay.php script and customize it to your payment processor.
Btw. which processor do you use?

regards,

mark

Thanks... I'll give it a whirl!

.. paycom ;)

dingle
3rd September 2004, 08:31 AM
ok .. everything seems in order, however i constantly get this error and the sale does not register in pa_transacitons (asusming because of this error notice)

"Sale registration: Campaign category is not sale"

-- the entire debug for the sale is:

callback: Start registering sale, params TotalCost='22.50', OrderID='null', ProductID='3' 208.236.105.50 paycom.php 64
64 2004-09-03 16:29:03 notice Sale registration: After setting language file 208.236.105.50 SaleRegistrator.class.php 93
65 2004-09-03 16:29:03 notice Sale registration: After lookup for product category 208.236.105.50 SaleRegistrator.class.php 111
66 2004-09-03 16:29:03 notice Sale registration: After fraud protection 208.236.105.50 SaleRegistrator.class.php 118
67 2004-09-03 16:29:03 notice Sale registration: Campaign category is not sale 208.236.105.50 SaleRegistrator.class.php 124
68 2004-09-03 16:29:03 notice Paycom callback: End registering sale


And the sale does not go into the DB..

Any ideas?

mark
3rd September 2004, 09:31 AM
Hello,

the error message 'Campaign category is not sale' means that the product category (campaign) that was found for this sale has only per click commissions, not per sale.
Check if you have some per sale product category defined.

It can also mean that visitor clicked on per click banner before, and its campaign was registered.

You can turn on 'Force choosing commission by product ID' setting, then system will apply commission depending on Product ID passed.
Check more about this in the FAQ:
http://www.webradev.com/?p=Faq#PAPForceProductComm

regards,

mark

dingle
3rd September 2004, 02:34 PM
I already have 'Force choosing commission by product ID' set to YES.

I am hardcoding variables for postback testing, so there should be no cookie issues.

Thing that boggles me is I have everything set to per sale, no clicks or commissions anywhere..

mark
4th September 2004, 11:24 AM
Maybe there is something wrong in your postback script, can you send it to me?
You can remove all sensitive parts, I'm interested only in how you call the functions of affiliate systems.

When the system finds product category for given product ID, it will put this message to the log:
Commission from new product category applied (according to Product ID '$ProductID')

it was not there, so the system was not able to find the given ProductID.

I managed to simulate this error, and it happened when I removed call to decodeData(...) and set AffiliateID manually in the postback script. Did you do the same?

regards,

mark

dingle
9th September 2004, 02:51 PM
it was not there, so the system was not able to find the given ProductID.

I managed to simulate this error, and it happened when I removed call to decodeData(...) and set AffiliateID manually in the postback script. Did you do the same?

regards,

mark

Yes.. exactly that!

mark
9th September 2004, 08:35 PM
So have you corrected it already?

mark

dingle
16th September 2004, 01:08 AM
So have you corrected it already?

mark

Surely have not got it working yet

My host (theplanet) screwed me over so I've been down while in a legal battle with them etc etc..

Anyway..
What you explain is what I did to get the error (removing decodedata..() and setting the affiliate ID manually in the same file.

mark
17th September 2004, 08:46 AM
Hello,

you should not remove the decodedata() function. If you want to pass affiliate id by yourself, you should do it by putting those data to the variable given to this function.
For example:

$saleReg->decodeData($custom);


where $custom has to contain Affiliate id and Product category id separated by underscore, for example '2_1'.
So you need to know also product category not only affiliate id when saving the sale.

This is how it works also in PayPal or WorldPay callbacks.
If you need somemore help with this let me know.

regards,

mark

dingle
21st September 2004, 06:59 AM
That's exactly how I did it, only because I can't get the cookie to work.

I am setting all the affiliate ID & product ID manually which is what leads me to the errors described at first.



$x_bid = "1_3";
$ABid = $x_abid;
$CookieValue = "1_3";
$cookieval = "1_3";


$totalcost, $orderid and $productid are all also set maually for testing purposes...

Any clue? :)

mark
21st September 2004, 10:54 PM
well, I don't know how you use the hardcoded value later. Can you send me your code?

Also, if you turn on Debug transactions, it can give you hints on what is wrong. There will be some error message, if it fails to register sale.

If you'll give me access to your site, I can look at it.

with regards,

Mark

dingle
24th September 2004, 07:39 PM
ok... I've been sifting through code trying to figure this out.

I can't for the life of me get the cookie to work, so I'm piosting everything manually, and it seems to work fine.

The ONLY error I'm getting now is in the debug messages:

Sale registration: Campaign category is not sale

I'm 95% sure the products are setup right...

anything off the top of your head that might cause this?
every variable is being passed 100% fine

dingle
25th September 2004, 02:56 PM
^^^^^^ In reply to my own post, I fixed it, after re-enabling a few things and deleting some code from the postback file... mainly my own fault :)


But this does bring me to a new problem, which I havn't touched, and may even be a bug...

When I create a new catergory/site.. infact lets say I create 2 or 3 new ones..

When I log in as an afffiliate to grab the linking code, the code does NOT correspond to the ID's in the merchant area.

Let me explain.

In the merchant area
---------

site1.com, has the ID of '2'
the affiliate's ID is '1'


Now... in the affiliate area..

the site (a_aid) is '3'

and the affilaite ID (a_bid) is '1' (normal)



I tried adding, deleteing new sites but this did not fix the problem.
I am using the short code join links, www.site.com/?a_aid=1 etc..


Is this normal? Was there something I missed or did not enable?

mark
25th September 2004, 09:40 PM
Hello,

you are mistaken, a_aid parameter is affiliate id. a_bid is id of banner - and from this we can get id of product category.

So I think everything is working fine, or have you encountered any error with this?

regards,

mark

dingle
26th September 2004, 09:52 AM
Hello,

you are mistaken, a_aid parameter is affiliate id. a_bid is id of banner - and from this we can get id of product category.

So I think everything is working fine, or have you encountered any error with this?

regards,

mark

Yes, my mistake.. sorry.. fixed that up and did a few more tests.

All come back with;

"Sale registration: Campaign with ID '4' doesn't exist "


I set the links up as TEXT links, and the ID 4 does exist, at least according to the affiliate link area..

mark
26th September 2004, 01:35 PM
Hello,

the error was maybe caused if you put banner id instead of campaign id to the cookie value .
Cookie value consists of affiliate id and product category (= campaign) id.

Check if you have product category with id 4 in your system.

with regards,

mark

26th September 2004, 10:27 PM
Hello,

the error was maybe caused if you put banner id instead of campaign id to the cookie value .
Cookie value consists of affiliate id and product category (= campaign) id.

Check if you have product category with id 4 in your system.

with regards,

mark

I'm just going by what the affiliate area spits out as linking code.

It's creating new banner ID's instead of campain Id's i guess?

I don't really need any campain or bannerID's at all, and I "fixed" this problem by manually forcing a_bid = "2" on the front of each site.

I chose "2" because it's the only a_bid value that seems to work, and it won't let me have nothing there...

Perhaps there is some problem in the affiliate linking option with text links?

Do impressions have anything to do with this?

mark
26th September 2004, 11:30 PM
Hello,

affiliate area displays banner id, but when you click on banner it saves product category id of actual banner to the cookie.
So when you simulate passing cookie data you should also put product category id, not banner id.

regards,

mark

dingle
28th September 2004, 04:54 AM
I can't get the cookie to work AT ALL... I've tried reinstalling, disabling and re-enabling different things..

since first installing the software ive migrated to a newly formatted pc, and even tried on win2k... I can't see it being my pc/s.. is there something in the script that may disable cookies? An option?

What I've done is pass through the a_bid through every page, which is a hastle, but works.. the a_bid is set to the catergory ID of the site its promoting, so it never changes on 1 particular site and can be re-set, statically on site2 etc...

I hope this thread helps anyone else that had similar problems.. :)

dingle
3rd October 2004, 09:47 PM
mark, is there a way to manually set the campain ID?

I've got everything working extreemely well (and a bunch of affiliates sending traffic), apart from a few minor bugs everything is running smoothly.

Since I am not taking advantage of cookies, and setting the a_bid varible myself before the join/success pages, the campain ID is screwing with sales. Is there some way I can override checking for campain ID? Or a number i can set it to so that a sale will always go through perfectly without an error occuring (in history) ? The error it is giving is the campain does not exist.

Also, i've made a short list of things that dont work 100%

I've got 50 affiliates sending around 5,000 clicks/day for testing this and things have come up that are odd (script wise)

let me know.. id be glad to help wherever i can! ;)

mark
6th October 2004, 09:42 AM
Hello,

you can hardcode the campaign id in the /scripts/SaleRegistrator.class.php
script.
Find the line

$campaignID = $arr[1];


and replace it with

$campaignID = 12;


where 12 is example of your campaign ID. You have to be sure that this campaign exists.

Regarding the bugs and fixes, can you send them to me (via email)?
I'll look at it, and correct it in the new version.
Also, if you have any ideas of new features and improvements, send them as well.

with regards,

mark

dingle
7th October 2004, 11:20 AM
Good news: I finally got the cookie to work.. :)
It was the multiple domains issue... bit with a twist...

I thought to myself... how can a postback script get the cookie from my computer? It cant! The data is being passed straight from the processor to the postback script, which totally skips out my pc..

I ended up getting it to work by using the <img sale registration technique after figuring out how to use a returnurl varible with my processor.

I did however find little security on the image technique.. multiple sales were not hard to fake. Had to add some required varibles in to "toughen it up" on my end for now..

Not sure if there is a way around the postback coming from a 3rd party domain with cookies on multiple domains...