Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    Hi @mauriciopluri,

    What would you prefer for the output? Just removing the symbol?

    Thread Starter mauriciopluri

    (@mauriciopluri)

    Yes please.

    Thanks

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @mauriciopluri

    Wow, this was waaaay harder than I thought, so I added a feature on the roadmap to make this easier in the future.

    I hope you are able to use this piece of code however:

    foreach (['singleproduct', 'calculation'] as $type) {
        add_filter('gfexcel_export_field_value_' . $type, function ($value, $form_id, $input_id, $entry) {
            if (!strpos($input_id, '.2')) {
                // .2 = price field
                return $value;
            }
            return GFCommon::to_number($value, rgar($entry, 'currency'));
        }, 10, 4);
    }

    Please let me know if this is enough, or if you need anything else.

    Thread Starter mauriciopluri

    (@mauriciopluri)

    Once again, you did it!

    Thank you so much!

    Mauricio

    Thread Starter mauriciopluri

    (@mauriciopluri)

    Hello,

    Concerning this topic, so I get the values without currency, but in my excel, it says that the number was stored as a text.

    Is it possible to have the value as a “number” format?

    Thank you!

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @mauriciopluri ,

    Please checkout the FAQ. Question ‘My numbers are formatted as a string, how can I change the celltype?’ has the answer for this.

    If you need help, please let me know!

    Thread Starter mauriciopluri

    (@mauriciopluri)

    Hello Doeke,

    I just added the code in my function.php of the my theme, still the same.
    Do I have to log out and log in?

    Thanks

    Mauricio

    Plugin Author Doeke Norg

    (@doekenorg)

    @mauriciopluri no that should be necessary. I’ll check it out as soon as I can and get back to you. It might have something to do with it being a seperable field. You need to Target the specific subfield to be numeric.

    I’ll find out. Will let you know.

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @mauriciopluri,

    I’ve found some time; and tested the example in the FAQ, but that works with a product field. Not sure if you’ve copy / pasted the code, but it does need some tinkering to work.

    The example figures it’s form 1 and field 3. Yours might be different.

    However… ??

    As with your previous question, stuff is way more difficult than I thought, so I really need to finish my next release and fix the missing part. This code will also change the name off the field to a numeric field, rendering it as 0. So that’s not really useful. I’m kind of bummed out I couldn’t help you out fully (for now), but hope you can still use this code:

    add_filter('gfexcel_value_type', function ($type, \GF_Field $field) {
        if (in_array($field->get_input_type(), ['singleproduct', 'calculation'])) {
            return \GFExcel\Values\BaseValue::TYPE_NUMERIC;
        }
    
        return $type;
    }, 10, 2);
    Thread Starter mauriciopluri

    (@mauriciopluri)

    Thank you Doeke,

    I add this code instead of the previous on the function.php?

    Thanks

    Plugin Author Doeke Norg

    (@doekenorg)

    Plugin Author Doeke Norg

    (@doekenorg)

    @mauriciopluri Just a heads up, this is now native (and better) as of 1.6.1. So you should be able to remove this code.

    Please go to the settings and select Export prices as numeric fields, without currency symbol ($). Should be all!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Currency on product field’ is closed to new replies.