Home Forums WoodMart support forum Searching on the website throws an Uncaught SyntaxError: JSON error

Searching on the website throws an Uncaught SyntaxError: JSON error

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #173150

    itsame
    Participant

    Dear developer,

    We are really happy with this theme! kudos!

    But now the searching does not work any more on our website.
    It wil throw this error:

    VM3307:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Function.n.parseJSON (jquery.js?ver=1.12.4-wp:4)
    at Function.a.parseJSON (jquery-migrate.min.js?ver=1.4.1:2)
    at Object.transformResult (jquery.autocomplete.min.js?ver=3.8.2:1)
    at Object.<anonymous> (jquery.autocomplete.min.js?ver=3.8.2:1)
    at i (jquery.js?ver=1.12.4-wp:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
    at x (jquery.js?ver=1.12.4-wp:4)
    at XMLHttpRequest.c (jquery.js?ver=1.12.4-wp:4)

    Is there any fix or can you please help?

    Best regards,

    Sjoerd

    Attachments:
    You must be logged in to view attached files.
    #173217

    Artem Temos
    Keymaster

    Hello,

    Could you please disable all plugins that are not related to our theme and provide us your admin access so we can check it?

    Thank you in advance

    #173262

    itsame
    Participant

    Here you are!

    I think updating to Woocommerce 3.9.1 is the cause?

    #173344

    Artem Temos
    Keymaster

    Please, disable all external plugins and switch to the parent theme. Also, update our theme to the latest version following our documentation https://xtemos.com/docs/woodmart/faq-guides/3-x-4-0-migration-guide/

    #173364

    itsame
    Participant

    Thank you very much for your reply.
    I can do that but that will totally destroy my design and this website has a lot of hours of work in it.

    So I follow your guidance but it will kill my design.

    #173366

    itsame
    Participant

    I did all of you have asked from me. But the menu is ruined. And layout (read color settings) is now ruined

    #173383

    itsame
    Participant

    Ok, I have found what made the error, I have implemented this code in my website:

    https://tomjesch.com/display-woocommerce-products-with-and-without-tax/

    function edit_price_display() {
    global $product;
    $price = $product->price;
    $price_incl_tax = $price + round($price * ( 21 / 100 ), 2);
    $price_incl_tax = number_format($price_incl_tax, 2, ‘,’, ‘.’);
    $price = number_format($price, 2, ‘,’, ‘.’);
    $display_price = ‘<span class=”price”>’;
    if($product->is_on_sale()){
    $sale_price = $product->get_regular_price();
    $sale_price = number_format($sale_price, 2, ‘,’, ‘.’);
    $display_price .= ‘<span class=”woocommerce-Price-amount amount”><span class=”woocommerce-Price-currencySymbol”>€</span> ‘ .$sale_price .'</span>‘;
    $display_price .= ‘<ins><span class=”amount exc_btw”>€ ‘ . $price .'<small class=”woocommerce-price-suffix”> ex btw</small></span></ins>’;
    }
    else{
    $display_price .= ‘<span class=”amount exc_btw”>€ ‘ . $price .'<small class=”woocommerce-price-suffix”> ex btw</small></span>’;
    }
    $display_price .= ‘<br>’;
    $display_price .= ‘<span class=”amount incl_btw”>€ ‘ . $price_incl_tax .'<small class=”woocommerce-price-suffix”> incl btw</small></span>’;
    $display_price .= ‘</span>’;
    echo $display_price;
    }
    //add_filter(‘woocommerce_get_price_html’, ‘edit_price_display’, 10, 2);

    And that broke the search option.

    #173384

    itsame
    Participant

    So the question is: is there a way to keep this feature of price incl excl TAX with your theme?

    Or do I need to open a new topic for it.
    Also if you see at the updated website the main menu layout has been changed

    #173403

    Artem Temos
    Keymaster

    Sorry, but we don’t know what may be wrong with your custom code. It is not in our theme support scope.

Viewing 9 posts - 1 through 9 (of 9 total)