Home Forums WC Vendors Free Support Choose Product Category Using the Front End for New Product Submissions

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #589
    kyriakosdz
    Participant

    Hi to All
    First of all Jamie and Ben many thanks and my congratulations for this new effort!
    Now going to my question. I am using the WPUF Pro plugin and have followed your instructions on how to Use the Front End for New Product Submissions. Everything OK.
    Because I had many product categories I wanted to have the product category pre-selected and give it as a url parameter to the form I have created and then use the code below to pass the variable. I have used the code Jamie provided on Matt Gates Plugin but instead of using $_POST I have used $_GET. I was able to pass the product category using a hidden field but what I wanted was to pass it through the URL Parameter. I am using a jquey script that is Dynamicaly Cascading Dependent Drop Down and dropdown redirect http://www.jqueryscript.net/demo/Dynamic-jQuery-Cascading-Dropdown-Lists-Plugin/.

    I do not want to create hundred of forms, one for each product category. So I wanted to pass the product category as an input.
    Below is the script I used(I have changed the $_POST into $_GET and have added a url parameter ‘product_categories’

    function wpuf_update_hidden_categories($post_id) {
    // $cats = $_POST[‘product_categories’];
    $cats = $_GET[‘product_categories’];
    $categories = array_map(‘intval’, explode (‘,’, $cats));
    wp_set_object_terms( $post_id, $categories, ‘product_cat’);
    // Optional to clean up the database (deletes the hidden field data after converting it into object terms)
    delete_post_meta( $post_id, ‘product_categories’, $_POST[‘product_categories’] );
    } add_action( ‘wpuf_add_post_after_insert’, ‘wpuf_update_hidden_categories’ );
    add_action( ‘wpuf_edit_post_after_update’, ‘wpuf_update_hidden_categories’ );

    Is not working though. Any suggestions?

    #590
    WC Vendors Support
    Participant

    I believe you would just set the categories as a hidden field right in the WPUF form?

    #592
    kyriakosdz
    Participant

    If I set the categories as a hidden field I put the Meta Key ‘product_categories’ and a meta value a fix value(the product categories sernos). This though is forcing me to create for each product category a new form, right? Is there a way to add inside a meta value a variable instead and not a fixed value?

    #598
    WC Vendors Support
    Participant

    I’m really not sure. The folks at wedevs.com can probably get you the right answer. When you find it, post it here and I’ll update the knowledgebase article with the howto!

    Ben

    #701
    kyriakosdz
    Participant

    The new version of wpuf is supporting this. If you have lots of categories and sub categories, you can use the Ajax categories type. It will show you the parent categories first and will show the child after selecting the parent. But remember, this Ajax only works if the user is logged in.

    #712
    WC Vendors Support
    Participant

    Thanks for the report back! Ajax should always work, because if the user isnt logged in as a vendor, they shouldnt be seeing the add product pages anyway. You should be safe with that regards.

    In some WPUF installations — unrelated to WC Vendors — Sites would allow “guests” to post blog articles and such, that’s the reason for that limitation probably.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘WC Vendors Free Support’ is closed to new topics and replies.