• Resolved bredaportoni

    (@bredaportoni)


    Hi,
    I need to import woocommerce products with a range of different Lengths; the price are calculated with “Wc Price Calculator”.
    If I manually set a range of length (5000; 5500; 6000), my array is:


    _wc_price_calculator
    ? calculator_type dimension
    ? dimension
    ? ? pricing
    Array ( [enabled] => yes [label] => al metro lineare [unit] => m [calculator] => Array ( [enabled] => yes ) [inventory] => Array ( [enabled] => no ) [weight] => Array ( [enabled] => yes ) [overage] => 0 )

    ? ? length
    Array ( [enabled] => yes [label] => Lunghezza [unit] => mm [editable] => no [options] => Array ( [0] => 5000 [1] => 5500 [2] => 6000 ) [accepted_input] => limited [input_attributes] => Array ( [min] => [max] => [step] => ) )

    How can i use a column on my file (“Length”) to dynamically import different lengts?!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter bredaportoni

    (@bredaportoni)

    EDIT
    I found this post https://www.ads-software.com/support/topic/measurement-price-calculator-4/ that is similar to my situation… but is not clear to me ??

    Plugin Author WP All Import

    (@wpallimport)

    Hi @bredaportoni,

    How can i use a column on my file (“Length”) to dynamically import different lengts?!

    As described in the other post you linked to, you’d have to write custom code that uses our API (see documentation) to achieve this. Unfortunately, I don’t have any example snippets that are specific to this use case, but you may be able to find some inspiration for your code here: https://www.wpallimport.com/documentation/developers/code-snippets/.

    Thread Starter bredaportoni

    (@bredaportoni)

    Hi and thanks for the reply.
    Maybe this must be the case?
    but… I’m in trouble, can’t understand how to “translate it” into my scenario…
    There is a “add-on service” to have specific aid to make things like this? H
    ave you a developer list to contact for this?

    Thanks in advance.

    Thread Starter bredaportoni

    (@bredaportoni)

    I’m trying with this function:

    /*
        [TEST] Add length options 
        Based on: https://www.wpallimport.com/documentation/developers/code-snippets/#append-data-to-a-custom-field-instead-of-replacing-it
    */
    function options_field_fill($id)
    {
        // Get the current value.
        $breda_prod = unserialize(get_post_meta($id, '_wc_price_calculator', true));
    
        // Fill dimension options
        $breda_prod['dimension'] = array( 
            "length" => array( 
                "options" => array(
                    0 => "100",
                    1 => "200",
                    2 => "300"
                )
            ) 
        );
    
        // Save it to database
        update_post_meta($id, '_wc_price_calculator', $breda_prod);
    }
    
    add_action('pmxi_saved_post', 'options_field_fill', 10, 1);

    but only the new array put into the database…
    It seems that the previous content of “_wc_price_calculator” are gone.

    Plugin Author WP All Import

    (@wpallimport)

    Hey @bredaportoni,

    Unfortunately, we can’t help write/troubleshoot custom code for your project or recommend a developer, but we can leave this thread open in case anyone is able to help.

    • This reply was modified 3 years, 9 months ago by WP All Import.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Understanding Custom Fields serialized data’ is closed to new replies.