Php 如何将这个复杂的函数更改为简单的重定向
我一直在对wordpress电子商务插件进行一些更改,并且为了满足我的需要,我增加了大量的功能。现在,在按下购买按钮后,它不会重定向到thankyou页面,因为该函数使用了一些我去掉的变量,如Php 如何将这个复杂的函数更改为简单的重定向,php,wordpress,jigoshop,Php,Wordpress,Jigoshop,我一直在对wordpress电子商务插件进行一些更改,并且为了满足我的需要,我增加了大量的功能。现在,在按下购买按钮后,它不会重定向到thankyou页面,因为该函数使用了一些我去掉的变量,如order\u id,等等 我已经为此工作了几个小时了,我只想在点击购买按钮时重定向到thankyou.php。(我知道现在它使用ajax,我也不介意使用它)我不需要它去processpayment函数或类似的东西。真的很简单 下面是我正在使用的代码和函数: 非常感谢 输入元素: <div id="p
order\u id
,等等
我已经为此工作了几个小时了,我只想在点击购买按钮时重定向到thankyou.php。(我知道现在它使用ajax,我也不介意使用它)我不需要它去processpayment函数或类似的东西。真的很简单
下面是我正在使用的代码和函数:
非常感谢
输入元素:
<div id="payment">
<div class="form-row">
<noscript><?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'jigoshop'); ?><br/><input type="submit" class="button-alt" name="update_totals" value="<?php _e('Update totals', 'jigoshop'); ?>" /></noscript>
<?php jigoshop::nonce_field('process_checkout')?>
<input type="submit" class="button-alt" name="place_order" id="place_order" value="<?php _e('Next Step', 'jigoshop'); ?>" />
<?php do_action( 'jigoshop_review_order_before_submit' ); ?>
<?php if (get_option('jigoshop_terms_page_id')>0) : ?>
<p class="form-row terms">
<label for="terms" class="checkbox"><?php _e('I accept the', 'jigoshop'); ?> <a href="<?php echo get_permalink(get_option('jigoshop_terms_page_id')); ?>" target="_blank"><?php _e('terms & conditions', 'jigoshop'); ?></a></label>
<input type="checkbox" class="input-checkbox" name="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> id="terms" />
</p>
<?php endif; ?>
<?php do_action( 'jigoshop_review_order_after_submit' ); ?>
</div>
</div>
处理付款功能:
function process_payment() {
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
$checkout_redirect = apply_filters( 'jigoshop_get_checkout_redirect_page_id', get_option( 'jigoshop_thanks_page_id' ) );
return array(
'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink( $checkout_redirect )))
);
}
以下是我从firebug获得的错误详细信息:
打开调试后,出现以下错误:
注意:未定义索引:aiosp_已在中启用
/home2/findmyki/public_html/bolistylus/wp content/plugins/all-in-one-seo-pack/all-in-one-u-seo-pack.php
在线710
注意:未定义索引:aiosp_已在中启用
/home2/findmyki/public_html/bolistylus/wp content/plugins/all-in-one-seo-pack/all-in-one-u-seo-pack.php
在线710
注意:使用未定义的常量PLUGIN\u URL-在
/home2/findmyki/public_html/bolistylus/wp content/plugins/wp google-fonts/google-fonts.php
在线81
注意:使用未定义的常量PLUGIN\u PATH-假定为“PLUGIN\u PATH”
在里面
/home2/findmyki/public_html/bolistylus/wp content/plugins/wp google-fonts/google-fonts.php
在线82
注意:未定义索引:主机位于
/home2/findmyki/public_html/bolistylus/wp content/plugins/jetpack/jetpack.php
在线2306
注意:未定义索引:shipping-first\u name in
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线198
注意:未定义索引:shipping-last_name in
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线199
注意:未定义索引:中的船公司
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线200
注意:未定义索引:中的发货地址
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线201
注意:未定义索引:shipping-address-2 in
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线202
注意:未定义索引:中的配送城市
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线203
注意:未定义索引:中的装运状态
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线204
注意:未定义索引:中的配送邮政编码
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线205
注意:未定义索引:装运国家/地区
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线206
重要:
注意:未定义变量:中的用户id
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线211
注意:未定义索引:中的order_注释
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
第256行
注意:未定义索引:中的开票公司
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线264
注意:未定义索引:中的帐单地址
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
第265行
注意:未定义索引:中的billing-address-2
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线266
注意:未定义索引:账单所在城市
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线267
注意:未定义索引:中的计费邮政编码
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线268
注意:未定义索引:计费国家/地区
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
第269行
注意:未定义索引:中的计费状态
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线270
注意:未定义索引:计费电话在
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线272
注意:未定义索引:中的shipping_方法
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线282
注意:未定义索引:中的付款方式
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classes/jigoshop_checkout.class.php
在线283
注意:未定义索引:aiosp_编辑在
/home2/findmyki/public_html/bolistylus/wp content/plugins/all-in-one seo pack/aioseop.class.php
在线1105
注意:未定义索引:nonce aioseop edit in
/home2/findmyki/public_html/bolistylus/wp content/plugins/all-in-one seo pack/aioseop.class.php
在线1106
重要:
注意:未定义变量:中的用户id
/home2/findmyki/public_html/bolistylus/wp content/plugins/jigoshop/classe
function process_payment() {
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
$checkout_redirect = apply_filters( 'jigoshop_get_checkout_redirect_page_id', get_option( 'jigoshop_thanks_page_id' ) );
return array(
'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink( $checkout_redirect )))
);
}
Fatal error: Call to a member function process_payment() on a non-object in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 379
// Process Payment
$result = $available_gateways[$this->posted['payment_method']]->process_payment( $order_id );
Notice: Undefined variable: available_gateways in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 379
if (jigoshop_cart::needs_payment()) :
// Payment Method
$available_gateways = jigoshop_payment_gateways::get_available_payment_gateways();
if (!isset($available_gateways[$this->posted['payment_method']])) :
jigoshop::add_error( __('Invalid payment method.','jigoshop') );
else :
// Payment Method Field Validation
$available_gateways[$this->posted['payment_method']]->validate_fields();
endif;
endif;
<input type="button" value="Submit" onClick="location.href='thankyou.php';">