Simple Cart enable a simple shopping cart based on your existing Entries. Simply add your entries to the Simple Cart by the powerfull sets of tags. No fancy FieldType (use the native custom field to set the price), no order management, no payment providera, no settings, just a couple of powerfull cart tags to do the task.
The following features are supported
Make sure your system meets the minimum requirements:
ee2/system/third_party/simple_cart to system/expressionengine/third_party/
{exp:simple_cart:add_to_cart}
Below are the Tag Parameters. Those parameters can be used in the tag described above
Set the entry_id
entry_id=""
Set the price for your entry
price="110.90"
Set your tax for the entry.
The example shows a 21% tax.
tax="21"
The return url
return_url="21"
By setting the direct param to yes, the entry will be added directly to the cart.
direct="yes"
The time in seconds that an entry will be stays in an cart
timer="1200"
You can set as many custom variable with the entry by setting any custom param. See the examples for how to use.
your_custom_var="some data"
more_custom_vars="more data"
This tag currently work as a direct call instead of producing a form to edit your qty for an item. Use the {exp:simple_cart:cart}
tag for producing a form for updating your qty by the user.
{exp:simple_cart:edit_cart_item}
Below are the Tag Parameters. Those parameters can be used in the tag described above
Set the entry_id
entry_id=""
Set the price for your entry
price="110.90"
Set your tax for the entry.
The example shows a 21% tax.
tax="21"
The return url
return_url="21"
The time in seconds that an entry will be stays in an cart
timer="1200"
You can set as many custom variable with the entry by setting any custom param. See the examples for how to use.
your_custom_var="some data"
more_custom_vars="more data"
{exp:simple_cart:cart}
Below are the Tag Parameters. Those parameters can be used in the tag described above
Prefix the variables
{exp:simple_cart:cart prefix="sc"}
{sc:qty_total}
{/exp:simple_cart:cart}
The url to return after submission
return_url=""
Below are the Tag Variables. Those Variables can be used in the tag described above
Loop over the entries who are inside the cart
{entries}...{/entries}
Show the raw price for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{price_raw}
{/entries}
Show the tax price for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{price_tax}
{/entries}
Show the price include the tax price for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{price_include_tax}
{/entries}
Show the quantity for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{qty}
{/entries}
Show the quantity for an entry inside a input element for updating
used inside the {entries}...{/entries}
tag
{entries}
{qty:input}
{/entries}
Show the raw subtotal for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{price_subtotal_raw}
{/entries}
Show the tax subtotal for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{subtotal_tax}
{/entries}
Show the subtotal price include the tax for an entry.
used inside the {entries}...{/entries}
tag
{entries}
{subtotal_include_tax}
{/entries}
All other custom fields can also be used. e.g. {title}
used inside the {entries}...{/entries}
tag
{entries}
{title}
{entry_id}
{entry_date}
etc...
{/entries}
any custom fields, defined in the add_cart tag
can be use here. Simply use the name of the param.
e.g. When you use the param your_var="test"
in the add_cart tag
, you can use the name of the param {your_var}
as variable.
used inside the {entries}...{/entries}
tag
{entries}
{your_custom_var}
{/entries}
Show the delete link
used inside the {entries}...{/entries}
tag
{entries}
{delete}
{/entries}
Shows estimated time in seconds for how long the entry will stays in the cart.
used inside the {entries}...{/entries}
tag
{entries}
{current_timer} in seconds
{current_timer:seconds} in seconds
{current_timer:minutes} in minutes
{/entries}
Show the subtotal price include the tax for the whole cart.
{subtotal_include_tax}
Show the raw price for the whole cart.
{subtotal_raw}
Show the tax for the whole cart.
{subtotal_tax}
Show the total items of the cart
{qty_total}
Submit the form for updating the qty.
{submit}
This tag produce a link, that remove a specified entry from the Cart.
{exp:simple_cart:remove_from_cart_link}
Below are the Tag Parameters. Those parameters can be used in the tag described above
The entry_id
entry_id="100"
The url to return after submission
return_url=""
This tag produce a link, that remove all the items from the cart.
{exp:simple_cart:empty_cart}
By setting the direct param to yes, the cart will be trucated directly. without generating a link
The entry_id
direct="no"
The url to return url.
return_url="site/home"
{exp:simple_cart:remove_from_cart}
By setting the direct param to yes, the cart will be trucated directly. without generating a link
The entry_id
{exp:simple_cart:remove_from_cart
entry_id="4"
}
(added in v1.0)
This hook is called right before adding an entry to the Simple Cart
if (ee()->extensions->active_hook('simple_cart_add_to_cart') === TRUE)
{
$data = ee()->extensions->call('simple_cart_add_to_cart', $data);
}
(added in v1.0)
This hook is called right berfore empty the Simple Cart.
if (ee()->extensions->active_hook('simple_cart_empty_cart') === TRUE)
{
ee()->extensions->call('simple_cart_empty_cart', $cart_data);
}
(added in v1.0)
This hook is called right before removing an entry from the Simple Cart.
if (ee()->extensions->active_hook('simple_cart_remove_cart_entry') === TRUE)
{
ee()->extensions->call('simple_cart_remove_cart_entry', $cart_data);
}
Add a new entry to the cart
$entry_id
: the entry id
$price
: the price
$qty
: The qty
$tax
: Tax ammount
$time
: Time available in the cart
$extra_param
: (array) of extra values
$increment
: Do we need to increment the qty when his entry is already in the cart
ee()->load->add_package_path(PATH_THIRD . 'simple_cart/');
ee()->load->library('simple_cart_api');
ee()->load->remove_package_path(PATH_THIRD . 'simple_cart/');
//save_cart_entry
ee()->simple_cart_api->add_cart_entry(34, '15,95', 1, 21, 1200, array(), true);
Update a cart entry
$entry_id
: the entry id
$price
: the price
$qty
: The qty
$tax
: Tax ammount
$time
: Time available in the cart
$extra_param
: (array) of extra values
ee()->load->add_package_path(PATH_THIRD . 'simple_cart/');
ee()->load->library('simple_cart_api');
ee()->load->remove_package_path(PATH_THIRD . 'simple_cart/');
//save_cart_entry
ee()->simple_cart_api->update_cart_entry(34, '15,95', 1, 21, 1200, array());
Delete an entry from the cart
$entry_id
: the entry id
ee()->load->add_package_path(PATH_THIRD . 'simple_cart/');
ee()->load->library('simple_cart_api');
ee()->load->remove_package_path(PATH_THIRD . 'simple_cart/');
//delete_cart_entry
ee()->simple_cart_api->delete_cart_entry(4);
Empty the cart
ee()->load->add_package_path(PATH_THIRD . 'simple_cart/');
ee()->load->library('simple_cart_api');
ee()->load->remove_package_path(PATH_THIRD . 'simple_cart/');
//empty_cart
ee()->simple_cart_api->empty_cart();