• Resolved elparts

    (@elparts)


    Hi,

    I added the field with note as a custom field to one program (as _alg_wc_internal_product_note) , and the content of this field with the note is then for ex.:

    a:2:{i:0;a:3:{s:4:”time”;i:1635352774;s:6:”author”;i:1;s:5:”value”;s:0:””;}i:1;a:3:{s:4:”time”;i:1635352774;s:6:”author”;i:1;s:5:”value”;s:38:”Powoduje b??d krytyczny wersja 4.1.1″;}}

    But the note is only the part: “Powoduje b??d krytyczny wersja 4.1.1”

    Is it possible to remove this rubbish additional data somehow? I want to see only the note. Of course, when I edit product in Woocommerce I see only text of the note, but in field _alg_wc_internal_product_note I see this what you can see

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Algoritmika

    (@algoritmika)

    Hi @elparts,

    This happens because the notes are saved in an array, and what you are seeing is a serialized value (i.e. an array represented as a string). And we need to store the notes in an array because there can be multiple notes per product.

    If you could tell me in which plugin, theme, etc. you are using it, then I could try to make them compatible.

    On the other hand, if you are ok with adding PHP code, then, basically, what you need to do, is to process the value with maybe_unserialize() function, e.g.:

    $notes = maybe_unserialize( 'a:2:{i:0;a:3:{s:4:"time";i:1635352774;s:6:"author";i:1;s:5:"value";s:0:"";}i:1;a:3:{s:4:"time";i:1635352774;s:6:"author";i:1;s:5:"value";s:38:"Powoduje b??d krytyczny wersja 4.1.1";}}' );
    

    will give you this array:

    Array
    (
        [0] => Array
            (
                [time] => 1635352774
                [author] => 1
                [value] => 
            )
    
        [1] => Array
            (
                [time] => 1635352774
                [author] => 1
                [value] => Powoduje b??d krytyczny wersja 4.1.1
            )
    
    )
    

    And as in your example, your product has two notes (one is empty), you can access your non-empty note with:

    $note_value = $notes[1]['value'];
    

    There is an easier way as well. We have a built-in function for getting all product notes in a single string:

    $notes_as_string = alg_wc_pn_get_product_notes( 'private', 47800 );
    

    where 47800 is your product ID.

    Hope that helps. And please let me know if you have any questions.

    Thread Starter elparts

    (@elparts)

    Thank you for your reply, I use WooCommerce Advanced Bulk Edit plugin, and it displays products in a table, and in columns, you can have any product data, also you can add custom fields there. Unfortunately, I don’t see there an option allowing for modifying this data by some PHP script or something before display. It can only display raw data. I know I can modify this plugin, but it’s too difficult for me. If you could add an option that would allow us to get all products notes as a single sting, not a table, then it would be great, thank you… you could even add some setting in your plugin in code, and when it’s true then it return only value (of note) , it doesn’t have to be setting in WP ?? We should also could set if this is note [0] of [1] as there could be mess if it displays values from 2 notes .. something like this

    • This reply was modified 3 years ago by elparts.
    • This reply was modified 3 years ago by elparts.
    • This reply was modified 3 years ago by elparts.
    Plugin Author Algoritmika

    (@algoritmika)

    Hi @elparts,

    Sorry for the late reply. I’m not receiving most of the notifications from wp.org recently, really sorry about that.

    Sure, I can take a look at the “WooCommerce Advanced Bulk Edit” plugin, maybe they have some filters that I can use to make our plugins compatible. Could you please send me the link to the plugin? Or you can send me its zip directly to [email protected].

    Thread Starter elparts

    (@elparts)

    I will send you zip file to email, maybe some other similar plugins will be working with this also then when some filter will be added.

    Plugin Author Algoritmika

    (@algoritmika)

    Great, thanks.

    Thread Starter elparts

    (@elparts)

    Email, unfortunately, didn’t go through, please download this plugin here https://drive.google.com/file/d/13IaQQ59M-i4ov8WXAKqPJ73_hIqspTia/view?usp=sharing

    Plugin Author Algoritmika

    (@algoritmika)

    @elparts,

    Ok, I’ve downloaded it, thanks. Let me check it and get back to you…

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @elparts,

    Just wanted to let you know that I’m still working on it. I’ve found a workaround to save product notes via the “WooCommerce Advanced Bulk Edit” plugin, however, I’m still struggling with outputting notes as non-serialized values. I’ve written to the “WooCommerce Advanced Bulk Edit” plugin authors today and asked them to add filters to their code – waiting for their reply now.

    I will get back to you here as soon as possible.

    P.S. I would suggest making your drive.google.com link to the plugin inactive.

    Thread Starter elparts

    (@elparts)

    Thank you for your commitment, yes the link is inactive now.

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @elparts,

    Good news – “WooCommerce Advanced Bulk Edit” plugin author agreed to add the needed lines to his code in the next plugin version. I’m not really sure when will that be though. So if you wish, I can send you the modified version of his plugin, where I’ve added the required lines already. Please let me know if you need it.

    Thread Starter elparts

    (@elparts)

    Hi, cool, yes, you can send me the link / file to my email or give me the link here, thank you.

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @elparts,

    Please contact me directly, so I could send you the plugin’s zip.

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @elparts,

    I’m going to mark this thread as “resolved” for now. Please let me know if/when the “WooCommerce Advanced Bulk Edit” plugin author will release a new version, so I could make our plugins fully compatible.

    P.S. And if you like our plugin, please consider leaving me a rating.

    • This reply was modified 2 years, 10 months ago by Algoritmika.
    Thread Starter elparts

    (@elparts)

    Sure I will let you know

    Plugin Author Algoritmika

    (@algoritmika)

    Great, thank you.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Problem with content of field’ is closed to new replies.