I would like to return a user to a custom one time offer thanks page for a particular product after paying by paypal. Is it possible to set the return url on a per product basis? alternatively, I have created a new payment system plugin based on the paypal plugin and added a custom brick to allow admin to enter a return url in the forms editor. In the new plugin, I change the return url to the one entered in the custom brick. Will returning back to a page that is not the default return url cause a problem?
For PayPal return URL does not matter. If you are developing custom code, use the following sample to run custom actions on thanks page: application/default/plugins/misc/customthanks.php PHP: <?phpclass Am_Plugin_Customthanks extends Am_Plugin{ // this method will be called before rendering "thanks" page function onThanksPage(Am_Event $event) { $controller = $event->getController(); // ThanksController instance $controller->view->customVar = "XXX"; // you can use $customVar in thanks.phtml template // $invoice = $event->getInvoice(); // Invoice instance OR NULL (!) if (!$invioce) return; foreach ($invoice->getItems() as $item) { /* @var $item InvoiceItem */ if ($item->item_id == 123) $controller->getResponse()->setRedirect('/custom/url/for/product#123'); } }}
that's wonderful, thanks Alex I'll give that a go. will there be an option in the future to set a return url on a per product basis?
Hi Alex, That's perfect above, just what I've been looking for. I've just implemented this but no matter which product I purchase it always redirects back to the OTO custom thank you page I've set up. I want it to just go back if product ID = 4. Here's my code. Maybe it's something I've not set up correctly? Thank you for your help PHP: <?phpclass Am_Plugin_Customthanks extends Am_Plugin{ // this method will be called before rendering "thanks" page function onThanksPage(Am_Event $event) { $controller = $event->getController(); // ThanksController instance $controller->view->customVar = "XXX"; // you can use $customVar in thanks.phtml template // $invoice = $event->getInvoice(); // Invoice instance OR NULL (!) if (!$invioce) return; foreach ($invoice->getItems() as $item) { /* @var $item InvoiceItem */ if ($item->item_id == 4) $controller->getResponse()->setRedirect('/members/application/default/themes/orion/thanks.phtml'); } }}
here is a post I made to show you how to create your own plugin to do this. http://www.amember.com/forum/threads/custom-thankyou-page-redirect-solution.14397/