checkout javascript error

  • Posts: 20
  • Thank you received: 1
  • Hikashop Business
3 years 4 months ago #314584

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.14
-- PHP version -- : 7.3.12
-- Browser(s) name and version -- : Firefox (latest at this time)
-- Error-message(debug-mod must be tuned on) -- : SyntaxError: unexpected token: ':'


While implementing our own CAPTCHA found a javascript problem.
Try this:
- make sure you are not legged in
- add a product to the cart
- beginning the checkout
- on the page for the customer try registering without validating the CAPTCHA code
- the form is submitted to the server and an error is returned
- on return all the script codes on the page are executed again, which is great, but joomla has some json object used just as a datablock which generate errors when you try to assign it "text/javascript" type and the rest of the javascript code is stopped.

This are defined with the tag:

<script type="application/json ...>...</script>
You can find an example of this loaded by:
{joomlaroot}\libraries\src\Document\Renderer\Html\HeadRenderer.php on the line 250.
Found the code generating this problem here:
{joomlaroot}\media\com_hikashop\js\hikashop.js on the line 305.

I suggest removing those scripts from the list of scripts to be reloaded on AJAX since they are defined already on the header of the page.

Please Log in or Create an account to join the conversation.

  • Posts: 78748
  • Thank you received: 12462
3 years 4 months ago #314628


Thank you for your feedback. We'll add a check for that with the next version of HikaShop.
You can add such code in the javascript updateElem function to avoid the issue for now:

if(all.indexOf('type="application/json"') != -1)
				return '';

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum