开发者

How to override the review_cart form in ubercart

I need to write a module that sends order data to an epayment service, similar to say, paypal. They need the data to be submitted from a form with elements that look something like this (notice the duplicate name):

<input name="ORDER_PNAME[]" type="hidden" value="CD Player">
<input name="ORDER_PNAME[]" type="hidden" value="Geanta voiaj 2L">

This makes it impossible to override the form by si开发者_如何学运维mply editing $form in module_form_alter() because "ORDER_PNAME[]" would be a duplicate key in $form.

So I need to bypass the whole drupal form handling system. I looked and found that I could overwrite the $form variable in uc_cart_checkout_review with plain html form data (see http://api.ubercart.org/api/function/uc_cart_checkout_review/2 line 4).

What would be the correct way to do this?


On the rights of a workaround:
you can add the necessary form elements using markup element:

$form['your_name'] = array(
    '#type'  => 'markup',
    '#value' => '<input name="ORDER_PNAME[]" type="hidden" value="CD Player">
                 <input name="ORDER_PNAME[]" type="hidden" value="Geanta voiaj 2L">',
);


If you don't need to redirect user to that e-payment service page, just send data, you can use curl to post the necessary data. A related question: Auto Submitting a form (cURL).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜