HeliSchorsch Posted May 23, 2007 Share Posted May 23, 2007 Hi to all, i try to modify the paypal module to use it as a new payment module where i must pass parameters to the form_action_url. The resulting url should look like this example: "https://shop.ccbank.de/weblogic/webfinanz/deutsch/startWebfinanz.jsp?haendlernummer=1234567890&kaufpreis=infototal&warenbezeichnung=BestNr_infoid" where infototal is the total amount of the order and infoid is the id of the order I tried to do it this way, but the amount and the id isn't passed to the link. $this->form_action_url = 'https://shop.ccbank.de/weblogic/webfinanz/deutsch/startWebfinanz.jsp?haendlernummer=' . MODULE_PAYMENT_CCBANK_ID . '&kaufpreis=' . $order->info['total'] . '&warenbezeichnung=BestNr_' . $order->info['id']; The result looks like this: "https://shop.ccbank.de/weblogic/webfinanz/deutsch/startWebfinanz.jsp?haendlernummer=1234567890&kaufpreis=&warenbezeichnung=BestNr_" Any idea? Best regards Schorsch Link to comment Share on other sites More sharing options...
Nimuel Posted July 10, 2007 Share Posted July 10, 2007 you need to make sure that you have $order set as a global to get to the total. function *name of function*() { global $order; but there are two problems, one is that the Order ID is created later as the order is inserted into TABLE_ORDERS, to get around that you can create a temporary ordernumber for intance: $length = 3; for($i=0;$i<$length;$i++) { $number .= rand(0,9);} $myNewOrderId = time() . '-' . $customer_id . '-' . $number; which you can store somewhere along with the order (maybe in TABLE_ORDERS_STATUS_HISTORY or create a new field in the order table where you store it, or an entirely new table dedicated to this module). The second problem is that $this -> form_action_url is defined before $order->info['total'] is populated. What's make matters even worse is that the additional charges in the order totals list arent added until later in the before_proces(). And you can't run the function because that will define the classes which will cause an error once you reach checkout_process.php. So you have to make a hack for that. But even after that, i dont know how to get the totals to calculate prior to making the form_action_url so that it can be included without editing the checkout_process.php :( Link to comment Share on other sites More sharing options...
Nimuel Posted July 11, 2007 Share Posted July 11, 2007 Solved it with a hack by creating the new url with the order total value in process_button() (which is run after the $order_total_modules->process) and also included a javascript that replaces the form_action_url. define the form_action_url something like this; $this->form_action_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, "payment_error=". $this->code . '&message=' . urlencode(ERROR_TEXT) and in process_button() i did something like this $process_button_string = tep_draw_hidden_field('mynewurl', $this -> getmyurl()); //the function getmyurl creates the new url $process_button_string .= "<script type=\"text/javascript\">\n<!--\n"; $process_button_string .= "function mp_replace_url(){"; $process_button_string .= "document.checkout_confirmation.action = document.checkout_confirmation.mynewurl.value;\n"; $process_button_string .= "}\n"; $process_button_string .= "-->\n</script>"; $process_button_string .= "<script type=\"text/javascript\">\n<!--\n"; $process_button_string .= "mp_replace_url();\n"; $process_button_string .= "-->\n</script>"; return $process_button_string; it's not pretty but it works... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.