PHP code example of neosrulez / neos-cart
1. Go to this page and download the library: Download neosrulez/neos-cart library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
neosrulez / neos-cart example snippets
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);