PDA

View Full Version : Can't use cookies - any suggestions?


martindell
7th September 2004, 12:58 AM
We have a slightly weird sales situation that goes like this ...

customer signs up for a 30 day free trial (will be referred to the sign-up page via an affiliate)
At the end of the trial - he purchases (hopefully) and we process the payment manually (no on-line ordering)

Now the affiliate cookie will be on the customers machine but we'll be processing the sale from another machine (so we can't use the cookie)

We can log the affiliate ID to the customers account when they sign up and we can take a look at that field when we process payment -

so my question is (finally) - Instead of this code:

'/affiliate/scripts/sale.php?TotalCost=XXXXXX.XX&OrderID=XXXXXX&ProductID=XXXXXX'

on the sales page - is there something else I can use to pass the affiliate ID instead of looking for a cookie?

Thanks in advance. BTW - great script, installed first time, no hassle

mark
7th September 2004, 01:20 PM
Hi,

I think solution for you can be quite simple - when your customer signs up for a trial, you'll normally register a sale (using sale.php or PayPal IPN script or other way), but you set manual approval of sales.
When manual approval is set, the sale commission will be registered, but it will be in 'Waiting for approval' state.

After 30 days when customer purchases the product, you find this sale commission, and Approve it.
Othervise you Decline it.

You just have to set special OrderID for every sale so that you can track the sale with the customer.

Can it work like this?

regards,

mark

7th September 2004, 04:05 PM
Good idea but I don't think that would work because there are a number of different products that we sell after the 30 day trial period - so the order 'waiting for approval' would need to be altered every time.

Is there a variable format that we can pass to SaleRegistrator.class.php that will bypass the contents of the cookie and allow us to insert an affiliate id?

mark
7th September 2004, 08:45 PM
Hi,

there is a way to pass affiliate id to SaleRegistrator class.
You can see that in sale.php there are only those two important lines:

if($saleReg->decodeData($_COOKIE[COOKIE_NAME]))
$saleReg->registerSale($TotalCost, $OrderID, $ProductID);

First line will decode data from cookie, and second will register the sale.
It will not work if you call just registerSale(..) without decoding data!

You can replace $_COOKIE[COOKIE_NAME] with your own data, and it will work. The data in cookie are in format AffiliateID_ProductCategoryID, for example 2_1.
So only affiliate id is not enough, you should know also product category id. You can hardcode the ID if you'll have only one category.
Then the code could look like:

$data = $YourAffiliateID.'_1';
if($saleReg->decodeData($data))
$saleReg->registerSale($TotalCost, $OrderID, $ProductID);


If you want to dynamically pass the affiliate ID to sale.php script, you can create new version of the script, name it for example sale2.php, and add affiliate id parameter processing.

If you have any questions about this, let me know.

regards,

mark