• Resolved WP-Henne

    (@wp-henne)


    Hello!

    I’d like to use price on negotiation basis for some entries.
    This is at the moment only possible by using “negotiable” as default at settings-page. When adding an item, only numbers are allowed.

    Would it be possible to switch off the number check in the general settings so that words are also permitted instead of numbers as the amount?

    I would like to mention that a space is required between the currency symbol Euro (€) and the amount.

    Thank You!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,

    you can disable the price formatting in the Price field by adding the code below in your theme functions.php file

    
    add_filter( "adverts_form_load", "disable_currencies_form_load" );
    function disable_currencies_form_load( $form ) {
        if( $form['name'] != "advert" ) {
            return $form;
        }
        foreach( $form["field"] as $key => $field ) {
            if( $field["name"] == "adverts_price" ) {
                $form["field"][$key]["attr"]["placeholder"] = "e.g. 100.00";
                $form["field"][$key]["class"] = "";
                $form["field"][$key]["filter"] = array();
                $form["field"][$key]["validator"] = array();
            }
        }
        return $form;
    }
    add_filter( "adverts_get_the_price", "disable_currencies_price", 10, 2 );
    function disable_currencies_price( $price_formatted, $price ) {
        return $price;
    }

    After inserting this code snippet what users will enter in the price field will be also what they will see on the Ads list and details pages.

    Thread Starter WP-Henne

    (@wp-henne)

    Hello @gwin

    Thank You so much!

    Have a nice day

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Numeric price field Negotiable’ is closed to new replies.