【问题标题】:jCart shopping cart libraryjCart 购物车库
【发布时间】:2013-05-18 05:05:49
【问题描述】:

我使用的购物车来自:

http://conceptlogic.com/jcart/

但是到达结账位置后,我想对流程进行更改。

我想改变它是取用户已经完成的篮子的数据内容。在这方面我想采取:

items, names, prices, qtys, itemCount and subtotal

我可以通过这样做来查看详细顺序:

<?php
echo '<pre>';
print_r($_SESSION['jcart']);
echo '</pre>';
?>

如何从 jcart 会话中提取数据?

我想利用这些数据将通过电子邮件返回的数据的详细信息发送给执行交易的购物车用户

【问题讨论】:

  • 能否提供 print_r($_SESSION['jcart']); 的输出??

标签: php session session-variables shopping-cart


【解决方案1】:

你可以试试:

foreach($jcart->get_contents() as $item) {
    $itemID = $item['id']; //gets the item's ID
    $itemName = $item['name']; //gets the item's name
    $itemPrice = $item['price']; // gets the item's price
    $itemQuantity = $item['qty']; // gets number of this product in cart
    $itemTotal = $item['price']*$item['qty']; // total order value of this line item
}

这是一个简单的循环并计算商品总数和购物车总价值的案例。

【讨论】:

    猜你喜欢
    • 2015-01-26
    • 1970-01-01
    • 2015-10-10
    • 2023-03-16
    • 2010-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多