Support

Account

Home Forums Front-end Issues Front End Form PayPal

Solving

Front End Form PayPal

  • I found this old support article: http://old.support.advancedcustomfields.com/discussion/1885/paypal-item-field/p1

    I am not sure how old it is, but I was trying to incorporate the paypal_item.php file with the 4.0 build of acf. Is this still supported or is there any plan on making this compatible? I can’t find much on it besides that one page.

    Thanks!

  • Hi @caputodesignz

    I’m not 100% sure. Perhaps you could contact the developer of the add-on?

  • Hi @caputodesignz

    Here it is:

    https://github.com/mikerodriguez/acf-paypal-field

    You’ll also be able to find the add-on inside of WordPress plugin repo once it’s approved.

    please report any bugs for v4, if found.

    Thanks!

  • @elliot

    Can you add the PayPal field to the “Add-ons” page?

    I’ve attached a .zip, with a thumbnail, screenshots, and the readme.

    Plugin can be downloaded here for now: https://github.com/mikerodriguez/acf-paypal-field

    Thanks mate!

  • Thanks Mike for the link. I am trying to install this directly into my theme. I have the folder in my theme folder and have pointed to the correct path. I am using this in the functions.php:

    
    //ACF PayPal 
    	add_action('acf/register_fields', 'my_register_fields');
    	
    	function my_register_fields()
    	{
    	    include_once('add-ons/acf-paypal-field-master/acf-paypal.php');
    	}
    

    That is the right directory. I get no errors but the PayPal option does not show up when selecting a field type. Any ideas?

  • @caputodesignz

    try pointing to the v4 file instead. LMK if it works.

    
    add_action('acf/register_fields', 'my_register_fields');
    
    function my_register_fields()
    {
    	include_once('add-ons/acf-paypal-field-master/paypal_item-v4.php');
    }
    
  • Yes that finally got the option to show up but above each PayPal option it has undefined errors like this:

    
    Notice: Undefined index: paypal_email in /home/caputode/public_html/job-hunter/wp-content/themes/jobhunter/add-ons/acf-paypal-field-master/paypal_item-v4.php on line 84
    
  • I’ve tested this, and it works correctly on my end.

    Are you using the ACF plugin within your theme or do you have it installed via the plugins page?

  • It is within the theme not as a plugin.

  • Just tested it and I can confirm it’s working within the theme and on ACF Lite mode as well.

    What version of ACF are you using?

  • I just rolled back to version 4.1.5.1 and tested it on lite mode, as well as including the paypal plugin in my theme and the field group in my functions.php file. Everything checkouts fine.

    can you copy your functions.php file includes of just the plugin on here? I’d like to help you debug this!

  • Thanks Mike, I appreciate it! Here is all the code in my functions.php relating to acf:

     
    // custom action for saving the front end form
    	function my_pre_save_post( $post_id )
    	{
    	    // check if this is to be a new post
    	    if( $post_id != 'new' )
    	    {
    	        return $post_id;
    	    }
    	 
    	    // Create a new post
    	    $post = array(
    	        'post_status'  => 'draft' ,
    	        'post_title'  => $_POST['title'],
    	        'tax_input'     => array('job-category' => $_POST['job-category']),
    	        'post_type'  => 'jobs_post' ,
    	    );  
    	 
    	    // insert the post
    	    $post_id = wp_insert_post( $post ); 
    	 
    	 	// now set the taxonomy
    	 	wp_set_object_terms($post_id, array($_POST['job-category']), 'job-category');
    //	 	wp_set_object_terms($post_id, array($_POST['salary-range']), 'salary-range');
    	 
    	    // return the new ID
    	    return $post_id;
    	}
    	add_filter('acf/pre_save_post' , 'my_pre_save_post' );
    	
    	//ACF PayPal 
    	add_action('acf/register_fields', 'my_register_fields');
    	
    	function my_register_fields()
    	{
    	    include_once('add-ons/acf-paypal-field-master/paypal_item-v4.php');
    	}
    	
    	//Rename Options Menu ACF	
    	function my_acf_options_page_settings( $settings )
    	{
    		$settings['title'] = 'Theme Options';
    		$settings['pages'] = array('Email', 'Google AdSense', 'Google Analytics', 'Logo', 'Theme Colors');
    	 
    		return $settings;
    	}
    	 
    	add_filter('acf/options_page/settings', 'my_acf_options_page_settings');	
    	//end
    
    	include_once('add-ons/advanced-custom-fields/acf.php');
    	include_once('add-ons/acf-location-field-master/acf-location.php');
    	include_once('add-ons/acf-repeater/acf-repeater.php');
    	include_once('add-ons/acf-options-page/acf-options-page.php');
    	include_once('add-ons/acf-taxonomy-field-master/taxonomy-field.php');
    
    	require ( get_template_directory() . '/add-ons/custom-widgets.php' );
    	require ( get_template_directory() . '/add-ons/custom-form.php' );
    
  • Let’s start by trying include the PayPal field last.

    
    
    // custom action for saving the front end form
    	function my_pre_save_post( $post_id )
    	{
    	    // check if this is to be a new post
    	    if( $post_id != 'new' )
    	    {
    	        return $post_id;
    	    }
    	 
    	    // Create a new post
    	    $post = array(
    	        'post_status'  => 'draft' ,
    	        'post_title'  => $_POST['title'],
    	        'tax_input'     => array('job-category' => $_POST['job-category']),
    	        'post_type'  => 'jobs_post' ,
    	    );  
    	 
    	    // insert the post
    	    $post_id = wp_insert_post( $post ); 
    	 
    	 	// now set the taxonomy
    	 	wp_set_object_terms($post_id, array($_POST['job-category']), 'job-category');
    //	 	wp_set_object_terms($post_id, array($_POST['salary-range']), 'salary-range');
    	 
    	    // return the new ID
    	    return $post_id;
    	}
    	add_filter('acf/pre_save_post' , 'my_pre_save_post' );
    	
    	//Rename Options Menu ACF	
    	function my_acf_options_page_settings( $settings )
    	{
    		$settings['title'] = 'Theme Options';
    		$settings['pages'] = array('Email', 'Google AdSense', 'Google Analytics', 'Logo', 'Theme Colors');
    	 
    		return $settings;
    	}
    	 
    	add_filter('acf/options_page/settings', 'my_acf_options_page_settings');	
    	//end
    
    	include_once('add-ons/advanced-custom-fields/acf.php');
    	include_once('add-ons/acf-location-field-master/acf-location.php');
    	include_once('add-ons/acf-repeater/acf-repeater.php');
    	include_once('add-ons/acf-options-page/acf-options-page.php');
    	include_once('add-ons/acf-taxonomy-field-master/taxonomy-field.php');
    
    	require ( get_template_directory() . '/add-ons/custom-widgets.php' );
    	require ( get_template_directory() . '/add-ons/custom-form.php' );
    
    //ACF PayPal 
    	add_action('acf/register_fields', 'my_register_fields');
    	
    	function my_register_fields()
    	{
    	    include_once('add-ons/acf-paypal-field-master/paypal_item-v4.php');
    	}
    
    
  • @caputodesignz

    Try re-downloading the plugin from github. I made a slight change. Let me know if that fixes the issue.

    https://github.com/mikerodriguez/acf-paypal-field

  • It moved where the PayPal buttons shows up but same errors underneath.

  • @caputodesignz

    try re-downloading again please.

  • Ok now we are getting somewhere! Only 1 error left. Next to Button Label there is this:

    
    Notice: Undefined index: button_label in /home/caputode/public_html/job-hunter/wp-content/themes/jobhunter/add-ons/acf-paypal-field-master/paypal_item-v4.php on line 106
    

    The rest of the errors are gone.

  • @caputodesignz

    Thanks, I appreciate your help on debugging this. Re-download the plugin and the error should be gone. Please mark this as solved.

    Thanks again

  • Thanks Mike that did it!

    And in the future, it would be a really cool feature if this plugin could like up to a front end form. So you could set up a pay to post form using PayPal. But hey that’s me just being greedy, haha. Thanks again.

  • @caputodesignz

    Thanks. The front end form feature would be cool. I’ll be working on it in the near future along with support for PayPal Advanced and Pro as well.

  • @mikerodriguez

    Did you manage to get the Front End feature setup?

    I am currently looking for a solution that users can fill out the front end form, which will ask for payment via PayPal and then create a post (custom post type).

    Do you think you’re plugin will help with the PayPal side of things?

  • I’m looking for exactly the same thing….. any news on a solution?

Viewing 25 posts - 1 through 25 (of 25 total)

The topic ‘Front End Form PayPal’ is closed to new replies.