SimpleCart.js项链接未定义,可以'I don’我无法获得工作链接
SimpleCart.js item link undefined, can't get the link to work
我正在尝试为我的网站设置SimpleCart,除了我尝试将我的产品各自的链接添加到"购物车列"中自己的页面时,一切都100%正常。我正在关注文档(此链接将带您进入他们的文档页面,解释如何设置购物车列,包括商品链接),了解如何包括产品链接,但链接一直说它是"未定义的"。
请看一下我的小提琴(很抱歉没有造型):
小提琴
根据文件,如果你放:
{ view: "link", label: "Details", attr: "pageLink", text: "View Product Page" }
作为一个推车列(正如你在小提琴中第98行看到的)
然后添加类:
class="item-pageLink">
(我认为它收集了如下所示的href链接)到可以添加到购物车的产品-所以在我的例子和js fiddle中,我得到了:
<div class="item-pageLink"><a href="http://www.google.com">View More</a></div>
当你点击"买我"。。。你会看到这个项目将被添加到下面的购物车中,但当你将鼠标悬停在"查看产品页面"上时,它显示链接是"未定义的"!它应该指向/链接到谷歌!
我不知道问题出在哪里?请参阅fiddle的js面板中的第525行——这是我能看到的唯一一个关于"获取"链接的引用。
我试过在谷歌上搜索这个问题,尽管也有其他人遇到过同样的问题,但我找不到一个明确的解决方案。
有人能帮我吗?
我一直在玩simpleCart js,下面是我如何在购物车中添加产品名称链接的方法:https://github.com/wojodesign/simplecart-js/issues/476
我在页面HTML中传入item_link <span class="item_link">http://www.example.com</span>
,然后在simpleCartSetup.js
文件中向attr:"name"添加视图函数
// simpleCartSetup.js
simpleCart({
// array representing the format and columns of the cart, see
// the cart columns documentation
cartColumns: [
{ attr: "name" , label: "Name",
// Link function
view: function (item, column) {
return "<a href='" + item.get("link") + "'>" + item.get(column.attr) + "</a>";
}
},
{ attr: "price" , label: "Price", view: 'currency' },
{ view: "decrement" , label: false },
{ attr: "quantity" , label: "Qty" },
{ view: "increment" , label: false },
{ attr: "total" , label: "SubTotal", view: 'currency' },
{ view: "remove" , text: "Remove" , label: false }
],
// "div" or "table" - builds the cart as a table or collection of divs
cartStyle: "div",
// how simpleCart should checkout, see the checkout reference for more info
checkout: {
type: "PayPal" ,
email: "you@yours.com"
},
// set the currency, see the currency reference for more info
currency: "AUD"
});
相关文章:
- 创建一个类似链接的按钮,并通过Javascript函数打开一个新的弹出窗口
- 如何使用jQuery自动打开页面上的所有链接
- 动态地改变“”的URL;添加新项目”;链接使用javascript/jquery
- jquery动画可以通过编程链接吗
- 在单击href链接的同时下载文件
- 尽管链接成功并已成功下载,但未找到NPM模块
- 制作一个不带HTML a标记但在动画播放完毕后指向其他页面的超链接
- ReactJS映射:如何仅在url变量不为空时呈现html链接
- 单击页面上的链接后高度发生变化
- 将纯文本URL转换为可单击链接
- python-selenium-点击上升链接
- 链接don'由于Javascript悬停效果,无法在移动设备上工作
- 文件上传don'单击链接按钮时无法打开
- JQuery Accordion内容链接don'不起作用
- 使用jQuery选择*don't*包含链接
- React路由器链接don'Don’别那么受欢迎
- 页面中的链接don'不起作用
- 延迟FancyBox打开*WITH* "don't show this again"链接
- SimpleCart.js项链接未定义,可以'I don’我无法获得工作链接
- 添加了javascript,现在链接don'不起作用