From: Chuck Scott Date: Thu, 2 Nov 2017 20:58:11 +0000 (-0400) Subject: Fixed bill_state and bill_country in dataAccount.php. X-Git-Tag: v1.0.0^2~298 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=0bde54341f1ce390a45b17b09a3705ef4af5df60;p=WP-Plugins%2Fglm-member-db-registrations.git Fixed bill_state and bill_country in dataAccount.php. Fixed cc_type field in dataRegRequest.php. Fixed undefined referernce to glm_reg_card_id in regCartSummary() when no data supplied. Added field data for credit card data in checkout.php and deselecting types not selected. Added radio buttons for enabled payment methods. --- diff --git a/classes/data/dataAccount.php b/classes/data/dataAccount.php index 40d3d4c..77c7518 100644 --- a/classes/data/dataAccount.php +++ b/classes/data/dataAccount.php @@ -319,12 +319,13 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'use' => 'a' ), - // + // Bill State 'bill_state' => array ( - 'field' => 'bill_state', - 'type' => 'text', - 'required' => false, - 'use' => 'a' + 'field' => 'bill_state', + 'type' => 'list', + 'list' => $this->config['states'], + 'default' => $this->config['settings']['default_state'], + 'use' => 'a' ), // @@ -335,12 +336,13 @@ class GlmDataRegistrationsAccount extends GlmDataAbstract 'use' => 'a' ), - // + // Country 'bill_country' => array ( - 'field' => 'bill_country', - 'type' => 'text', - 'required' => false, - 'use' => 'a' + 'field' => 'bill_country', + 'type' => 'list', + 'list' => $this->config['countries'], + 'default' => 'US', + 'use' => 'a' ), // diff --git a/classes/data/dataRegRequest.php b/classes/data/dataRegRequest.php index ddb82b3..fe1eec1 100644 --- a/classes/data/dataRegRequest.php +++ b/classes/data/dataRegRequest.php @@ -281,8 +281,8 @@ class GlmDataRegistrationsRegRequest extends GlmDataAbstract // Credit Card type (if used) - See credit_card in plugin.ini 'cc_type' => array ( 'field' => 'cc_type', - 'type' => 'bitmap', - 'bitmap' => $this->config['credit_card'], + 'type' => 'list', + 'list' => $this->config['credit_card'], 'default' => 0, // none selected 'use' => 'a' ), diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index fc89a13..f0349d7 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -974,7 +974,7 @@ class GlmRegCartSupport { // If we haven't been supplied a request (cart) ID - if (!$requestId) { + if (!$requestId && isset($_SESSION) && isset($_SESSION['glm_reg_cart_id'])) { // Try to get the ID from the current session $requestId = $_SESSION['glm_reg_cart_id']; diff --git a/models/front/registrations/checkout.php b/models/front/registrations/checkout.php index 752088b..907812a 100644 --- a/models/front/registrations/checkout.php +++ b/models/front/registrations/checkout.php @@ -111,9 +111,9 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport $view = 'checkout'; - if ($cartId) { + if ($haveCart) { - // Try to get a Validate cart with updated totals + // Try to validate the cart with updated totals $this->checkRegistrationRequest($cartId); } @@ -140,6 +140,29 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport } + // Setup credit cart input fields - Use dataRegRequest to generate the field data + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config); + $regReq = $RegRequest->newEntry(); + + // Drop cards that are not currently selected in management + $cc_type = $regReq['fieldData']['cc_type']; + foreach ($cc_type['list'] as $k=>$v) { + $bitValue = pow(2,$k); + if (!($this->config['settings']['reg_cc_accepts'] & $bitValue)) { + unset($cc_type['list'][$k]); + } + } + + // Add credit card field data to $regAccount['fieldData'] for use on form + $regAccount['fieldData']['cc_type'] = $cc_type; + $regAccount['fieldData']['cc_name'] = $regReq['fieldData']['cc_name']; + $regAccount['fieldData']['cc_numb'] = $regReq['fieldData']['cc_numb']; + $regAccount['fieldData']['cc_exp'] = $regReq['fieldData']['cc_exp']; + $regAccount['fieldData']['cc_cvv'] = $regReq['fieldData']['cc_cvv']; + $regAccount['fieldData']['cc_conf'] = $regReq['fieldData']['cc_conf']; +// *** If redirected back, be sure to get the submitted data + // Accounts list not needed unset($this->cart['accounts']); diff --git a/views/front/registrations/checkout.html b/views/front/registrations/checkout.html index f048966..549d72d 100644 --- a/views/front/registrations/checkout.html +++ b/views/front/registrations/checkout.html @@ -81,7 +81,7 @@ {foreach $regAccount.fieldData.country.list as $c} - {/foreach} @@ -135,10 +135,10 @@ @@ -152,7 +152,7 @@ {$payMethods.{$payMethodsNumb.NoCharge}.name} +
{$payMethods.{$payMethodsNumb.NoCharge}.name}
+ {/if} + {if $payMethods.{$payMethodsNumb.CompCode}.default} +
{$payMethods.{$payMethodsNumb.CompCode}.name}
+ {/if} + {if $payMethods.{$payMethodsNumb.Cash}.default} +
{$payMethods.{$payMethodsNumb.Cash}.name}
+ {/if} + {if $payMethods.{$payMethodsNumb.Check}.default} +
{$payMethods.{$payMethodsNumb.Check}.name}
+ {/if} + {if $payMethods.{$payMethodsNumb.CallFromMerchant}.default} +
{$payMethods.{$payMethodsNumb.CallFromMerchant}.name}
{/if} {if $payMethods.{$payMethodsNumb.CreditCard}.default} -
{$payMethods.{$payMethodsNumb.CreditCard}.name}
+
{$payMethods.{$payMethodsNumb.CreditCard}.name}
Card Type:
-
+
+ +
Name on Card:
@@ -198,16 +219,14 @@
CVV:
-<<<<<<< Updated upstream -
-=======
{/if} {if $payMethods.{$payMethodsNumb.PayPal}.default} -
{$payMethods.{$payMethodsNumb.PayPal}.name}
+
{$payMethods.{$payMethodsNumb.PayPal}.name}
{/if} - ->>>>>>> Stashed changes + + +

Global Custom Fields Go Here