neosrulez / neos-cart
A shopping cart package for Neos Flow applications.
Installs: 61
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:neos-package
Requires
- php: ^7.4 || ^8.0 || ^8.1
- gedmo/doctrine-extensions: ^3.10 || *
- neos/flow: ^6.0 || ^7.0 || ^8.0
This package is not auto-updated.
Last update: 2024-11-14 14:12:14 UTC
README
A shopping cart package for Neos Flow applications.
Installation
Just run:
composer require neosrulez/neos-cart
Configuration
NeosRulez: Neos: Cart: isNetCart: true slots: summary: subTotal: class: '\Acme\Package\Domain\Service\Cart\Summary\SubTotal' # executes the action "execute" and pass arguments to overrule the default action taxes: class: '\Acme\Package\Domain\Service\Cart\Summary\Taxes' # executes the action "execute" and pass arguments to overrule the default action total: class: '\Acme\Package\Domain\Service\Cart\Summary\Total' # executes the action "execute" and pass arguments to overrule the default action
Usage
Create a form. Whether it's a Neos Fusion form or a simple HTML form in a React component.
<form> <!-- Required properties for item--> <input type="text" name="item[quantity]" value="1" /> <input type="hidden" name="item[sku]" value="StockKeepingUnit" /> <input type="hidden" name="item[price]" value="25.50" /> <input type="hidden" name="item[tax]" value="20.00" /> <!-- Your custom item properties--> <input type="text" name="item[properties][foo]" value="Foo" /> <input type="text" name="item[properties][bar]" value="Bar" /> <input type="text" name="item[properties][bars]" value="Bars" /> <button type="submit">Add to cart</button> </form>
use NeosRulez\Neos\Cart\Domain\Model\Cart; use NeosRulez\Neos\Cart\Domain\Model\Cart; use NeosRulez\Neos\Cart\Domain\Dto\Shipping; // Inject cart session model /** * @Flow\Inject * @var Cart */ protected $cart; // Item $this->cart->add($item); $this->cart->update($item); $this->cart->delete($item); // Cart $items = $this->cart->getItems(); $shipping = $this->cart->getShipping(); $summary = $this->cart->getSummary(); $this->cart->flush(); // Summary $newShipping = new Shipping(); $newShipping->setPrice(14.90); $newShipping->setTax(20); $newShipping->setProperty('name' => 'Worldwide shipping'); $this->cart->setShipping($shipping);
Routes
Author
- E-Mail: mail@patriceckhart.com
- URL: http://www.patriceckhart.com