JavaScript Error - breaks CSS in IE

  • Posts: 2
  • Thank you received: 0
11 years 3 months ago #84463

Hello,

First of all thank you for an awesome shopping cart! I have traced down a bug in the Content Module, a javascript syntax error, missing semicolon. Only IE seems to have a problem with it, but it breaks CSS in that case. If I disable the Content Module the syntax error no longer shows in the developer console and CSS loads properly.

I put the code into an online error checker and it says missing semicolon, but I honestly don't know where the semicolon should be.

Here is the function causing the error:

function hikashopModifyQuantity(id,obj,add,form,type){var d=document,cart_type="cart",addStr="",qty=1,e=null;if(type)cart_type=type;if(add)addStr="&add=1";if(obj){qty=parseInt(obj.value);}else if(document.getElementById("hikashop_product_quantity_field_"+id).value){qty=document.getElementById("hikashop_product_quantity_field_"+id).value;}
if(form&&document[form]){var varform=document[form];if(cart_type=="wishlist"){e=d.getElementById("hikashop_cart_type_"+id);if(e)e.value="wishlist";f=d.getElementById("type");if(f)f.value="wishlist";}else{e=d.getElementById("hikashop_cart_type_"+id);if(e)e.value="cart";}
if(varform.task){varform.task.value="updatecart";}
varform.submit();}else{var url="/component/hikashop/product/updatecart/tmpl-component?from=module&product_id="+id+"&cart_type="+cart_type+"&quantity="+qty+addStr+"&return_url=L2NvbXBvbmVudC9oaWthc2hvcC9jaGVja291dA%3D%3D";
var completeFct=function(result){if(cart_type!="wishlist"){var hikaModule=window.document.getElementById("hikashop_cart_module");if(hikaModule)hikaModule.innerHTML=result;}
window.location='/component/hikashop/checkout';}

>> Error checker at http://www.javascriptlint.com/online_lint.php points to this location as missing semicolon

try{new Ajax(url,{method:"get",onComplete:completeFct}).request();}catch(err){new Request({url:url,method:"get",onComplete:completeFct}).send();}}
return false;}

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
11 years 3 months ago #84471

Hi,

Thanks for the report. I have patched the javascript. It would be include in the next HikaShop release.
You can edit the file "administrator/com_hikashop/helpers/cart.php" and add a semicolon for the two "var completeFct = function(result) { ... };".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: acarlo1

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

  • Posts: 2
  • Thank you received: 0
11 years 3 months ago #84596

Awesome, thanks Jerome! Very impressed with the quick response!

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

Time to create page: 0.060 seconds
Powered by Kunena Forum