购物车上有更新功能的参考吗?例如,可以更改产品数量的功能等。感谢提前
没有任何功能可以做到这一点。整个购物车页面都是一个表单,您基本上只是在更新购物车时提交表单。
购物车存储在$_SESSION['cart']中,它是一个shoppingCart对象。
您可以在includes/classes/shopping_cart.php上找到代码。
功能包括:
reset($reset_database=false) // empty cart
add_cart($products_id, $qty = '1', $attributes = '', $notify = true) // add an item to the cart
update_quantity($products_id, $quantity = '', $attributes = '') // update quantity of a product
remove($products_id) // remove an item from cart
评论中有很好的记录。有关更多函数,请参见类定义。
如何使用示例:
$_SESSION['cart']->add_cart($products_is, $quantity);
有一个文件夹/included/extra_cart_actions,您可以在其中放置自己的php文件,这些文件在cart操作(添加、删除、更新)期间执行。