Support » Plugin: Product XML Feeds Generator for WooCommerce » Problem with HTML entities output

  • Hello,
    I’m trying to get xml with parameter inside the tag, like this:
    <Supplier-Catalog timestamp=”28-11-2019 12:31:25″>

    My template:
    <Supplier-Catalog timestamp=”[alg_format_date format=”d-m-Y H:i:s” is_timestamp=”no”; do_localize=”yes”][alg_current_datetime][/alg_format_date]”>

    According to docs it should work, but I can get only:
    <Supplier-Catalog timestamp=”28-11-2019 12:31:25″>

    I’ve tried with all other plugins deactiveted, all the same. Can you help? I have plugin version 1.7.3

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Krzysztof Busłowicz

    (@elkurczako)

    Ok – system converted last example – of course… 🙂

    I can get <Supplier-Catalog timestamp=”28-11-2019 12:31:25″>

    Thread Starter Krzysztof Busłowicz

    (@elkurczako)

    Damn… ‘AND-SIGNlt;Supplier-Catalog timestamp=”28-11-2019 12:31:25″>’

    Hi @elkurczako,

    I believe what you need is:

    
    AND-SIGNlt;Supplier-Catalog timestamp="[alg_current_datetime datetime_format='d-m-Y H:i:s']">
    

    AND-SIGN in the snippet above should be replaced with &

    Thread Starter Krzysztof Busłowicz

    (@elkurczako)

    The problem is, that with &lt; I get output:
    & lt;Supplier-Catalog timestamp="28-11-2019 23:24:57">

    and yes I know, there should be no space between & and lt; – WordPress.org forum forms just changes HTML entities to characters. And my WordPress doesn’t.

    @elkurczako,

    I’ve just checked and you are correct, &lt; is not converted in resulting XML file, however, it seems that file is still parsed normally, e.g. if you open it in your browser it shows “normal” XML structure.

    Hi @elkurczako,

    I was thinking – if you need HTML entities converted to characters in XML file – there is a solution. All plugin’s shortcodes have custom_function attribute available, so if you add this to your (child) theme’s functions.php file:

    
    if ( ! function_exists( 'my_alg_wc_xml_wrap_supplier_catalog' ) ) {
        /**
         * my_alg_wc_xml_wrap_supplier_catalog.
         */
        function my_alg_wc_xml_wrap_supplier_catalog( $result ) {
            return '<Supplier-Catalog timestamp="' . $result . '"/>';
        }
    }
    

    then you can just add this to your XML “Template” option:

    
    [alg_current_datetime datetime_format="d-m-Y H:i:s" custom_function="my_alg_wc_xml_wrap_supplier_catalog"]
    

    P.S. Also I think you need to have / symbol for closing tag at the end, i.e.:

    <Supplier-Catalog timestamp="29-11-2019 13:17:23"/>

    and not:

    <Supplier-Catalog timestamp="29-11-2019 13:17:23">

    Hope that helps.

    Thread Starter Krzysztof Busłowicz

    (@elkurczako)

    That did the trick!
    Thank you very much for your time and effort. Great support!

    Thread Starter Krzysztof Busłowicz

    (@elkurczako)

    Closing – resolved.

    @elkurczako,

    Great, happy to hear it’s solved!

    P.S. And if you like the plugin, please consider leaving us a rating.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Problem with HTML entities output’ is closed to new replies.