Hi all, I tried to steal the code from the payments_history template, PHP: <a href="{$p.cancel_url}" target=top onclick="return confirm('#_TPL_MEMBER_CANCEL_SUBSCR#')">#_TPL_MEMBER_CANCEL#</a> and put it in the <li> of the member dashboard template where it lists the active subscriptions. The link, when clicked, brings up the alert box asking if I really want to cancel, but if I click okay, it just redirects back to the dashboard and doesn't cancel the product. Can I get some help on how to do this? I'm guessing it has something to do with the {$p.cancel_url} and where that's placed in the {foreach} statement of member_main.html. Thanks!
Do you have an example active user for whom the cancel link is active on the payment history page? Chances are you can copy the URL thats given there to other parts of the site. David
Unfortunately that doesn't work. It generates some variables that I suppose I could grab with a little bit of code. https://domain.com/members/plugins/...ecurring&payment_id=85&member_id=100527&v=xxx The v=xxx part at the end I believe is the session key which I can get, i can get the payment_id most likely??? and definitely the member_id, but you can also see that it's choosing the cc_core as the payment type so what if someone paid via a PayPal billing agreement?
Have a look to example from member.php: PHP: $paysys = get_paysystem($v['paysys_id']); $product = $db->get_product($v['product_id']); if ($paysys['recurring'] && ($pay_plugin = &instantiate_plugin('payment', $v['paysys_id'])) && $product['is_recurring'] && method_exists($pay_plugin, 'get_cancel_link')){ $payments[$k]['cancel_url'] = $pay_plugin->get_cancel_link($v['payment_id']); } So all you need to do is to get payment plugin class and use get_cancel_link method for each payment.