Skip to Content Skip to Menu

[SOLVED] PAP integration long after first registration

  • activha
  • activha
  • OFFLINE
  • Posts: 2327
  • Thanks: 117
  • Karma: 13
11 years 9 months ago - 10 years 11 months ago #219626 by activha
We have a question with PAP integration.

It is working very well and we keep the PAP user id in a cb field for further checking and use.

However when someone is referred by PAP, then register to a plan and buy a new plan weeks after, we loose the relationship between the purchase and the affiliate.

I guess that the lifetime of the cookie may have something to do ?

Would it be possible to use the cb field with the PAP refid to pass it to the integration so that the purchase is correctly inputed to the affiliate ? and how ?
Last edit: 10 years 11 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
11 years 9 months ago #219650 by krileon
Replied by krileon on topic PAP integration long after first registration
Shouldn't matter, as soon as the basket is created we store the cookie value to the baskets parameters. Meaning they can come back a year later and as long as the basket still exists it'll still have the affiliate id.

My guess is the basket is being removed and creating a new one, which in that case the cookie is long gone (extending its lifetime probably won't help, but you should be able to configure this in PAP). So one option is to navigate to CBSubs > Settings > Display > Payment basket timeouts and adjust the timeout time in hours to be like 7 days or something so a basket will last a very long time until it times out or is manually cancelled.

Would it be possible to use the cb field with the PAP refid to pass it to the integration so that the purchase is correctly inputed to the affiliate ? and how ?

It has no such feature, but if you're using CBSubs 3.0 it's not encoded anymore and you can edit it to do whatever you want. You can probably also try using CB Auto Actions with a Code action to set a cookie for the user based off whatever field or value you like. It's looking for the cookie "PAPVisitorId".


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2327
  • Thanks: 117
  • Karma: 13
10 years 11 months ago #237119 by activha
Replied by activha on topic PAP integration long after first registration
Hi Kyle,

I am coming back on this subject.

Is it possible to pass a cb field to the integration ?

We would like to have for instance [cb_refid] in the integration Affiliate Id field, will it work ?

Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
10 years 11 months ago #237165 by krileon
Replied by krileon on topic PAP integration long after first registration
No, you would need to set the cookie your self in that case. You maybe able to do this with CB Auto Actions using the before registration trigger as I believe it fires before CBSubs starts its basket.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2327
  • Thanks: 117
  • Karma: 13
10 years 11 months ago #237213 by activha
Replied by activha on topic PAP integration long after first registration
Well we cannot overwrite the cookie in fact, as it is set up this way in PAP.

So we decided to modify the integration with a dedicated cb field this way :
Line 33

$my = JFactory::getUser();
if(!empty($my->id)){
$db = JFactory::getDBO();
$db->setQuery('SELECT * FROM #__comprofiler WHERE user_id = '.$my->id.' LIMIT 1');
$cbuser = $db->loadObject();
if(!empty($cb->cb_refid)) {
$affiliateID = $cb->cb_refid;
}
}
if(empty($affiliateID)) $affiliateID = stripslashes( cbGetParam( $_COOKIE, 'PAPVisitorId', null ) );

Is it ok ? will the user id fit ?

Thanks

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
10 years 11 months ago #237257 by krileon
Replied by krileon on topic PAP integration long after first registration
There's no need for that. You just need to set the PAPVisitorId cookie using a Code action in CB Auto Actions. The below should work.

Type: Code
Triggers: onBeforeUserRegistration
User: Automatic
Access: Everybody
Conditional 1: [cb_refid] Not Empty
Code:
Code:
cbimport( 'cb.session' ); CBCookie::setcookie( 'PAPVisitorId', '[cb_refid]' );

If you need this to apply to every purchase (now and in the future) then use the onCPayBeforeStorePaymentBasketUpdated trigger and set "User" to "User". This will cause it to establish the cookie before every basket.

If you still want to use a custom coded solution by modifying the plugin then the below should work.
Code:
$user = CBuser::getMyUserDataInstance() if ( $user->get( 'cb_refid' ) ) { $affiliateID = $user->get( 'cb_refid' ); } else { $affiliateID = stripslashes( cbGetParam( $_COOKIE, 'PAPVisitorId', null ) ); }


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum