Home Forums WC Vendors Pro Support How to change type of field in product submission?

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 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #58661
    Pablo
    Participant

    Hi,

    In the Add Product page I would like to change Title field (which is text right now), to a Date Picker (and if possible also to add time picker). So that for a product Title over a marketplace it uses a date (and time) defined in submission. (I know it may sound weird but I’m building event system, so outputting Date and Time is only important within a product).

    Would appreciate any help.

    Thanks.

    #58714
    Pablo
    Participant

    Can anyone help with a suggestion on how to achieve this?

    #58722
    Jamie
    Keymaster

    Hello,

    This code will do what you require.

    https://gist.github.com/digitalchild/202ee1ef2cafce023d316a9eb56c7d68

    cheers,

    Jamie.

    #58730
    Pablo
    Participant

    Thanks a lot Jamie! I would also like to change “Short Description” text field to hours field(Dropdown of 24 hours would work). I can see the pattern but how would I go with adding a dropdown of values instead of a text in “Short Description”?

    #58742
    Anna
    Member

    Hello,
    Rather than replacing the short description, you can add a form with your array options (hours), using the select form type, such as this:
    https://github.com/wcvendors/wc-vendors-pro-simple-auctions/blob/master/class-wcv-simple-auctions.php#L256-L267

    I suppose you could also change the short description to the select form, but it may actually be easier to add this select.

    #58762
    Pablo
    Participant

    Hi Anna thanks for this.
    Well I need to showcase hours field on a Woocommerce’s product card, so right now only title, short description, quantity and price are being showcased. That’s why I want to convert short description text field into a dropdown/hours field.

    #58821
    Pablo
    Participant

    Hi,

    So I added this to functions.php but no dropdown has been shown on short_description field:

    add_filter( 'wcv_short_description', 'short_description_hours' ); 
    function short_description_hours( $args ){ 
    	$args[ 'class' ] = 'wcv-select2'; 
    	return $args; 
    }
    #58866
    Anna
    Member

    @pafly
    For the select form- have your built the form?
    Where is the rest of the code for the select2 form?
    You’d need to build the form similar to the section in the github file I linked above.. the replace the short description with that form.
    If you find that you need assistance with further custom work, we do recommend getting a quote from the developers at codeable.io

    #58886
    Pablo
    Participant

    I didn’t understand where should I place the code you’ve provided? Thanks.

    #58899
    Anna
    Member

    Pablo,
    You can use this gist as a guide for your drop-down with hours.
    I recommend that you first make the select2 form in your product-edit.php as I have shown in the gist. Just change the options to your hours, and change the ID of the form to what you need.
    Instead of trying to override the short description, try just creating this form first.
    The second piece of code goes in your functions.php. Make sure the ID in the second piece of code matches the ID in the first code that was put into your product-edit.php

    Start there to see if you can get the form working first. THEN see if you can find a way to have your form replace the short description.

    https://gist.github.com/fervous/048b04a4a73cde43fd77b34405917f54#file-product-edit-php-and-functions-php

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