[SOLVED] CB promotion code and integrations

8 years 1 month ago - 8 years 1 month ago #279317 by activha
Hello

We need to issue a new promotion coupon (30% discount) for an existing plan and for this special coupon we would like to remove PAP integration for the first year sale (so as not to pay the affiliate)

Is it possible to achieve with auto actions and promotions and how ?

Thanks

Please Log in to join the conversation.

8 years 1 month ago #279328 by krileon
Replied by krileon on topic CB promotion code and integrations
The CBSubs PostAfPro integration takes into account coupons so affiliates should only be paid for the discounted amount. I don't see a reason not to pay them as they gave you the traffic and ultimately the sale. Regardless I don't see a way to do what you're wanting without directly editing CBSubs PostAfPro. You could also log the commission in PostAfPro and just cancel it and not pay it out as well I suppose. That would at least allow you to track if a promotion came through an affiliate.


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 to join the conversation.

8 years 1 month ago #279329 by activha
Replied by activha on topic CB promotion code and integrations
This is a business and management decision to offer a coupon without commissions for a special affiliated company !
We need a way to do it.
Couldn't you only add a setting allowing to input affiliate id to avoid for commission computing ? that would be best to do it the CB way as this is were we manage discounts (doing in in PAP would not tell our PAP team the reason why the affiliate is not included)

Please Log in to join the conversation.

8 years 1 month ago - 8 years 1 month ago #279334 by krileon
Replied by krileon on topic CB promotion code and integrations
You could create a copy of your plan then under Integrations > PostAfPro try inputting an invalid affiliate id to see if it'll ignore that commission in PAP since the affiliate id won't be valid.

Alternatively you can try forcing the affiliate id in the basket to something invalid using CB Auto Actions to see if that'd work. Example as follows.

Global
Triggers: onCPayAfterPaymentBasketUpdated
Type: Code
User: Automatic
Access: Everybody
Action
Method: PHP
Code:
$integrationParams	=	$vars['var1']->getParams( 'integrations' );

$integrationParams->set( 'postafpro_affiliateid', 'INVALID' );

$vars['var1']->storeParams( 'integrations' );

The CBSubs PostAfPro integration stores the affiliate id on the before basket update trigger. By acting on the after update trigger and overriding it to something invalid it should store that to the basket and send the invalid affiliate id for affiliate tracking to PAP.

You've access to the entire basket from that point (var1). So if you need it to only apply to a basket with a specific coupon you'd have to do that parsing directly in the code, which might work as follows.

$integrationParams	=	$vars['var1']->getParams( 'integrations' );
$coupons			=	$integrationParams->get( 'promotions_coupons', null );

if ( ! $coupons ) {
	return;
}

$coupon				=	array_shift( explode( '|*|', $coupons ) );

if ( ! in_array( 'COUPON_CODE_HERE', $coupon ) ) {
	return;
}

$integrationParams->set( 'postafpro_affiliateid', 'INVALID' );

$vars['var1']->storeParams( 'integrations' );


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.
The following user(s) said Thank You: activha

Please Log in to join the conversation.

8 years 1 month ago #279828 by activha
Replied by activha on topic CB promotion code and integrations
Thanks a lot, that's exactly what we need ! :-)
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.189 seconds

Facebook Twitter LinkedIn