Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change this complex function to a simple redirect
    primarykey
    data
    text
    <p>I have been making some changes to a wordpress ecommerce plugin and I've taken out a ton of functions to make it simpler for my needs. Now it won't redirect to the thankyou page after the purchase button is pressed because the function uses some variables that I got rid of like <code>order_id</code>, etc. </p> <p>I've been working on this for a few hours now, and all I want it to do is redirect to thankyou.php on the click of the purchase button. (I know right now it uses ajax, and I wouldn't mind using it too) I don't need it to go to the processpayment function or anything like that. Really simple.</p> <p>Here is the code and the functions that I'm working with:</p> <p>Thanks so much!!!</p> <p>Input element:</p> <pre><code>&lt;div id="payment"&gt; &lt;div class="form-row"&gt; &lt;noscript&gt;&lt;?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the &lt;em&gt;Update Totals&lt;/em&gt; button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'jigoshop'); ?&gt;&lt;br/&gt;&lt;input type="submit" class="button-alt" name="update_totals" value="&lt;?php _e('Update totals', 'jigoshop'); ?&gt;" /&gt;&lt;/noscript&gt; &lt;?php jigoshop::nonce_field('process_checkout')?&gt; &lt;input type="submit" class="button-alt" name="place_order" id="place_order" value="&lt;?php _e('Next Step', 'jigoshop'); ?&gt;" /&gt; &lt;?php do_action( 'jigoshop_review_order_before_submit' ); ?&gt; &lt;?php if (get_option('jigoshop_terms_page_id')&gt;0) : ?&gt; &lt;p class="form-row terms"&gt; &lt;label for="terms" class="checkbox"&gt;&lt;?php _e('I accept the', 'jigoshop'); ?&gt; &lt;a href="&lt;?php echo get_permalink(get_option('jigoshop_terms_page_id')); ?&gt;" target="_blank"&gt;&lt;?php _e('terms &amp;amp; conditions', 'jigoshop'); ?&gt;&lt;/a&gt;&lt;/label&gt; &lt;input type="checkbox" class="input-checkbox" name="terms" &lt;?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?&gt; id="terms" /&gt; &lt;/p&gt; &lt;?php endif; ?&gt; &lt;?php do_action( 'jigoshop_review_order_after_submit' ); ?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>checkout.class.php:</p> <pre><code> // Process Payment $result = $available_gateways["cheque"]-&gt;process_payment( $order_id ); // Redirect to success/confirmation/payment page if (is_ajax()) : ob_clean(); echo json_encode($result); exit; else : wp_safe_redirect( $result['redirect'] ); exit; endif; else : // No payment was required for order $order-&gt;payment_complete(); // Empty the Cart jigoshop_cart::empty_cart(); // Redirect to success/confirmation/payment page $checkout_redirect = apply_filters( 'jigoshop_get_checkout_redirect_page_id', get_option( 'jigoshop_thanks_page_id' ) ); if (is_ajax()) : ob_clean(); echo json_encode( array( 'redirect' =&gt; get_permalink( $checkout_redirect ) ) ); exit; else : wp_safe_redirect( get_permalink( $checkout_redirect ) ); exit; endif; endif; // Break out of loop break; </code></pre> <p>process payment function:</p> <pre><code>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' =&gt; 'success', 'redirect' =&gt; add_query_arg('key', $order-&gt;order_key, add_query_arg('order', $order_id, get_permalink( $checkout_redirect ))) ); } </code></pre> <p>Here is the error details I'm getting from firebug:</p> <p><img src="https://i.stack.imgur.com/PEPlU.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/Ntz8l.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/uC4Zx.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/nDm5i.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/q6xnS.png" alt="enter image description here"></p> <p>After I turned debugging on, I got these errors:</p> <blockquote> <p>Notice: Undefined index: aiosp_enabled in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php on line 710</p> <p>Notice: Undefined index: aiosp_enabled in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php on line 710</p> <p>Notice: Use of undefined constant PLUGIN_URL - assumed 'PLUGIN_URL' in /home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php on line 81</p> <p>Notice: Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH' in /home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php on line 82</p> <p>Notice: Undefined index: host in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jetpack/jetpack.php on line 2306</p> <p>Notice: Undefined index: shipping-first_name in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 198</p> <p>Notice: Undefined index: shipping-last_name in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 199</p> <p>Notice: Undefined index: shipping-company in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 200</p> <p>Notice: Undefined index: shipping-address in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 201</p> <p>Notice: Undefined index: shipping-address-2 in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 202</p> <p>Notice: Undefined index: shipping-city in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 203</p> <p>Notice: Undefined index: shipping-state in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 204</p> <p>Notice: Undefined index: shipping-postcode in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 205</p> <p>Notice: Undefined index: shipping-country in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 206</p> </blockquote> <p>IMPORTANT:</p> <blockquote> <p>Notice: Undefined variable: user_id in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 211</p> <p>Notice: Undefined index: order_comments in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 256</p> <p>Notice: Undefined index: billing-company in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 264</p> <p>Notice: Undefined index: billing-address in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 265</p> <p>Notice: Undefined index: billing-address-2 in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 266</p> <p>Notice: Undefined index: billing-city in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 267</p> <p>Notice: Undefined index: billing-postcode in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 268</p> <p>Notice: Undefined index: billing-country in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 269</p> <p>Notice: Undefined index: billing-state in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 270</p> <p>Notice: Undefined index: billing-phone in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 272</p> <p>Notice: Undefined index: shipping_method in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 282</p> <p>Notice: Undefined index: payment_method in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 283</p> <p>Notice: Undefined index: aiosp_edit in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php on line 1105</p> <p>Notice: Undefined index: nonce-aioseop-edit in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php on line 1106</p> </blockquote> <p>IMPORTANT:</p> <blockquote> <p>Notice: Undefined variable: user_id in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 364</p> <p>Notice: Undefined variable: available_gateways in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 379</p> </blockquote> <p>IMPORTANT:</p> <blockquote> <p>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</p> <p>Notice: Undefined index: aiosp_enabled in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php on line 710</p> <p>Notice: Undefined index: aiosp_enabled in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php on line 710</p> <p>Notice: Use of undefined constant PLUGIN_URL - assumed 'PLUGIN_URL' in /home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php on line 81</p> <p>Notice: Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH' in /home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php on line 82</p> <p>Notice: Undefined index: host in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jetpack/jetpack.php on line 2306</p> <p>Notice: Undefined index: shipping-first_name in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 198</p> <p>Notice: Undefined index: shipping-last_name in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 199</p> <p>Notice: Undefined index: shipping-company in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 200</p> <p>Notice: Undefined index: shipping-address in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 201</p> <p>Notice: Undefined index: shipping-address-2 in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 202</p> <p>Notice: Undefined index: shipping-city in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 203</p> <p>Notice: Undefined index: shipping-state in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 204</p> <p>Notice: Undefined index: shipping-postcode in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 205</p> <p>Notice: Undefined index: shipping-country in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 206</p> <p>Notice: Undefined variable: user_id in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 211</p> <p>Notice: Undefined index: order_comments in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 256</p> <p>Notice: Undefined index: billing-company in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 264</p> <p>Notice: Undefined index: billing-address in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 265</p> <p>Notice: Undefined index: billing-address-2 in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 266</p> <p>Notice: Undefined index: billing-city in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 267</p> <p>Notice: Undefined index: billing-postcode in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 268</p> <p>Notice: Undefined index: billing-country in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 269</p> <p>Notice: Undefined index: billing-state in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 270</p> <p>Notice: Undefined index: billing-phone in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 272</p> <p>Notice: Undefined index: shipping_method in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 282</p> <p>Notice: Undefined index: payment_method in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 283</p> <p>Notice: Undefined index: aiosp_edit in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php on line 1105</p> <p>Notice: Undefined index: nonce-aioseop-edit in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php on line 1106</p> <p>Notice: Undefined variable: user_id in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 364</p> <p>Notice: Undefined variable: available_gateways in /home2/findmyki/public_html/bolistylus/wp-content/plugins/jigoshop/classes/jigoshop_checkout.class.php on line 379</p> </blockquote> <p>IMPORTANT!!!!:</p> <blockquote> <p>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</p> <p>Notice: Undefined index: aiosp_enabled in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php on line 710</p> <p>Notice: Undefined index: aiosp_enabled in /home2/findmyki/public_html/bolistylus/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php on line 710</p> <p>Notice: Use of undefined constant PLUGIN_URL - assumed 'PLUGIN_URL' in /home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php on line 81</p> <p>Notice: Use of undefined constant PLUGIN_PATH - assumed 'PLUGIN_PATH' in /home2/findmyki/public_html/bolistylus/wp-content/plugins/wp-google-fonts/google-fonts.php on line 82</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload