• Resolved mauriciopluri

    (@mauriciopluri)


    Hello,

    when I export a excel file, the product field value and quantity are blank. When I use the standard export (csv) those fields appear, I have the name, price and quantité. How can I fix this?

    Thanks

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

    (@doekenorg)

    Let me take a look at it. Will let you know asap. Thanks.

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @mauriciopluri,

    Turns out, this also is a separable field, and in the last update I build something for that. Funny how that works ??

    Although I will be releasing something to make this a bit prettier for products, you are able to activate this by adding the following hook:

    add_filter('gfexcel_transformer_fields', function ($fields) {
        if (!array_key_exists('singleproduct', $fields)) {
            $fields['singleproduct'] = 'GFExcel\Field\SeparableField';
        }
        return $fields;
    });

    **This is a temporary fix**. Like I said, I will be releasing an update for this field in the next release. The code above is update-proof, and will not break things when the update comes. But still you should remove this code at the update. I will let you know in the comments below when that will be.

    I would suggest you enable the splitting of complex fields in the general settings for this plugin. If you don’t want to, you can enable the splitting for this field only, by using the following hook:

    add_filter('gfexcel_field_separated_singleproduct', '__return_true');

    Please let me know if this helps you out for now!

    Thread Starter mauriciopluri

    (@mauriciopluri)

    Great! It showing now, but all the product fields are merged into one field. How can I get them separately? I would like to have one field for the name, one for the quantity and one for the price. Also I have two other fields which don’t show up. One is a product field with calculation. I am using it to add the taxes.

    Thanks

    Plugin Author Doeke Norg

    (@doekenorg)

    Please re read the message above. I’ve included those details. ??

    Plugin Author Doeke Norg

    (@doekenorg)

    The other fields have to be updated in the next release. I’m sorry. ??

    Thread Starter mauriciopluri

    (@mauriciopluri)

    ok, when will the next release come out?

    Thanks

    Plugin Author Doeke Norg

    (@doekenorg)

    I’m hoping to release that somewhere next week. I’ll let you know in these comments.

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @mauriciopluri,

    I’ve checked out the calculation bit, and I can help you out for now too. All these hooks are good for something! ?? If you replace the earlier code by the one below, you should see your calculation field aswel

    // separates fields into multiple columns.
    add_filter('gfexcel_field_separated_singleproduct', '__return_true');
    add_filter('gfexcel_field_separated_calculation', '__return_true'); // or '__return_false', if you want this as one field
    
    // Fixes the html encoding problem for the calculation field
    add_filter('gfexcel_field_calculation_fields', function($fields) {
        return array_map('html_entity_decode',$fields);
    });
    
    // Temporarely add's the fields, as long as they are not implemented.
    add_filter('gfexcel_transformer_fields', function ($fields) {
        foreach (['singleproduct', 'calculation'] as $add_field) {
            if (!array_key_exists($add_field, $fields)) {
                $fields[$add_field] = 'GFExcel\Field\SeparableField';
            }
        }
        return $fields;
    });

    I AM updating the plugin, but I wanted give you a head start. Let me know if this helps you out for now.

    When the update comes around, you should be able to remove this code. But It won’t be a problem if it’s there.

    • This reply was modified 6 years ago by Doeke Norg. Reason: fix code readablilty
    Thread Starter mauriciopluri

    (@mauriciopluri)

    Hello Doeke,

    Thank you it works great! When the new release comes out, will I have to remove the code?

    Thanks

    Mauricio

    Plugin Author Doeke Norg

    (@doekenorg)

    Yes, but it won’t break things if it’s still there. I’ll let you know!

    Plugin Author Doeke Norg

    (@doekenorg)

    @mauriciopluri just wanted to let you know 1.6.0 is finally out. Took a bit longer then expected. But this is now supported in the plugin, so you should be able to remove the addition now!

    have a nice day.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Product field empty’ is closed to new replies.