• Resolved edeb

    (@edeb)


    Hello there,

    here is another issue for my particular marketplace. I’d like to submit products in a way that all my formData will be sent to a ajax function.

    Where can I look to recreate the $_POST variables and create products with this system.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author WC Lovers

    (@wclovers)

    @edeb

    Thanks for get in touch.

    WCfM all data submission works via AJAX, but not using $_POST. But you still can get all data as per your requirement.

    For Products, you may use “after_wcfm_products_manage_meta_save” hook to do your additional work. It will give you two parameter – Added/Updated product ID and Total Product form data.

    For more assistance you may even check our core files – “wc-frontend-manager/controllers/wcfm-controller-products-manage.php”

    If you still have any query please free to share with us anytime.

    Thank You

    Thread Starter edeb

    (@edeb)

    Ok perfect! And Can you suggest a way to integrate the “add product form” in a sliding panel?

    I mean, I understood there isn’t a way to use shortcodes but you can suggest a method to achieve this. Structure would be:

    – Link trigger sliding panel
    – Sliding pane load the “add product form”
    – I submit and data are sent through AJAX

    Please can you give me some direction.
    How would you create something like that? (In a general manner).

    Thanks

    Plugin Author WC Lovers

    (@wclovers)

    @edeb

    We can provide you code snippet to convert all our endpoints into short code, is this will help for you anyway!!

    Actually after your recomendation we have already started working on that but not yet part of our core module, will be integrated soon.

    One thing I have to mention, when short code will rendered – JS/CSS will be also include in the page, you have to dequeue those to write your own ajax.

    Thank You

    Thread Starter edeb

    (@edeb)

    Yes, please! Could you provide my at least the code snippet just for the add product function? Yes! Not a problem to write js/css by myself.

    Toooop!
    Thanks.

    Plugin Author WC Lovers

    (@wclovers)

    Hi @edeb,

    Short codes should be like: [wcfm page=”end point name”]

    Here is the code, may use from other plugin or child theme functions.php as well,

    // WC Frontend Manager Endpoint as Shortcode

    add_shortcode('wcfm', 'wcfm_endpoint_shortcode');
    
    function wcfm_endpoint_shortcode( $attr ) {
    	global $WCFM, $wp, $WCFM_Query;
    	
    	if( $WCFM && $WCFM_Query ) {
    	
    		$WCFM->nocache();
    		
    		echo '<div id="wcfm-main-contentainer"> <div id="wcfm-content">';
    		
    		if ( !isset( $attr['page'] ) || ( isset( $attr['page'] ) && empty( $attr['page'] ) ) ) {
    			
    			// Load Scripts
    			$WCFM->library->load_scripts( 'wcfm-dashboard' );
    			
    			// Load Styles
    			$WCFM->library->load_styles( 'wcfm-dashboard' );
    			
    			// Load View
    			$WCFM->library->load_views( 'wcfm-dashboard' );
    		} else {
    			$wcfm_endpoints = $WCFM_Query->get_query_vars();
    			
    			foreach ( $wcfm_endpoints as $key => $value ) {
    				if ( isset( $attr['page'] ) && !empty( $attr['page'] ) && ( $key == $attr['page'] ) ) {
    					// Load Scripts
    					$WCFM->library->load_scripts( $key );
    					
    					// Load Styles
    					$WCFM->library->load_styles( $key );
    					
    					// Load View
    					$WCFM->library->load_views( $key );
    				}
    			}
    		}
    		
    		echo '</div></div>';
    	}
    }

    This will be part of WCfM next update as well.

    Thank You

    Plugin Author WC Lovers

    (@wclovers)

    Hi @edeb,

    WCfM 2.4.1 just released.

    It integrated with Short code support.
    We have changed our short code format a bit.
    Here is the updated one:
    [wcfm endpoint="end point name"]

    For further assistance you may check our developers guide as well.
    http://wclovers.com/documentation/developers-guide/

    Thank You

    Thread Starter edeb

    (@edeb)

    This sounds like a bomb!
    Thank you very much.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Submit product through Ajax.’ is closed to new replies.