jampjamp
jampjamp

Reputation: 31

Opening two action urls in php, for payments in oscommerce

I have a problem with osCommerce shop engine. I use Third Party payment site. If the customer won't click to get back into my page, the order is not being saved. Here is the code of two options, the first is url of external web page, the second shows a page which saves the order (checkout_success.php). Can I do anything to open them both?

<?php
  if (isset($$payment->form_action_url)) {
    $form_action_url = $$payment->form_action_url; ///opens external site
  } else {
    $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); ///saves the order
  }
?>

Upvotes: 0

Views: 86

Answers (1)

lazy.lizard
lazy.lizard

Reputation: 919

You must save the order first by redirecting to FILENAME_CHECKOUT_PROCESS url and after that you can redirect to the external payment site.

Your code should look like this

    <?php
      if (isset($$payment->form_action_url)) {
      $_SESSION['externalPaymentSite'] = true;  
      }
        $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); /saves the order

    ?>

and after saving the order in in FILENAME_CHECKOUT_PROCESS you should do something like

if ($_SESSION['externalPaymentSite'] === true) {
// 1. delete session externalPaymentSite
// 2. redirect to external site
}

Upvotes: 0

Related Questions