From 297ffd7af019b4eeae824719c1509dd0ab64ac30 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 4 Nov 2011 17:48:04 +0000 Subject: [PATCH] Paypal fix, and Signup/login can be turned off for checkout. Closes #125. --- admin/admin-settings.php | 46 ++++++++++++++++++----------- classes/checkout.class.php | 2 +- classes/gateways/gateway-paypal.php | 5 +++- readme.txt | 5 ++++ templates/checkout/form.php | 6 ++++ woocommerce_template_functions.php | 6 +++- 6 files changed, 50 insertions(+), 20 deletions(-) diff --git a/admin/admin-settings.php b/admin/admin-settings.php index 545e98ec87b..82c64cfec5b 100644 --- a/admin/admin-settings.php +++ b/admin/admin-settings.php @@ -51,35 +51,45 @@ $woocommerce_settings['general'] = apply_filters('woocommerce_general_settings', ), array( - 'name' => __( 'Guest checkout', 'woothemes' ), + 'name' => __( 'Checkout', 'woothemes' ), 'desc' => __( 'Allow users to checkout without signing up for an account', 'woothemes' ), 'id' => 'woocommerce_enable_guest_checkout', 'std' => 'yes', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'checkboxgroup' => 'start' ), array( - 'name' => __( 'Force SSL/HTTPS', 'woothemes' ), - 'desc' => __( 'Force the checkout/pay pages to be sent over https for added security (An SSL Certificate is required)', 'woothemes' ), + 'desc' => __( 'Allow users to create an account and login from the checkout page', 'woothemes' ), + 'id' => 'woocommerce_enable_signup_and_login_from_checkout', + 'std' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => '' + ), + + array( + 'desc' => __( 'Force SSL/HTTPS (an SSL Certificate is required)', 'woothemes' ), 'id' => 'woocommerce_force_ssl_checkout', 'std' => 'no', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'checkboxgroup' => 'end' ), array( - 'name' => __( 'WooCommerce CSS', 'woothemes' ), - 'desc' => __( 'Enable WooCommerce frontend CSS styles', 'woothemes' ), + 'name' => __( 'Shop Styling', 'woothemes' ), + 'desc' => __( 'Enable WooCommerce CSS styles', 'woothemes' ), 'id' => 'woocommerce_frontend_css', 'std' => 'yes', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'checkboxgroup' => 'start' ), array( - 'name' => __( 'Product image lightbox', 'woothemes' ), - 'desc' => __( 'Enable WooCommerce lightbox?', 'woothemes' ), + 'desc' => __( 'Enable WooCommerce lightbox on the product page', 'woothemes' ), 'id' => 'woocommerce_enable_lightbox', 'std' => 'yes', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'checkboxgroup' => 'end' ), array( @@ -567,23 +577,25 @@ $woocommerce_settings['shipping'] = apply_filters('woocommerce_shipping_settings array( 'name' => __( 'Shipping Options', 'woothemes' ), 'type' => 'title','desc' => '', 'id' => 'shipping_options' ), array( - 'name' => __( 'Calculate shipping', 'woothemes' ), - 'desc' => __( 'Enable shipping/shipping calculations', 'woothemes' ), + 'name' => __( 'Shipping calculations', 'woothemes' ), + 'desc' => __( 'Enable shipping', 'woothemes' ), 'id' => 'woocommerce_calc_shipping', 'std' => 'yes', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'checkboxgroup' => 'start' ), array( - 'name' => __( 'Shipping calculator', 'woothemes' ), + 'name' => __( 'Shipping calculations', 'woothemes' ), 'desc' => __( 'Enable the shipping calculator on the cart page', 'woothemes' ), 'id' => 'woocommerce_enable_shipping_calc', 'std' => 'yes', - 'type' => 'checkbox' + 'type' => 'checkbox', + 'checkboxgroup' => 'end' ), array( - 'name' => __( 'Ship to billing', 'woothemes' ), + 'name' => __( 'Shipping destination', 'woothemes' ), 'desc' => __( 'Only ship to the users billing address', 'woothemes' ), 'id' => 'woocommerce_ship_to_billing_address_only', 'std' => 'no', diff --git a/classes/checkout.class.php b/classes/checkout.class.php index 3110a131f63..5d2f9fbe286 100644 --- a/classes/checkout.class.php +++ b/classes/checkout.class.php @@ -176,7 +176,7 @@ class woocommerce_checkout { do_action('woocommerce_after_checkout_billing_form', $this); // Registration Form Fields - if (!is_user_logged_in()) : + if (!is_user_logged_in() && get_option('woocommerce_enable_signup_and_login_from_checkout')=="yes") : if (get_option('woocommerce_enable_guest_checkout')=='yes') : diff --git a/classes/gateways/gateway-paypal.php b/classes/gateways/gateway-paypal.php index a20a7e12ff0..6b8e07e5aec 100644 --- a/classes/gateways/gateway-paypal.php +++ b/classes/gateways/gateway-paypal.php @@ -290,7 +290,10 @@ class woocommerce_paypal extends woocommerce_payment_gateway { $_POST['cmd'] = '_notify-validate'; // Send back post vars to paypal - $params = array( 'body' => $_POST ); + $params = array( + 'body' => $_POST, + 'sslverify' => false + ); // Get url if ( $this->testmode == 'yes' ): diff --git a/readme.txt b/readme.txt index d557fbfe463..086d9213c5e 100644 --- a/readme.txt +++ b/readme.txt @@ -82,6 +82,11 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo == Changelog == += 1.2.1 = +* Signup/login can be turned off for checkout +* Paypal remote post now has 'sslverify' => false to prevent errors with CURL +* Minor admin settings tidyup + = 1.2 - 03/11/2011 = * Added quick status change buttons (processing/complete) to orders panel * Ability to preview email templates diff --git a/templates/checkout/form.php b/templates/checkout/form.php index 3cf3b29717b..3f09883eba8 100644 --- a/templates/checkout/form.php +++ b/templates/checkout/form.php @@ -2,6 +2,12 @@ global $woocommerce; +// If checkout registration is disabled and not logged in, the user cannot checkout +if (get_option('woocommerce_enable_signup_and_login_from_checkout')=="no" && get_option('woocommerce_enable_guest_checkout')=="no" && !is_user_logged_in()) : + echo apply_filters('woocommerce_checkout_must_be_logged_in_message', __('You must be logged in to checkout.', 'woothemes')); + return; +endif; + // filter hook for include new pages inside the payment method $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', $woocommerce->cart->get_checkout_url() ); ?> diff --git a/woocommerce_template_functions.php b/woocommerce_template_functions.php index f142ac07cef..e1537dafed0 100644 --- a/woocommerce_template_functions.php +++ b/woocommerce_template_functions.php @@ -807,7 +807,11 @@ if (!function_exists('woocommerce_checkout_login_form')) { if (is_user_logged_in()) return; - ?>