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
- This topic has 8 replies, 2 voices, and was last updated 5 years ago by
Artem Temos.
-
AuthorPosts
-
February 13, 2020 at 10:49 am #173150
itsameParticipantDear 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.February 13, 2020 at 2:08 pm #173217
Artem TemosKeymasterHello,
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
February 13, 2020 at 4:18 pm #173262
itsameParticipantHere you are!
I think updating to Woocommerce 3.9.1 is the cause?
February 14, 2020 at 7:07 am #173344
Artem TemosKeymasterPlease, 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/
February 14, 2020 at 8:19 am #173364
itsameParticipantThank 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.
February 14, 2020 at 8:25 am #173366
itsameParticipantI did all of you have asked from me. But the menu is ruined. And layout (read color settings) is now ruined
February 14, 2020 at 8:46 am #173383
itsameParticipantOk, 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.
February 14, 2020 at 8:56 am #173384
itsameParticipantSo 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 changedFebruary 14, 2020 at 9:59 am #173403
Artem TemosKeymasterSorry, but we don’t know what may be wrong with your custom code. It is not in our theme support scope.
-
AuthorPosts
Tagged: JSON jquery.autocomplete.min.js
- You must be logged in to create new topics. Login / Register