<?php
function MODULENAME_form_alter(&$form, $form_state, $form_id){
global $user;
switch ($form_id) {
// This is our form ID.
case 'YOUR_NODE_FORM_ID': // like page_node_form(for node/add/page)
$form['buttons']['submit']['#submit'][] = 'redirect_this_form';
break;
}
}
function redirect_this_form($form, &$form_state) {
if ($form_state['nid']) {
$node = node_load(array('nid' => $form_state['nid']));
switch($node->type) {
case 'page':
$form_state['redirect'] = 'pages'; // you should specicify here where want to redirect the form after submission
}
}
}
?>
How to redirect a form in drupal
How to set-up paypal sandbox in ubercart
taken from Ubercart PayPal sandbox setup
PayPal sandbox preface:The trick with the PayPal sandbox is you have 3 accounts. The primary account is your developer account. This logs you into http://developer.paypal.com/. The other two (one Buyer one Seller) work within the sandbox system. You need to login with your developer account before you can use these other accounts. The way I set mine up was to use my email address for the developer account and just use the default address generated by PayPal for the Buyer and Seller accounts. Also, if need be you can create multiple Buyer and Seller accounts under your developer account.
Below is a complete step-by-step for setup and checkout (tested with Drupal 6.10 and Ubercart 2.0 beta3)1. Go to http://developer.paypal.com/ and create an account. This is separate from any existing PayPal account you may have.
2. Click on "Create a preconfigured buyer or seller account."
3. Check "Buyer", leave the email address alone, change the password if you'd like (but remember to write it down), then click "Create Account".
4. Click again on "Create a preconfigured buyer or seller account." but this time create a "Seller" account.5. On the "Test Accounts" page enable test mode for the business account by clicking "Disabled" (which changes it to "Enabled").
6. In Drupal, enable the PayPal module (under Ubercart - payments)
7. Under "Administer » Store administration » Configuration » Payment settings" expand the "PayPal Website Payments Standard settings".
9. You can then change the rest of the settings in the Ubercart PayPal module as you'd like. I recommend changing the "Order review submit button text:" to something like "Pay with PayPal".
To complete a test checkout:
1. Make sure you are logged in to PayPal's sandbox server using your main account (go here: http://developer.paypal.com)
2. In Drupal proceed to checkout as you normally would and after you click the button that would normally say "Submit Order", you will be redirected to PayPal's sandbox server. If you are properly logged in with your developer account you will see "XXX's Test Store" at the top of the page.3. Log in with your Buyer account information (something like "you_12313765733_per@here.com"). Careful here as this is constantly crashing FF3 on my machine.
4. Complete the transaction using your phony test account for the Buyer.5. You will then see a page saying your transaction is complete and a button taking you back to your store. Order emails do not appear to get sent (to either the buyer or store admin) if the user does not click this button to return to the store, although the order's status is updated to "Payment receiver".
this works with me! thanks to ryangroe@ubercart
Unable to send email in ubercart
after i completed my payment from paypal sandbox i got this error messages.
What I did is I just configured the my contact details
http://www.example.com/admin/store/settings/store/edit
that's it! and this solves my problem above.
hope this helps!