PHPackages                             kicaj/cart - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kicaj/cart

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

kicaj/cart
==========

Cart plugin for CakePHP without rebuild existing structure

02851[3 issues](https://github.com/kicaj/cart/issues)PHP

Since Feb 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kicaj/cart)[ Packagist](https://packagist.org/packages/kicaj/cart)[ RSS](/packages/kicaj-cart/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Cart plugin for CakePHP
=======================

[](#cart-plugin-for-cakephp)

**NOTE:** It's still in development mode, do not use in production yet!

Requirements
------------

[](#requirements)

It is developed for CakePHP min. 4.3.

Installation
------------

[](#installation)

You can install plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require kicaj/cart dev-master

```

### Load the Plugin

[](#load-the-plugin)

Ensure the Cart plugin is loaded in your src/Application.php file

```
$this->addPlugin('Cart');

```

or add manually by `cake` command

```
cake plugin load Cart

```

### Configuration

[](#configuration)

Firstly, use Migrations plugin to create tables in your database.

```
cake migrations migrate -p Cart

```

Now, if everything is correct, You can open URL with fragment `localhost/app/cart/carts` and You should see "Cart is empty".

Next, You should set global association to work with your products with Cart plugin.

```
// AppController::initialize()
public function initialize()
{
    parent::initialize();

    // ...

    // Cart relations.
    $this->loadModel('Cart.Carts');

    $this->Carts->CartItems->addAssociations([
        'belongsTo' => [
            'CartItemProducts' => [
                'className' => 'Products', // Class name of existing table of your products
                'type' => 'INNER',
                'foreignKey' => 'identifier',
                'bindingKey' => 'sku', // Unique key for your product (eg. SKU number)
            ],
        ],
    ]);
}

```

The last thing you should do is add button "Add do cart" in your product view.
Open view of product, probably `src/Template/Products/view.ctp` and load the cell:

```
echo $this->cell('Cart.Cart::add', [$product->sku]); // First argument is product unique identiefier

```

Check again `localhost/app/cart/cars`!

That's all!

Troubleshooting
---------------

[](#troubleshooting)

1. I'm getting message "SQLSTATE\[23000\]: Integrity constraint violation: 1048 Column 'price' cannot be null" when I clicked "Add to cart" button.
    If You haven't got column `price` in Your relation table (eg. products), then you can set virtual property in `/Model/Entity/Product.php`.

```
protected $_virtual = ['price'];

protected function _getPrice()
{
    return $this->cost; // Field cost (or value, amout, etc.) in Your table
}

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c20760f298eae29425dd1c6180f208aedd70750a1bf2ecc350956a1587d6b4c?d=identicon)[kicaj](/maintainers/kicaj)

---

Top Contributors

[![kicaj](https://avatars.githubusercontent.com/u/3750725?v=4)](https://github.com/kicaj "kicaj (92 commits)")

---

Tags

cakephpcakephp-plugincartshopping-cart

### Embed Badge

![Health badge](/badges/kicaj-cart/health.svg)

```
[![Health](https://phpackages.com/badges/kicaj-cart/health.svg)](https://phpackages.com/packages/kicaj-cart)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
