• Resolved xiron3

    (@xiron3)


    We have a paid version of PPOM PRO purchased two months ago. The problem concerns CheckBox ppom fields that have been translated using the WPML plugin.
    I analyzed the code a bit and came to some conclusions.

    In the plugin file
    wp-content \ Plugins \ Woocommerce-product-addon \ inc \ functions.php

    Please find a fragment

    if ($ posted_value == $ option_value) {
    $ option_label_array [] = $ option [‘label’];
    $ options_data_array [] = array (‘option’ => $ option [‘raw’], ‘price’ => $ option [‘price’], ‘id’ => $ option [‘option_id’]);
    }
    in the ppom_generate_cart_meta function

    In our case, the variable $ posted_value contains translated label text (in Polish) and in the variable $ option_value we have a value derived from PPOM data-optionid, so the condition is never true.

    For example, in the variable $ posted_value we have the value “Kino” and in the variable $ option_value the value “Cinema”.

    Where “Kino” is cinema in Polish.
    So in $posted_value we have value of Label translation and in $option_value we have value from data-optionid.

    Please help me solve this problem.

    • This topic was modified 4 years, 8 months ago by xiron3.
    • This topic was modified 4 years, 8 months ago by xiron3.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter xiron3

    (@xiron3)

    z

    • This reply was modified 4 years, 8 months ago by xiron3.

    Hi @xiron3,

    Thanks for the debugging and provide us the details, we have fixed this issue. For now you can replace following line:

    $option_value = stripslashes($option['raw']);

    with

    $option_value = stripslashes(ppom_wpml_translate($option['raw'],'PPOM'));

    and please let me know the feedback.

    Thread Starter xiron3

    (@xiron3)

    It doesn’t work well. When I add a product to cart in the Polish version of the website and switch to the English version – the PPOM checkbox option disappears from the product summary (in basket). The same error as before – the condition is not met

    if( $posted_value == $option_value ) {
    $option_label_array[] = $option[‘label’];
    $options_data_array[] = array(‘option’=>$option[‘raw’],’price’=>$option[‘price’],’id’=>$option[‘option_id’]);
    }
    where $posted_value = ‘kino’ (polish)
    and $option_value = ‘cinema’ (english)

    This is in \woocommerce-product-addon\inc\functions.php

    Well,

    but when the raw value saved in options is applied a filter for wpml, it should show the translated string

    $option_value = stripslashes(ppom_wpml_translate($option['raw'],'PPOM'));

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WPML + Variation product Problem’ is closed to new replies.