Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Rui Lopes | Invicta3D

    (@ruitechlopes)

    Hello Team,

    I am writing to report that the issue with Product Titles in the “Product Slider” block persists in the latest version 4.4.1, specifically when running on PHP 8.3.

    Despite the recent updates, the titles are still being cut off or replaced by ellipses (“…”) incorrectly. It seems the logic in Product_Slider.php is still fragile regarding how the $attr['titleLength'] variable type is handled in newer PHP versions (it might be treated as a string or empty value, triggering the trim function unexpectedly).

    I have manually patched the file blocks/Product_Slider.php on my end, and it solved the issue completely.

    I suggest replacing your current ternary operator logic in the content_section function with a more robust check using intval().

    Here is the working code patch:

    PHP

    // Current code in v4.4.1:
    // The ternary operator creates issues with PHP 8.3 strict typing on some setups.
    
    // SUGGESTED FIX (Robust for PHP 8.3):
    $title_length = isset( $attr['titleLength'] ) ? intval( $attr['titleLength'] ) : 0;
    
    if ( $title_length > 0 ) {
        echo esc_html( wp_trim_words( $product_title, $title_length, '...' ) );
    } else {
        echo esc_html( $product_title );
    }
    

    Also, using $product->get_name() is generally safer/more consistent than $product->get_title() in this context.

    Could you please include this robust check in the next release (v4.4.2)? I currently have to disable auto-updates to prevent the slider from breaking again.

    Thank you for your work!

    Forum: Plugins
    In reply to: [Moloni] Erro nos portes
    Thread Starter Rui Lopes | Invicta3D

    (@ruitechlopes)

    Boa tarde,

    Problema corrigido na versão 4.1.2.

    Obrigado.
    Rui Lopes

Viewing 2 replies - 1 through 2 (of 2 total)