Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 1 | <?php |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Phil Sturgeon | 07c1ac8 | 2012-03-09 17:03:37 +0000 | [diff] [blame] | 5 | * An open source application development framework for PHP 5.2.4 or newer |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 6 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 7 | * NOTICE OF LICENSE |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 8 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 9 | * Licensed under the Open Software License version 3.0 |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 10 | * |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 11 | * This source file is subject to the Open Software License (OSL 3.0) that is |
| 12 | * bundled with this package in the files license.txt / license.rst. It is |
| 13 | * also available through the world wide web at this URL: |
| 14 | * http://opensource.org/licenses/OSL-3.0 |
| 15 | * If you did not receive a copy of the license and are unable to obtain it |
| 16 | * through the world wide web, please send an email to |
| 17 | * licensing@ellislab.com so we can send you a copy immediately. |
| 18 | * |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 19 | * @package CodeIgniter |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 20 | * @author EllisLab Dev Team |
Andrey Andreev | 80500af | 2013-01-01 08:16:53 +0200 | [diff] [blame] | 21 | * @copyright Copyright (c) 2006 - 2013, EllisLab, Inc. (http://ellislab.com/) |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 22 | * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 23 | * @link http://codeigniter.com |
| 24 | * @since Version 1.0 |
| 25 | * @filesource |
| 26 | */ |
Andrey Andreev | c5536aa | 2012-11-01 17:33:58 +0200 | [diff] [blame] | 27 | defined('BASEPATH') OR exit('No direct script access allowed'); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 28 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 29 | /** |
| 30 | * Shopping Cart Class |
| 31 | * |
| 32 | * @package CodeIgniter |
| 33 | * @subpackage Libraries |
| 34 | * @category Shopping Cart |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 35 | * @author EllisLab Dev Team |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 36 | * @link http://codeigniter.com/user_guide/libraries/cart.html |
| 37 | */ |
| 38 | class CI_Cart { |
| 39 | |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 40 | /** |
| 41 | * These are the regular expression rules that we use to validate the product ID and product name |
| 42 | * alpha-numeric, dashes, underscores, or periods |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 43 | * |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 44 | * @var string |
| 45 | */ |
| 46 | public $product_id_rules = '\.a-z0-9_-'; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 47 | |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 48 | /** |
| 49 | * These are the regular expression rules that we use to validate the product ID and product name |
| 50 | * alpha-numeric, dashes, underscores, colons or periods |
| 51 | * |
| 52 | * @var string |
| 53 | */ |
| 54 | public $product_name_rules = '\.\:\-_ a-z0-9'; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 55 | |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 56 | /** |
| 57 | * only allow safe product names |
| 58 | * |
| 59 | * @var bool |
| 60 | */ |
| 61 | public $product_name_safe = TRUE; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 62 | |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 63 | // -------------------------------------------------------------------------- |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 64 | // Protected variables. Do not change! |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 65 | // -------------------------------------------------------------------------- |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 66 | |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 67 | /** |
| 68 | * Reference to CodeIgniter instance |
| 69 | * |
| 70 | * @var object |
| 71 | */ |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 72 | protected $CI; |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 73 | |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 74 | /** |
| 75 | * Contents of the cart |
| 76 | * |
| 77 | * @var array |
| 78 | */ |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 79 | protected $_cart_contents = array(); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * Shopping Class Constructor |
| 83 | * |
| 84 | * The constructor loads the Session class, used to store the shopping cart contents. |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 85 | * |
| 86 | * @param array |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 87 | * @return void |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 88 | */ |
Greg Aker | a926328 | 2010-11-10 15:26:43 -0600 | [diff] [blame] | 89 | public function __construct($params = array()) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 90 | { |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 91 | // Set the super object to a local variable for use later |
| 92 | $this->CI =& get_instance(); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 93 | |
Derek Jones | 37f4b9c | 2011-07-01 17:56:50 -0500 | [diff] [blame] | 94 | // Are any config settings being passed manually? If so, set them |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 95 | $config = is_array($params) ? $params : array(); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 96 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 97 | // Load the Sessions class |
Edwin Aw | edc9afa | 2013-01-25 16:12:20 +0800 | [diff] [blame] | 98 | $this->CI->load->driver('session', $config); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 99 | |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 100 | // Grab the shopping cart array from the session table |
| 101 | $this->_cart_contents = $this->CI->session->userdata('cart_contents'); |
Ivan Tcholakov | 29453cd | 2012-11-23 13:54:28 +0200 | [diff] [blame] | 102 | if ($this->_cart_contents === NULL) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 103 | { |
| 104 | // No cart exists so we'll set some base values |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 105 | $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 106 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 107 | |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 108 | log_message('debug', 'Cart Class Initialized'); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 112 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 113 | /** |
| 114 | * Insert items into the cart and save it to the session table |
| 115 | * |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 116 | * @param array |
| 117 | * @return bool |
| 118 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 119 | public function insert($items = array()) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 120 | { |
| 121 | // Was any cart data passed? No? Bah... |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 122 | if ( ! is_array($items) OR count($items) === 0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 123 | { |
| 124 | log_message('error', 'The insert method must be passed an array containing data.'); |
| 125 | return FALSE; |
| 126 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 127 | |
| 128 | // You can either insert a single product using a one-dimensional array, |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 129 | // or multiple products using a multi-dimensional one. The way we |
| 130 | // determine the array type is by looking for a required array key named "id" |
| 131 | // at the top level. If it's not found, we will assume it's a multi-dimensional array. |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 132 | |
| 133 | $save_cart = FALSE; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 134 | if (isset($items['id'])) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 135 | { |
Phil Sturgeon | 9091051 | 2011-07-20 10:07:40 -0600 | [diff] [blame] | 136 | if (($rowid = $this->_insert($items))) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 137 | { |
| 138 | $save_cart = TRUE; |
| 139 | } |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | foreach ($items as $val) |
| 144 | { |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 145 | if (is_array($val) && isset($val['id'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 146 | { |
Phil Sturgeon | 9091051 | 2011-07-20 10:07:40 -0600 | [diff] [blame] | 147 | if ($this->_insert($val)) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 148 | { |
| 149 | $save_cart = TRUE; |
| 150 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 151 | } |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 152 | } |
| 153 | } |
| 154 | |
| 155 | // Save the cart data if the insert was successful |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 156 | if ($save_cart === TRUE) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 157 | { |
| 158 | $this->_save_cart(); |
Phil Sturgeon | 9091051 | 2011-07-20 10:07:40 -0600 | [diff] [blame] | 159 | return isset($rowid) ? $rowid : TRUE; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | return FALSE; |
| 163 | } |
| 164 | |
| 165 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 166 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 167 | /** |
| 168 | * Insert |
| 169 | * |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 170 | * @param array |
| 171 | * @return bool |
| 172 | */ |
Andrey Andreev | 74476e1 | 2012-03-26 15:03:40 +0300 | [diff] [blame] | 173 | protected function _insert($items = array()) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 174 | { |
| 175 | // Was any cart data passed? No? Bah... |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 176 | if ( ! is_array($items) OR count($items) === 0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 177 | { |
| 178 | log_message('error', 'The insert method must be passed an array containing data.'); |
| 179 | return FALSE; |
| 180 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 181 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 182 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 183 | |
Derek Jones | 37f4b9c | 2011-07-01 17:56:50 -0500 | [diff] [blame] | 184 | // Does the $items array contain an id, quantity, price, and name? These are required |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 185 | if ( ! isset($items['id'], $items['qty'], $items['price'], $items['name'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 186 | { |
| 187 | log_message('error', 'The cart array must contain a product ID, quantity, price, and name.'); |
| 188 | return FALSE; |
| 189 | } |
| 190 | |
| 191 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 192 | |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 193 | // Prep the quantity. It can only be a number. Duh... also trim any leading zeros |
Andrey Andreev | 17779d6 | 2011-12-22 13:21:08 +0200 | [diff] [blame] | 194 | $items['qty'] = (float) $items['qty']; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 195 | |
| 196 | // If the quantity is zero or blank there's nothing for us to do |
Andrey Andreev | 1a9b7e0 | 2012-11-01 16:23:47 +0200 | [diff] [blame] | 197 | if ($items['qty'] == 0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 198 | { |
| 199 | return FALSE; |
| 200 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 201 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 202 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 203 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 204 | // Validate the product ID. It can only be alpha-numeric, dashes, underscores or periods |
| 205 | // Not totally sure we should impose this rule, but it seems prudent to standardize IDs. |
| 206 | // Note: These can be user-specified by setting the $this->product_id_rules variable. |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 207 | if ( ! preg_match('/^['.$this->product_id_rules.']+$/i', $items['id'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 208 | { |
Derek Jones | 37f4b9c | 2011-07-01 17:56:50 -0500 | [diff] [blame] | 209 | log_message('error', 'Invalid product ID. The product ID can only contain alpha-numeric characters, dashes, and underscores'); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 210 | return FALSE; |
| 211 | } |
| 212 | |
| 213 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 214 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 215 | // Validate the product name. It can only be alpha-numeric, dashes, underscores, colons or periods. |
| 216 | // Note: These can be user-specified by setting the $this->product_name_rules variable. |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 217 | if ($this->product_name_safe && ! preg_match('/^['.$this->product_name_rules.']+$/i', $items['name'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 218 | { |
Andrew Seymour | 3dd6663 | 2011-12-13 15:50:52 +0000 | [diff] [blame] | 219 | log_message('error', 'An invalid name was submitted as the product name: '.$items['name'].' The name can only contain alpha-numeric characters, dashes, underscores, colons, and spaces'); |
| 220 | return FALSE; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | // -------------------------------------------------------------------- |
| 224 | |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 225 | // Prep the price. Remove leading zeros and anything that isn't a number or decimal point. |
Andrey Andreev | 17779d6 | 2011-12-22 13:21:08 +0200 | [diff] [blame] | 226 | $items['price'] = (float) $items['price']; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 227 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 228 | // We now need to create a unique identifier for the item being inserted into the cart. |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 229 | // Every time something is added to the cart it is stored in the master cart array. |
| 230 | // Each row in the cart array, however, must have a unique index that identifies not only |
| 231 | // a particular product, but makes it possible to store identical products with different options. |
| 232 | // For example, what if someone buys two identical t-shirts (same product ID), but in |
Derek Jones | 37f4b9c | 2011-07-01 17:56:50 -0500 | [diff] [blame] | 233 | // different sizes? The product ID (and other attributes, like the name) will be identical for |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 234 | // both sizes because it's the same shirt. The only difference will be the size. |
| 235 | // Internally, we need to treat identical submissions, but with different options, as a unique product. |
| 236 | // Our solution is to convert the options array to a string and MD5 it along with the product ID. |
| 237 | // This becomes the unique "row ID" |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 238 | if (isset($items['options']) && count($items['options']) > 0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 239 | { |
ThallisPHP | f074dff | 2012-05-03 16:01:46 -0300 | [diff] [blame] | 240 | $rowid = md5($items['id'].serialize($items['options'])); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 241 | } |
| 242 | else |
| 243 | { |
| 244 | // No options were submitted so we simply MD5 the product ID. |
| 245 | // Technically, we don't need to MD5 the ID in this case, but it makes |
| 246 | // sense to standardize the format of array indexes for both conditions |
| 247 | $rowid = md5($items['id']); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 248 | } |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 249 | |
| 250 | // -------------------------------------------------------------------- |
| 251 | |
| 252 | // Now that we have our unique "row ID", we'll add our cart items to the master array |
Andrew Seymour | 2e5bda3 | 2011-12-13 11:40:15 +0000 | [diff] [blame] | 253 | // grab quantity if it's already there and add it on |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 254 | $old_quantity = isset($this->_cart_contents[$rowid]['qty']) ? (int) $this->_cart_contents[$rowid]['qty'] : 0; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 255 | |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 256 | // Re-create the entry, just to make sure our index contains only the data from this submission |
| 257 | $items['rowid'] = $rowid; |
| 258 | $items['qty'] += $old_quantity; |
| 259 | $this->_cart_contents[$rowid] = $items; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 260 | |
Phil Sturgeon | 9091051 | 2011-07-20 10:07:40 -0600 | [diff] [blame] | 261 | return $rowid; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 265 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 266 | /** |
| 267 | * Update the cart |
| 268 | * |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 269 | * This function permits the quantity of a given item to be changed. |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 270 | * Typically it is called from the "view cart" page if a user makes |
| 271 | * changes to the quantity before checkout. That array must contain the |
| 272 | * product ID and quantity for each item. |
| 273 | * |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 274 | * @param array |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 275 | * @return bool |
| 276 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 277 | public function update($items = array()) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 278 | { |
| 279 | // Was any cart data passed? |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 280 | if ( ! is_array($items) OR count($items) === 0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 281 | { |
| 282 | return FALSE; |
| 283 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 284 | |
| 285 | // You can either update a single product using a one-dimensional array, |
Derek Jones | 37f4b9c | 2011-07-01 17:56:50 -0500 | [diff] [blame] | 286 | // or multiple products using a multi-dimensional one. The way we |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 287 | // determine the array type is by looking for a required array key named "id". |
| 288 | // If it's not found we assume it's a multi-dimensional array |
| 289 | $save_cart = FALSE; |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 290 | if (isset($items['rowid'], $items['qty'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 291 | { |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 292 | if ($this->_update($items) === TRUE) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 293 | { |
| 294 | $save_cart = TRUE; |
| 295 | } |
| 296 | } |
| 297 | else |
| 298 | { |
| 299 | foreach ($items as $val) |
| 300 | { |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 301 | if (is_array($val) && isset($val['rowid'], $val['qty'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 302 | { |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 303 | if ($this->_update($val) === TRUE) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 304 | { |
| 305 | $save_cart = TRUE; |
| 306 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 307 | } |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 308 | } |
| 309 | } |
| 310 | |
| 311 | // Save the cart data if the insert was successful |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 312 | if ($save_cart === TRUE) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 313 | { |
| 314 | $this->_save_cart(); |
| 315 | return TRUE; |
| 316 | } |
| 317 | |
| 318 | return FALSE; |
| 319 | } |
| 320 | |
| 321 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 322 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 323 | /** |
| 324 | * Update the cart |
| 325 | * |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 326 | * This function permits the quantity of a given item to be changed. |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 327 | * Typically it is called from the "view cart" page if a user makes |
| 328 | * changes to the quantity before checkout. That array must contain the |
| 329 | * product ID and quantity for each item. |
| 330 | * |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 331 | * @param array |
| 332 | * @return bool |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 333 | */ |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 334 | protected function _update($items = array()) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 335 | { |
| 336 | // Without these array indexes there is nothing we can do |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 337 | if ( ! isset($items['qty'], $items['rowid'], $this->_cart_contents[$items['rowid']])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 338 | { |
| 339 | return FALSE; |
| 340 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 341 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 342 | // Prep the quantity |
Andrey Andreev | 17779d6 | 2011-12-22 13:21:08 +0200 | [diff] [blame] | 343 | $items['qty'] = (float) $items['qty']; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 344 | |
Derek Jones | 37f4b9c | 2011-07-01 17:56:50 -0500 | [diff] [blame] | 345 | // Is the quantity zero? If so we will remove the item from the cart. |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 346 | // If the quantity is greater than zero we are updating |
Andrey Andreev | 5036c9c | 2012-06-04 15:34:56 +0300 | [diff] [blame] | 347 | if ($items['qty'] == 0) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 348 | { |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 349 | unset($this->_cart_contents[$items['rowid']]); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 350 | } |
| 351 | else |
| 352 | { |
| 353 | $this->_cart_contents[$items['rowid']]['qty'] = $items['qty']; |
| 354 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 355 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 356 | return TRUE; |
| 357 | } |
| 358 | |
| 359 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 360 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 361 | /** |
| 362 | * Save the cart array to the session DB |
| 363 | * |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 364 | * @return bool |
| 365 | */ |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 366 | protected function _save_cart() |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 367 | { |
vlakoff | 3567246 | 2013-02-15 01:36:04 +0100 | [diff] [blame^] | 368 | // Let's add up the individual prices and set the cart sub-total |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 369 | $this->_cart_contents['total_items'] = $this->_cart_contents['cart_total'] = 0; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 370 | foreach ($this->_cart_contents as $key => $val) |
| 371 | { |
| 372 | // We make sure the array contains the proper indexes |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 373 | if ( ! is_array($val) OR ! isset($val['price'], $val['qty'])) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 374 | { |
| 375 | continue; |
| 376 | } |
| 377 | |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 378 | $this->_cart_contents['cart_total'] += ($val['price'] * $val['qty']); |
| 379 | $this->_cart_contents['total_items'] += $val['qty']; |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 380 | $this->_cart_contents[$key]['subtotal'] = ($this->_cart_contents[$key]['price'] * $this->_cart_contents[$key]['qty']); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 381 | } |
| 382 | |
Andrey Andreev | 5645479 | 2012-05-17 14:32:19 +0300 | [diff] [blame] | 383 | // Is our cart empty? If so we delete it from the session |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 384 | if (count($this->_cart_contents) <= 2) |
| 385 | { |
| 386 | $this->CI->session->unset_userdata('cart_contents'); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 387 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 388 | // Nothing more to do... coffee time! |
| 389 | return FALSE; |
| 390 | } |
| 391 | |
| 392 | // If we made it this far it means that our cart has data. |
| 393 | // Let's pass it to the Session class so it can be stored |
| 394 | $this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents)); |
| 395 | |
Andrey Andreev | 17779d6 | 2011-12-22 13:21:08 +0200 | [diff] [blame] | 396 | // Woot! |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 397 | return TRUE; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 401 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 402 | /** |
| 403 | * Cart Total |
| 404 | * |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 405 | * @return int |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 406 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 407 | public function total() |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 408 | { |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 409 | return $this->_cart_contents['cart_total']; |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 410 | } |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 411 | |
Andrew Seymour | f75ec11 | 2011-12-14 09:36:39 +0000 | [diff] [blame] | 412 | // -------------------------------------------------------------------- |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 413 | |
Andrew Seymour | f75ec11 | 2011-12-14 09:36:39 +0000 | [diff] [blame] | 414 | /** |
| 415 | * Remove Item |
| 416 | * |
| 417 | * Removes an item from the cart |
| 418 | * |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 419 | * @param int |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 420 | * @return bool |
Andrew Seymour | f75ec11 | 2011-12-14 09:36:39 +0000 | [diff] [blame] | 421 | */ |
| 422 | public function remove($rowid) |
| 423 | { |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 424 | // unset & save |
Andrew Seymour | f75ec11 | 2011-12-14 09:36:39 +0000 | [diff] [blame] | 425 | unset($this->_cart_contents[$rowid]); |
Andrew Seymour | f75ec11 | 2011-12-14 09:36:39 +0000 | [diff] [blame] | 426 | $this->_save_cart(); |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 427 | return TRUE; |
Andrew Seymour | f75ec11 | 2011-12-14 09:36:39 +0000 | [diff] [blame] | 428 | } |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 429 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 430 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 431 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 432 | /** |
| 433 | * Total Items |
| 434 | * |
| 435 | * Returns the total item count |
| 436 | * |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 437 | * @return int |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 438 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 439 | public function total_items() |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 440 | { |
| 441 | return $this->_cart_contents['total_items']; |
| 442 | } |
| 443 | |
| 444 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 445 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 446 | /** |
| 447 | * Cart Contents |
| 448 | * |
| 449 | * Returns the entire cart array |
| 450 | * |
Timothy Warren | 86611db | 2012-04-27 10:06:25 -0400 | [diff] [blame] | 451 | * @param bool |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 452 | * @return array |
| 453 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 454 | public function contents($newest_first = FALSE) |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 455 | { |
Andrew Seymour | de2e96a | 2011-12-13 16:44:59 +0000 | [diff] [blame] | 456 | // do we want the newest first? |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 457 | $cart = ($newest_first) ? array_reverse($this->_cart_contents) : $this->_cart_contents; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 458 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 459 | // Remove these so they don't create a problem when showing the cart table |
| 460 | unset($cart['total_items']); |
| 461 | unset($cart['cart_total']); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 462 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 463 | return $cart; |
| 464 | } |
| 465 | |
| 466 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 467 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 468 | /** |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 469 | * Get cart item |
| 470 | * |
| 471 | * Returns the details of a specific item in the cart |
| 472 | * |
| 473 | * @param string $row_id |
| 474 | * @return array |
| 475 | */ |
| 476 | public function get_item($row_id) |
| 477 | { |
| 478 | return (in_array($row_id, array('total_items', 'cart_total'), TRUE) OR ! isset($this->_cart_contents[$row_id])) |
| 479 | ? FALSE |
| 480 | : $this->_cart_contents[$row_id]; |
| 481 | } |
| 482 | |
| 483 | // -------------------------------------------------------------------- |
| 484 | |
| 485 | /** |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 486 | * Has options |
| 487 | * |
| 488 | * Returns TRUE if the rowid passed to this function correlates to an item |
| 489 | * that has options associated with it. |
| 490 | * |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 491 | * @param string $row_id = '' |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 492 | * @return bool |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 493 | */ |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 494 | public function has_options($row_id = '') |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 495 | { |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 496 | return (isset($this->_cart_contents[$row_id]['options']) && count($this->_cart_contents[$row_id]['options']) !== 0); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 500 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 501 | /** |
| 502 | * Product options |
| 503 | * |
| 504 | * Returns the an array of options, for a particular product row ID |
| 505 | * |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 506 | * @param string $row_id = '' |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 507 | * @return array |
| 508 | */ |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 509 | public function product_options($row_id = '') |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 510 | { |
Andrey Andreev | cdeee66 | 2012-10-25 17:29:52 +0300 | [diff] [blame] | 511 | return isset($this->_cart_contents[$row_id]['options']) ? $this->_cart_contents[$row_id]['options'] : array(); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 512 | } |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 513 | |
| 514 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 515 | |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 516 | /** |
| 517 | * Format Number |
| 518 | * |
| 519 | * Returns the supplied number with commas and a decimal point. |
| 520 | * |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 521 | * @param float |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 522 | * @return string |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 523 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 524 | public function format_number($n = '') |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 525 | { |
Alex Bilbie | d261b1e | 2012-06-02 11:12:16 +0100 | [diff] [blame] | 526 | return ($n === '') ? '' : number_format( (float) $n, 2, '.', ','); |
Rick Ellis | df39d51 | 2009-02-24 22:29:37 +0000 | [diff] [blame] | 527 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 528 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 529 | // -------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 530 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 531 | /** |
| 532 | * Destroy the cart |
| 533 | * |
| 534 | * Empties the cart and kills the session |
| 535 | * |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 536 | * @return void |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 537 | */ |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 538 | public function destroy() |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 539 | { |
Andrey Andreev | bb24883 | 2011-12-21 16:42:51 +0200 | [diff] [blame] | 540 | $this->_cart_contents = array('cart_total' => 0, 'total_items' => 0); |
Rick Ellis | 9c86ce5 | 2009-02-17 19:54:14 +0000 | [diff] [blame] | 541 | $this->CI->session->unset_userdata('cart_contents'); |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 542 | } |
| 543 | |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 544 | } |
Rick Ellis | 9878332 | 2009-02-17 02:29:44 +0000 | [diff] [blame] | 545 | |
| 546 | /* End of file Cart.php */ |
Andrey Andreev | 6f042cc | 2012-03-26 14:58:33 +0300 | [diff] [blame] | 547 | /* Location: ./system/libraries/Cart.php */ |