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
\Simple cart has no checkout functionality, you have to create such by your own or via an email provider*
\old v1 docs can be found here*
Make sure your system meets the minimum requirements:
ee2/system/third_party/simple_cart to system/expressionengine/third_party/
For every paid addon you need to validate your license in order to activate the module.
On a local environment, like *.dev
*.local
*.localhost
*.test
the license is valid for testing and building a new or existing sites.
For every other domain, you need to have a valid license.
Once installed, you will asked to enter your license key. When you entered a valid license you can hit the "Save license" button. This will start validating your license and will redirect you to addons.reinos.nl to login into your account. You can also register a new account in this process.
Once logged in, you are asked to use your current account or to login with another one.
Using the current logged in account, the server will check all info related to your license and once valid, it will redirect you back to your site where you see either a success message or an error message.
This module is using a license field to check if the license for the module is valid or not. On addons.reinos.nl you can check your license and add your valid domains.
In the Module CP you can enter then your license
When you enter a wrong license, the module will not work and it shows you an warning
Sometimes it happens that the license system says you have an invalid license. When this happens, make sure you have entered your domain url in your account, next to your license on addons.reinos.nl.
If this will not fix your license problem, please contact us on https://addons.reinos.nl/support
{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 unique_id. Used when you are using multiple entries in the cart, with different meta data
unique_id="{entry_id}-{current_time}"
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 with a prefix extra:
. See the examples for how to use.
extra:your_custom_var="some data"
extra:more_custom_vars="more data"
You can also define the extra fields via input fields. Use the prefix extra:
for your names. Those data will be validated and added to the extra data for this item.
<jnput type="text" name="extra:custom_field" value="test" />
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=""
register the field you want to update in the cart. also when using this, use the row_id
to determine the row you are in. name="custom_field[{row_id}]"
{exp:simple_cart:cart
prefix="sc"
fields_to_update="custom_field"
}
{entries}
<input name="custom_field[{sc:row_id}]" value="{sc:custom_field"/>
{/entries}
{/exp:simple_cart:cart}
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}
The row id inside the loop
used inside the {entries}...{/entries}
tag
{entries}
{row_id}
{/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 with the prefix extra:
.
e.g. When you use the param extra:your_var="test"
in the add_cart tag
, you can use the name of the param {extra:your_var}
as variable.
used inside the {entries}...{/entries}
tag
{entries}
{extra: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}
Below are the conditionals you can use for the cart method.
detect when there is no result in the cart
{if simple_cart_no_results}
There are no items in the Simple cart
{/if}
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"
}
Global Variables can be used anywhere in your templates
The total qty of items in the cart
{simple_cart:qty_total}
The total amount of cart without tax
{simple_cart:subtotal_raw}
The total amount of the cart including the tax
{simple_cart:subtotal_include_tax}
The total amount of tax based on the subtotal
{simple_cart:subtotal_tax}
(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);
}
(added in v2.0.0)
This hook is called right before removing an entry from the Simple Cart.
if (ee()->extensions->active_hook('simple_cart_modify_data') === TRUE)
{
$new_cart_data = ee()->extensions->call('simple_cart_modify_data', $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();
fields_to_update
param to the {exp:simple_cart:cart}
tag. this way you can update custom fields in the cart<input type="text" name="extra_field[{sc:row_id}][]" value="test"/>
{if simple_cart_no_results}{/if}
{simple_cart:qty_total}
, {simple_cart:subtotal_raw}
, {simple_cart:subtotal_include_tax}
, {simple_cart:subtotal_tax}
entry_id
param is now optional to attach extra data on it.