0

我正在尝试为我的网站设置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>

...当您单击“购买我”时...您会看到该商品将添加到下面的购物车中,但是当您将鼠标悬停在“查看产品页面”上时,它显示链接是“未定义”!它应该指向/链接到谷歌!

不知道问题出在哪里?请参阅小提琴的 js 面板中的第 525 行 - 这是我能看到的“获取”链接的唯一其他参考。

我试过用谷歌搜索这个问题,虽然还有其他人遇到过同样的问题,但我找不到一个明确的解决方案。

有人能帮我一下吗?

4

1 回答 1

0

我一直在玩 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"

});
于 2015-11-12T01:39:09.910 回答