Cart Boxx – Cart Library Reference

THE CLASS ITSELF

class Cart

Description: Shopping cart related functions.
File: cart-boxx/core/lib/LIB_Cart.php

Example Usage
$_CB->extend(“Cart”);
$_CB->Cart->add($_POST[‘product_id’],$_POST[‘qty’]);

 

THE FUNCTIONS

function count

Description: Count the total number of items (total quantity) in the cart

Parameters
None
Return
[INT] Number of items in cart
function show

Description: Show the cart items in details

Parameters
None
Return
[ARRAY] “cart” will contain an array of products and the details, “total” will be the calculated grand total.
function add

Description: Add item to cart

Parameters
[INT] $id – product ID
[INT] $qty – quantity
Return
[BOOL] True on success, false on failure
function change

Description: Change item quantity

Parameters
[INT] $id – product ID
[INT] $qty – New quantity
Return
[BOOL] True on success, false on failure
function remove

Description: Remove item from cart

Parameters
[INT] $id – product ID
[INT] $qty – Quantity to remove, passing in 0 will remove it entirely
Return
[BOOL] True on success, false on failure
function nuke

Description: Empty entire cart

Parameters
None
Return
[BOOL] True on success, false on failure
function checkout

Description: Checkout the current cart

Parameters
None
Return
[BOOL] True on success, false on failure

Leave a Comment

Your email address will not be published. Required fields are marked *