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

    (@gwin)

    If you would like the Price field to behave like a normal text field in the [adverts_add] shortcode then you can add the code below in your theme functions.php file it should do it.

    
    add_filter( "adverts_form_load", "customize_adverts_add" );
    function customize_adverts_add( $form ) {
      if( $form['name'] != "advert" ) {
        return $form;
      }
      foreach( $form["field"] as $key => $field ) {
        if( $field["name"] == "adverts_price" ) {
            $form["field"][$key]["class"] = "";
            $form["field"][$key]["filter"] = array();
        }
      }
      return $form;
    }
    
    Thread Starter spike210957

    (@spike210957)

    Brilliant Greg thanks! I love this plugin so flexible.

    Thread Starter spike210957

    (@spike210957)

    And if I could have the same behaviour adding an Advert via the dashboard I would be in seventh heaven!

    Plugin Author Greg Winiarski

    (@gwin)

    Currently, to change that in wp-admin you would need to open file wpadverts/assests/js/adverts-admin.js go to line about 191

    
    $("#adverts_price").autoNumeric('init', adverts_currency);
    

    and change it to

    
    $(".adverts-filter-money").autoNumeric('init', adverts_currency);
    

    The same change will be in next WPAdverts release.

    Thread Starter spike210957

    (@spike210957)

    You are a gem! Thanks for your help.

    Plugin Author Greg Winiarski

    (@gwin)

    Sure no problem ??

    BTW. If you are finding the plugin useful i would be thankful if you could write a short one or two sentence review here https://www.ads-software.com/support/view/plugin-reviews/wpadverts

    Thread Starter spike210957

    (@spike210957)

    Hey Greg,

    I’ve just noticed that the changes to currency validation are not coming through into [adverts_manage]. Do I need to update something else?

    Plugin Author Greg Winiarski

    (@gwin)

    Hi, you shouldn’t need to do anything special for [adverts_manage] if the code i pasted here https://www.ads-software.com/support/topic/remove-currency-validation/#post-9597149 is executed on page with [adverts_manage] shortcode then the currency validation should be disabled.

    Thread Starter spike210957

    (@spike210957)

    Sorry I wasn’t very clear. While currency validation is disabled when you edit a record via [adverts_manage] the shortcode is showing all records with a price of £0.00

    Plugin Author Greg Winiarski

    (@gwin)

    On the [adverts_manage] list right now you can only hide the price using CSS

    
    .adverts-manage-price { display: none !important }
    
    Thread Starter spike210957

    (@spike210957)

    Is this something you’ll be looking at in a future release?

    Plugin Author Greg Winiarski

    (@gwin)

    Yes, i will be adding some filters to the prices so it will be easier to manage them via API.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Remove currency validation’ is closed to new replies.