使用simplecart.js在数据库中保存购物车详细信息

时间:2017-12-20 11:55:41

标签: javascript php mysql simplecart

我正在使用simplecart.js。购物车显示正常。我现在要做的是检索购物车中的细节并插入数据库。 这是我的代码。

for i in $(cat wordlist.txt); do
  for j in $(cat wordlist.txt); do
    if [ "$i" != "$j" ]; then
      echo "The quick brown $i jumps over the $j dog"
    fi
  done
done

和PHP文件

simpleCart({
    cartColumns: [
        { attr: "name", label: "Name" },
        { 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 }
    ],
    cartStyle: "table",
    checkout: {
        type: "SendForm",
        url: base_url + "Checkout/checkout_function",
        method: "POST",
        success: base_url + "/Checkout/success",
        cancel: base_url + "Checkout/cancel"
    }
});

simpleCart.bind('beforeCheckout', function (data) {
    data.full_name = document.getElementById("full_name").value;
    data.phone = document.getElementById("phone").value;
    data.country = document.getElementById("country").value;
    data.state = document.getElementById("state").value;
    data.city = document.getElementById("city").value;
    data.address1 = document.getElementById("address1").value;
    data.address2 = document.getElementById("address2").value;
    data.zip = document.getElementById("zip").value;
    data.address_type = document.getElementById("address_type").value;
});

问题是当我尝试回显任何变量时,不会显示购物车中的内容。请问如何让变量包含实际内容,将它们插入数据库不会有问题。

0 个答案:

没有答案
相关问题