duanhao4909 2014-09-24 10:28
浏览 59
已采纳

Magento购物车链接错误

I have the following links in my header:

  • Account
  • Wishlist
  • Search
  • Cart

They're all working properly, except for the cart link. Whenever the link is pressed, the console shows the following error:

Uncaught Error: Syntax error, unrecognized expression: http://myshop.com/checkout/cart/

The error refers to a Sizzle error function in a jQuery 1.10.2 script, I've looked through the script but there are multiple Sizzle scripts.

The link is called as followed in minicart.phtml:

<a href="<?php echo Mage::getUrl('checkout/cart')?>" class="skip-link skip-cart <?php if($_cartQty <= 0): ?> no-count<?php endif; ?>">

Does anybody have any ideas what may cause this error?

  • 写回答

2条回答 默认 最新

  • dongqing344716 2014-09-24 12:32
    关注

    It is because of the class name "skip-link". If you need to redirect to the cart page, you remove this class name from the tag and it will work. "skip-link" is used to show the content near to that link instead of redirecting to other page. If we use "skip-link", then the href attribute will have some identifier value like "#header-top"(it will be id of some hidden div or span) or something like that. That's why the js error happens, because it is trying to parse the href parameter as an element's id which is not in right syntax in this case.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?