|
|
|
BRUCE…
Here is what I did. I took out the wp_remote_fopen($uri) and replaced it with the echo
My code looks like this:
$p1 = "<img src=" . chr(34);
$uri= '...sale.php?profile=83&idev_saleamt=' . $commission . '&idev_ordernum=' .$s2member_subscr_id ;
$p2 = chr(34) . " style=" . chr(34). "height:1px; width:1px;" . chr(34). "/>";
$sendpart = $p1 . $uri . $p2;
echo $sendpart;
and then I output $sendpart to a log file so I’ll know if code was generated.
The code is generated as I see the data from $sendpart in the log. However, the echo is not triggering the iDev.
I can copy the $sendpart URL into another browser window and it then does trigger it and I see the commission record in iDev.
I can only assume the ECHO is not the solution either. Is there a way I can escalate this up the support chain. I’m even willing to pay for support on this. So far, I’ve done everything that you’ve instructed me and it’s not working.
I know the MU Plugin is working and it’s running through the function fine, but neither solution you are suggest that will trigger the iDev is working.
Cordially,
Terry
|
|
Bruce Help…
I’m about a week away from launching and really need to figure this out.
Would be highly interested in your thoughts on this.
I’m doing the MU Plugin and it’s triggering, however it’s not triggering the iDev sale.php so the sale gets counted.
My logic in the MU Plugin works because I’m capturing the data in a log, however it’s not registering with iDev.
Can you look at my code above and see what I might be doing wrong.
Please know I would greatly appreciate your help and getting past this…
Cordially,
Terry
|
|
Bruce,
You know I was thinking…why would I want to use the wp_remote_fopen? This opens a remote file, however the sale.php is located on my domain.
Would I want to just use the include (/sale.php?profile=…)
The wp_remote_fopen is not working so I’m left thinking maybe this is not the correct way to do this.
What are your thougths?
Cordially,
Terry
|
|
Eduan,
It seemed they could not get iDevAffiliate working properly and it also seemed like they installed it themselves. I was suggesting they have iDevAffiliate install it. We did and everything worked perfectly from the start.
Terry
|
|
Bruce,
First, thank you for your reply.
Secondly, I need to apologize. I have been pulling my hair out on this. Here is what I found:
1.) I actually (I know I did this before) did not remove the call in the API Tracking. This was the reason I kept thinking iDev as calling S2Member.
2.) I did remove it this time and double checked so it is gone from there.
3.) Going back to the MU Plugin – I used the $contents = wp_remote_fopen($uri);
This is not working…
I’ve tried it many different ways. I also output everything to a log. I output $contents which does not have anything in when it gets written to the log. This may be fine as I would take it as successful because the documentation suggest I would get false on failure.
I’ve also tried to hardcode the variables that I’m passing with no luck either.
I’m hoping you can help. This is getting extremely frustrating because it seems soooooo simple.
Here is my code:
<?php
add_action('init', 's2_payment_notification'); function s2_payment_notification()
{
if(!empty($_GET['s2_payment_notification'])) // In my URL, I have `?horns_affiliate_calc_actual_commission=yes`, that's what I'm looking for here.
{
if(!empty($_GET['user_id']) && !empty($_GET['item_number'])) // In my URL, I have `&user_id=%%user_id%%&item_number=%%item_number%%`, that's what I'm looking for here.
{
$user_id = (integer)$_GET['user_id']; // I'm expecting an integer in this value.
$item_number = (string)$_GET['item_number']; // I'm expecting a string in this value.
$user = new WP_User($user_id); // Get a WordPress® User object instance so I can work with this customer.
// Here I might perform any number of tasks related to this user. Such as creating a user option value in WordPress.
update_user_option($user_id, 'my_custom_data_for_this_user', $item_number);
// I could also collect details about this user, by accessing properties of my WP_User object instance.
$first_name = $user->first_name;
$last_name = $user->last_name;
$email = $user->user_email;
$username = $user->user_login;
$amount_paid = (string)$_GET['amount_paid']; // I'm expecting a string in this value.
$full_coupon_code = (string)$_GET['coupon_code']; // I'm expecting a string in this value.
// I can also pull s2Member® option values related to this user.
$s2member_subscr_id = get_user_option('s2member_subscr_id', $user_id);
$s2member_custom_fields = get_user_option('s2member_custom_fields', $user_id);
$s2member_custom = get_user_option('s2member_custom', $user_id);
$s2member_registration_ip = get_user_option('s2member_registration_ip', $user_id);
$s2member_paid_registration_times = get_user_option('s2member_paid_registration_times', $user_id);
$s2member_first_payment_txn_id = get_user_option('s2member_first_payment_txn_id', $user_id);
$s2member_last_payment_time = get_user_option('s2member_last_payment_time', $user_id);
$s2member_auto_eot_time = get_user_option('s2member_auto_eot_time', $user_id);
$s2member_file_download_access_log = get_user_option('s2member_file_download_access_log', $user_id);
/*Determine Product, then Transaction amount and then comission
// Formula [Transaction $$ - Product COG] = Commission
// Doesn't matter the discount because we will always take COG out and the rest is commissions
*/
$commission=0;
$cog=0;
//Determine what product and set the $commission to be pass to iDev
Switch ($item_number){
Case "1" : //Print Only
$cog = 2.50;
$commission = number_format($amount_paid-$cog,2,".", "");
break;
Case "2" : // Print & Digital
$cog = 5.00;
$commission = number_format($amount_paid-$cog,2,".", "");
break;
}
//if commissions is zero or less dont do anything.
if ($commission <=0)
{
$commission=0;
}
else
{
$uri= "https://www.hornsillustrated.com/idevaffiliate/sale.php?profile=83&idev_saleamt=" . $commission . "&idev_ordernum=" .$s2member_subscr_id ;
$contents = wp_remote_fopen($uri);
}
/* I could also log this transaction, by creating a log entry in a static text file on-site. */
file_put_contents(WP_CONTENT_DIR.'/plugins/s2member-logs/affiliate-transactions.log', 'IsString: '.is_string($uri). ' Item: ' .$item_number. ' Commissions: '.$commission. ' Amount paid: ' .$amount_paid. ' cog: ' .$cog. ' Full Coupon Code: ' .$full_coupon_code. 'return from idev: ' .$contents. 'uri: ' .$uri. "\n", FILE_APPEND);
}
exit; // We can exit here. There's no reason to continue loading WordPress® or my theme during an API Notification.
}
}
|
|
Bruce,
Thanks for the direction. I used it and it worked, however the data sent to iDev is not being used by iDev.
I’m sending: https://www.hornsillustrated.com/idevaffiliate/sale.php?profile=xx&idev_saleamt=2.5&idev_ordernum=16903267
I do have the correct profile # and only replaced it here to xx.
Cordially,
Terry
|
|
Brian,
Thank you for your reply. You say you don’t this this is possible…
I was trying to implement this based on the conversation on this post: http://www.s2member.com/forums/topic/sending-idevaffiliate-a-specific-amount/
I’m not sure even what question to ask now. I did take out the API/Tracking code for iDev.
I did this so that the API Payment Notification would trigger and then I created a MU Plugin that calculated the new idev_saleamt. The MU Plugin works perfectly except for sending the new value to iDev.
Curious, what do you think this is not possible. I think I know, because sale.php actually reads (it appears) S2Member records from the db.
As a test, in the MU Plugin, I just put in the call to iDev only sale.php?profile=83 and it still pulled the actual sale amount. So without passing it idev_saleamt it still knew what it was. Also like the order/transaction # was in a memory variable or something.
So here is all I want to do. Take the original sale amount subtract cost of goods and make the remaining amount the commissionable amount.
Sale Amount = $100
COG = $75
idev_saleamt=$25
img src=”xyz.com/idevaffiliate/sale.php?profile=83&idev_saleamt=25&idev_ordernum=1234″
Are there ANY options I do have?
Cordially,
Terry
|
|
I’m curious, is there a list of replacement codes that iDevAffiliate accepts?
|
|
Matthew,
You may have already thought of this. I would *highly* suggest simply having iDevAffiliate do the installation of iDev into S2Member.
It cost $45 (I think) and they’ll have it up and running.
Terry
|
|
Bruce,
No no…
If I’m sitting on this page: http://hornsillustrated.com/index.php/2013/04/04/a-deeper-look-at-texas-baseballs-minnesota-road-trip/
and I click on the Login link (see bottom of the post) I go to the login page. The previous page should be where it came from which in this case is http://hornsillustrated.com/index.php/2013/04/04/a-deeper-look-at-texas-baseballs-minnesota-road-trip/
So when I login should it take me back to that page?
I’m not following you on this.
Now, the login widget is on the login page…agreed.
So, here’s the 1,000,000 dollar question. Specifically, how could I implement the EXACT login that S2Member has where you click on login and a dropbox appears and you login. This is excellent campared to my 1990 style I have now.
Cordially,
Terry
|
|
I have a seperate login page where I put the following code:
$ops = array(‘title’ => ”, ‘login_redirect’ => “%%previous%%”, ‘profile_title’=>”, ‘display_gravatar’=>’0′, ‘display_name’=>’1′, ‘my_account_url’=>”, ‘my_profile_url’=>”);
echo s2member_pro_login_widget($ops);
I do get logged in, however…
When I’m on a page the required user access and I send them to a login form and they login, the redirect does not take them back to the original place they started.
Here’s a live example
http://hornsillustrated.com/index.php/2013/04/04/a-deeper-look-at-texas-baseballs-minnesota-road-trip/
At the bottom of the article, there is a link for login. Please use that one.
The login at the top of the page works perfectly.
you can use the credentials adsguest/ads1234
Any help would be awesome…thank you.
Cordially,
Terry
|
|
Bruce,
I get it…thank you! I really appreciate you for explaining this. Makes sense.
I’ve been reading the MU Plugin stuff.
Thanks again…
Cordially,
Terry
|
|
Bruce
Thanks again for your reply. So I can get my head around this…
I had IDevAffiliate do the integration (installation) It sounds like I need to undo this (I guess)
When a payment is made the notification gets triggered and sent to my script for processing, however how would I stop the order from going to IDev before I do my calc?
I’m not tracking with what you are saying.
I get the URL thing but I’m not following exactly how the flow goes as it pertains to an affiliate sending traffic and then an order gets made.
If I ddi nothing, IDev would capture the order and apply a commission. I need to divert that order, make a quick calc and send to IDev a different SaleAmt.
I get how to create a notification trigger, but the whole flow is tripping me up. Can you explain
As always, Thanks.
Cordially,
Terry
|
|
Bruce,
Thanks your response. One last question (hopefully).
When a Payment Notification gets triggered and I have a MU Script that does some calc, how do I pass the data back to iDevaffiliate or S2Member?
Or, is this a one way communications. S2Member has a payment and it performs a call out to IDevAffiliate and whatever URL I have listed in the Payment Notifications.
I would then need to take that script and notify IDevAffiliate seperately outside of S2Member thus removing any integration between S2 and IDev?
Just trying to get my head around this…
Appreciate your insight…Thank You!
Cordially,
Terry
|
|
Cristian,
So, the process would be: Order Placed > Data Send To Handler (Calcs the commission) > Send To IDevAffiliate
Your thoughts?
Cordially,
Terry
|
|
Cristian,
Thank you for your reply. I appreciate your insight.
How would I go about intercepting the transaction and passing it to my script? Is this something that is triggered based the API Notification Handler?
It seems like the handler works such that an order gets placed and then data is passed to whatever URL’s are in the Handler list. One of the URL’s would be my script (PHP)
Am I thinking correctly?
So, the process would be: Order Placed > Data Send To Handler (Calcs the commission) > Send To IDevAffiliate
Your thoughts?
Cordially,
Terry
|
|
Bruce,
Thank you for your reply. I’m hoping I’ve asked the right question because it seems to me that you must be concatenating this data somewhere in the S2Member code. We know that the Coupon Code is available on the form submit so the variable is accessible.
I’d think we could simple add something like $_Get[‘couponcode’] to the description line that get’s submitted to the gateway.
Here’s also my thought…we use Authorize.net and when we get the receipt there are 2 “Merchant Defined” variables that are populated.
S2_Invoice:
S2_Custom: http://www.hornsillustrated.com
How could I put a S2_Coupon: [couponcode]
I apologize for driving this back at you but I’m hoping maybe I before I didn’t fully ask the right question. It’s seems to easy (in my mind).
Cordially,
Terry
|
|
Is there a way to affect how the Desc field gets calculated or concatenated? I’d like to concatenate it with Coupon: [CouponCode] the amount and the description
Does anyone know how to accomplish this?
Terry
|
|
Sara,
I hope you get this fixed as it will make a huge difference in your expenses/commissions you have to pay out.
Question: We are about to implement iDevAffiliate. Are you happy with them? Any hidden gotchas we should be aware of? Or, things you wish you would have known before you launched it?
I’ll be watching this thread and also ask your question of iDevAffiliate today as I have a call into them.
Cordially,
Terry
|
|
Perhaps you can help with another topic if that’s OK. Our client also wants to set up EOT notifications at 30 and 15 days prior to expiration. I’ve read on your site where that is in the works for the new release. Any news about that release I could pass along? I’ve also read about the hooks. I’ve passed this info on to my developer, but they said that this may create security risks. What are your thoughts?
|
|
Thanks Cristian. We are using authorize.net, and I have the SSL in progress now. Thank you for your help!!
|