Posted: October 7, 2013 at 7:22 am
|
I realize this isnt an implemented function but I read this post and this work around may help for the time being. I have been able to add the new shortcodes for [amount_paid] and [amount_owed] into the payment reminder email, however the payment page is still displaying the total price and sending that price to paypal. Can anyone point me to where I can replace that variable and what I can replace it with since the shortcodes will not work there. Thanks!
|
Hi Cori, The paypal_vars.php on lines 52 and 57 are two places where the amount sent to PayPal is sent. You will likely need to introduce a few new variables there that will allow for the calculation to be made, which will involve altering the query on line 33 in the same file. You will need to add a.amount_pd to the query there on line 33 to get the amount paid variable. |
|
|
Thanks Josh, I may need a bit more guidance than that… my lines dont seem to be matching up with yours… |
You may be on a different version. Here are code snippets based on the current version of Event Espresso (3.1.35.1.P). Starting with the loop that sets the payment amount that is sent to PayPal taken from /gateways/paypal/paypal_vars.php: foreach ($items as $key => $item) { $item_num = $key + 1; $myPaypal->addField('item_name_' . $item_num, $item->price_option . ' for ' . $item->event_name . '. Attendee: ' . $item->fname . ' ' . $item->lname); $myPaypal->addField('quantity_' . $item_num, absint($item->quantity)); if ($item->final_price < $item->orig_price) { $adjustment = abs($item->orig_price - $item->final_price); if (absint($item->quantity) > 1) { $adjustment = $adjustment * absint($item->quantity); } $myPaypal->addField('amount_' . $item_num, $item->orig_price); $myPaypal->addField('discount_amount_' . $item_num, $adjustment); //$myPaypal->addField('discount_amount2_' . $item_num, $adjustment);//Not sure this line is needed. } else { $myPaypal->addField('amount_' . $item_num, $item->final_price); } if (isset($paypal_settings['tax_override']) && $paypal_settings['tax_override'] == true) { $myPaypal->addField('tax_' . $item_num, '0.00'); } if (isset($paypal_settings['shipping_override']) && $paypal_settings['shipping_override'] == true) { $myPaypal->addField('shipping_' . $item_num, '0.00'); } } In the above code block you’ll see the ‘amount_’ fields are set for PayPal on lines 52 (when a discount is applied) and 57 (no discount applied). This is where some logic may be added to factor in any amount paid and then deducted from the due amount sent to PayPal. then on line 33 is where the query gets started being built: $SQL = "SELECT a.final_price, a.orig_price, a.quantity, ed.event_name, a.price_option, a.fname, a.lname "; the amount paid can be added to the query: $SQL = "SELECT a.final_price, a.orig_price, a.quantity, ed.event_name, a.price_option, a.fname, a.lname, a.amount_pd "; Then, the $item->amount_pd can be used in the foreach loop as a variable that will pull in the amount paid. |
|
|
Thank you, <code>//only display amount owed $myPaypal->addField('amount_' . $item_num, $item->final_price - absint($item->amount_pd)); //$myPaypal->addField('amount_' . $item_num, $item->orig_price);</code> However, I dont see that value getting passed to paypal. Is that the variable that is actually getting passed? Also, on the ‘thank-you’ page where the invoice and email payment reminders direct you, where is that Amount Paid/Owed: value coming from. I need that to be updated as well. It seems to be on the payment_overview.php page but I do not see where the $total_cost variable is being set. |
|
I tested it and it’s working, except you don’t need to be sending the amount_pd_ and amount_owed_ fields, so I commented those out. They aren’t in the paypal list of fields, so they were probably just getting ignored. The one that they are looking for is amount_ If you look at the html of the button, or put it into sandbox mode so that all the fields get listed, you’ll see it as amount_1, since it is the amount for item number 1. If you checkout with multiple attendees you’ll see amount_2, etc. |
|
Wow, I am just blow away by your quick and thorough help! Thank you!!! |
The support post ‘Partial Payments’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.