@@ -258,57 +258,58 @@ function kkd_pff_paystack_editor_add_extra_metaboxes() {
258258 add_meta_box ('kkd_pff_paystack_editor_add_form_data ' , 'Extra Form Description ' , 'kkd_pff_paystack_editor_add_form_data ' , 'paystack_form ' , 'normal ' , 'default ' );
259259 add_meta_box ('kkd_pff_paystack_editor_add_recur_data ' , 'Recurring Payment ' , 'kkd_pff_paystack_editor_add_recur_data ' , 'paystack_form ' , 'side ' , 'default ' );
260260 add_meta_box ('kkd_pff_paystack_editor_add_email_data ' , 'Email Receipt Settings ' , 'kkd_pff_paystack_editor_add_email_data ' , 'paystack_form ' , 'normal ' , 'default ' );
261-
261+ add_meta_box ('kkd_pff_paystack_editor_add_quantity_data ' , 'Quantity Payment ' , 'kkd_pff_paystack_editor_add_quantity_data ' , 'paystack_form ' , 'side ' , 'default ' );
262+
262263 }
263264
264265
265266 function kkd_pff_paystack_editor_add_form_data () {
266- global $ post ;
267-
268- // Noncename needed to verify where the data originated
269- echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value=" ' .
270- wp_create_nonce ( plugin_basename (__FILE__ ) ) . '" /> ' ;
271-
272- // Get the location data if its already been entered
273- $ amount = get_post_meta ($ post ->ID , '_amount ' , true );
274- $ paybtn = get_post_meta ($ post ->ID , '_paybtn ' , true );
275- $ successmsg = get_post_meta ($ post ->ID , '_successmsg ' , true );
276- $ txncharge = get_post_meta ($ post ->ID , '_txncharge ' , true );
277- $ loggedin = get_post_meta ($ post ->ID , '_loggedin ' , true );
278- $ currency = get_post_meta ($ post ->ID , '_currency ' , true );
279- $ filelimit = get_post_meta ($ post ->ID , '_filelimit ' , true );
280-
281- if ($ amount == "" ) {$ amount = 0 ;}
282- if ($ filelimit == "" ) {$ filelimit = 2 ;}
283- if ($ paybtn == "" ) {$ paybtn = 'Pay ' ;}
284- if ($ successmsg == "" ) {$ successmsg = 'Thank you for paying! ' ;}
285- if ($ currency == "" ) {$ currency = 'NGN ' ;}
286- if ($ txncharge == "" ) {$ txncharge = 'merchant ' ;}
287- // Echo out the field
288- echo '<p>Currency:</p> ' ;
289- echo '<input type="text" name="_currency" value=" ' . $ currency . '" class="widefat" />
290- <small>We currently support only payments in Naira(NGN).</small> ' ;
291- echo '<p>Amount to be paid(Set 0 for customer input):</p> ' ;
292- echo '<input type="number" name="_amount" value=" ' . $ amount . '" class="widefat pf-number" /> ' ;
293- echo '<p>Pay button Description:</p> ' ;
294- echo '<input type="text" name="_paybtn" value=" ' . $ paybtn . '" class="widefat" /> ' ;
295- echo '<p>Transaction Charges:</p> ' ;
296- echo '<select class="form-control" name="_txncharge" id="parent_id" style="width:100%;">
297- <option value="merchant" ' .kkd_pff_paystack_txncheck ('merchant ' ,$ txncharge ).'>Merchant Pays(Include in fee)</option>
298- <option value="customer" ' .kkd_pff_paystack_txncheck ('customer ' ,$ txncharge ).'>Client Pays(Extra Fee added) - 1.55%+ NGN100 if above NGN2,500 </option>
299- </select> ' ;
300- echo '<p>User logged In:</p> ' ;
301- echo '<select class="form-control" name="_loggedin" id="parent_id" style="width:100%;">
302- <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ loggedin ).'>User must not be logged in</option>
303- <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' ,$ loggedin ).'>User must be logged In</option>
304- </select> ' ;
305- echo '<p>Success Message after Payment</p> ' ;
306- echo '<textarea rows="3" name="_successmsg" class="widefat" > ' .$ successmsg .'</textarea> ' ;
307- echo '<p>File Upload Limit(MB):</p> ' ;
308- echo '<input ttype="number" name="_filelimit" value=" ' . $ filelimit . '" class="widefat pf-number" /> ' ;
267+ global $ post ;
268+
269+ // Noncename needed to verify where the data originated
270+ echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value=" ' .
271+ wp_create_nonce ( plugin_basename (__FILE__ ) ) . '" /> ' ;
272+
273+ // Get the location data if its already been entered
274+ $ amount = get_post_meta ($ post ->ID , '_amount ' , true );
275+ $ paybtn = get_post_meta ($ post ->ID , '_paybtn ' , true );
276+ $ successmsg = get_post_meta ($ post ->ID , '_successmsg ' , true );
277+ $ txncharge = get_post_meta ($ post ->ID , '_txncharge ' , true );
278+ $ loggedin = get_post_meta ($ post ->ID , '_loggedin ' , true );
279+ $ currency = get_post_meta ($ post ->ID , '_currency ' , true );
280+ $ filelimit = get_post_meta ($ post ->ID , '_filelimit ' , true );
281+
282+ if ($ amount == "" ) {$ amount = 0 ;}
283+ if ($ filelimit == "" ) {$ filelimit = 2 ;}
284+ if ($ paybtn == "" ) {$ paybtn = 'Pay ' ;}
285+ if ($ successmsg == "" ) {$ successmsg = 'Thank you for paying! ' ;}
286+ if ($ currency == "" ) {$ currency = 'NGN ' ;}
287+ if ($ txncharge == "" ) {$ txncharge = 'merchant ' ;}
288+ // Echo out the field
289+ echo '<p>Currency:</p> ' ;
290+ echo '<input type="text" name="_currency" value=" ' . $ currency . '" class="widefat" />
291+ <small>We currently support only payments in Naira(NGN).</small> ' ;
292+ echo '<p>Amount to be paid(Set 0 for customer input):</p> ' ;
293+ echo '<input type="number" name="_amount" value=" ' . $ amount . '" class="widefat pf-number" /> ' ;
294+ echo '<p>Pay button Description:</p> ' ;
295+ echo '<input type="text" name="_paybtn" value=" ' . $ paybtn . '" class="widefat" /> ' ;
296+ echo '<p>Transaction Charges:</p> ' ;
297+ echo '<select class="form-control" name="_txncharge" id="parent_id" style="width:100%;">
298+ <option value="merchant" ' .kkd_pff_paystack_txncheck ('merchant ' ,$ txncharge ).'>Merchant Pays(Include in fee)</option>
299+ <option value="customer" ' .kkd_pff_paystack_txncheck ('customer ' ,$ txncharge ).'>Client Pays(Extra Fee added) - 1.55%+ NGN100 if above NGN2,500 </option>
300+ </select> ' ;
301+ echo '<p>User logged In:</p> ' ;
302+ echo '<select class="form-control" name="_loggedin" id="parent_id" style="width:100%;">
303+ <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ loggedin ).'>User must not be logged in</option>
304+ <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' ,$ loggedin ).'>User must be logged In</option>
305+ </select> ' ;
306+ echo '<p>Success Message after Payment</p> ' ;
307+ echo '<textarea rows="3" name="_successmsg" class="widefat" > ' .$ successmsg .'</textarea> ' ;
308+ echo '<p>File Upload Limit(MB):</p> ' ;
309+ echo '<input ttype="number" name="_filelimit" value=" ' . $ filelimit . '" class="widefat pf-number" /> ' ;
309310
310311 }
311- function kkd_pff_paystack_editor_add_email_data () {
312+ function kkd_pff_paystack_editor_add_email_data () {
312313 global $ post ;
313314
314315 // Noncename needed to verify where the data originated
@@ -339,7 +340,7 @@ function kkd_pff_paystack_editor_add_email_data() {
339340 echo '<textarea rows="6" name="_message" class="widefat" > ' .$ message .'</textarea> ' ;
340341
341342 }
342- function kkd_pff_paystack_editor_add_recur_data () {
343+ function kkd_pff_paystack_editor_add_recur_data () {
343344 global $ post ;
344345
345346 // Noncename needed to verify where the data originated
@@ -363,8 +364,32 @@ function kkd_pff_paystack_editor_add_recur_data() {
363364 echo '<input type="text" name="_recurplan" value=" ' . $ recurplan . '" class="widefat" />
364365 <small>Plan amount must match amount on extra form description.</small> ' ;
365366
366- }
367- function kkd_pff_paystack_save_data ($ post_id , $ post ) {
367+ }
368+ function kkd_pff_paystack_editor_add_quantity_data () {
369+ global $ post ;
370+
371+ // Noncename needed to verify where the data originated
372+ echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value=" ' .
373+ wp_create_nonce ( plugin_basename (__FILE__ ) ) . '" /> ' ;
374+
375+ // Get the location data if its already been entered
376+ $ usequantity = get_post_meta ($ post ->ID , '_usequantity ' , true );
377+ $ quantity = get_post_meta ($ post ->ID , '_quantity ' , true );
378+
379+ if ($ usequantity == "" ) {$ usequantity = 'no ' ;}
380+ if ($ quantity == "" ) {$ quantity = '10 ' ;}
381+ // Echo out the field
382+ echo '<small>Allow your users pay in multiple quantity</small><p>Quantity Payment:</p> ' ;
383+ echo '<select class="form-control" name="_usequantity" style="width:100%;">
384+ <option value="no" ' .kkd_pff_paystack_txncheck ('no ' ,$ usequantity ).'>No</option>
385+ <option value="yes" ' .kkd_pff_paystack_txncheck ('yes ' ,$ usequantity ).'>Yes</option>
386+ </select> ' ;
387+ echo '<p>Paystack Recur Plan code:</p> ' ;
388+ echo '<input type="text" name="_quantity" value=" ' . $ quantity . '" class="widefat pf-number" />
389+ <small>Your users only get to pay in quantities if the from amount is not set to zero and recur is set to none.</small> ' ;
390+
391+ }
392+ function kkd_pff_paystack_save_data ($ post_id , $ post ) {
368393
369394 if ( !wp_verify_nonce ( @$ _POST ['eventmeta_noncename ' ], plugin_basename (__FILE__ ) )) {
370395 return $ post ->ID ;
@@ -390,6 +415,8 @@ function kkd_pff_paystack_save_data($post_id, $post) {
390415 ///
391416 $ form_meta ['_recur ' ] = $ _POST ['_recur ' ];
392417 $ form_meta ['_recurplan ' ] = $ _POST ['_recurplan ' ];
418+ $ form_meta ['_usequantity ' ] = $ _POST ['_usequantity ' ];
419+ $ form_meta ['_quantity ' ] = $ _POST ['_quantity ' ];
393420
394421 // Add values of $form_meta as custom fields
395422
0 commit comments