Download the PHP package marshmallow/cart without Composer
On this page you can find all versions of the php package marshmallow/cart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marshmallow/cart
More information about marshmallow/cart
Files in marshmallow/cart
Package cart
Short Description Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
License MIT
Homepage https://github.com/Marshmallow-Development/
Informations about the package cart
Ecommerce Shopping Cart
This package contains all the logic you need to make use of a shopping cart in your Laravel application. It also contains all the Nova resources you need to manage your store. We use this package at Marshmallow for a lot of customers and add new functionalities when ever we need them. If you wish to use this, please do so and let us know if you have any issues.
Installation
Composer
You can install this package via the following composer command.
Migrate
You need to run the migration from this package to create all the tables we need to do some ecommerce magic.
Middleware
Please add the following middle ware to your web group to make sure the cart is available on every route. If you wish to include this middleware to a select set of route you can do so.
Nova
Run the commands below to publish all the Nova resources that you need to manage all the ecommerce stuff.
Seed tables
We have created seeders for ecommerce site in the Netherlands. If you are running a dutch shop, you can run these seeders. If not, don't run these. Just create your own via the Nova resources you've just created.
Envoirment file
Make sure you set the CURRENCY
value in you .env
file to match the currency you are using.
Events
This package triggers a set of events which you can listen to in your application if you wish to do so.
Name | Description |
---|---|
CustomerCreated | This will be triggered once a new customer has been created. |
OrderCreated | This will be triggerd once a new order has been created. |
Discounts
Setup
To use the discount module, you first need to make sure you have run all the migrations
.
Create the Nova resource
You need to publish the Nova resource to be able to create new discount code's in Nova. Run the command below.
Publish the new config
There is a new config file that handles defaults for the discount functionalities. Run the command below to publish the new config file.
Key | Description |
---|---|
voucher.min_length | The minimum required length of a voucher code |
voucher.exclude_rules | The exlusion rules for the code generator |
default.vat_rate | The default vat rate we need to use for the discount |
default.currency | The default currency we need to use for the discount |
Usage
Adding a discount
To add the discount to a shopping cart, you need to create your own route/endpoint to handle this. You can use the example code below to active the discount. If all is oke, the $response
will be empty. If something went wrong this method will return an error message containing the reason why we couldn't add the discount to the cart.
Deleting a discount
If you made the customer to be able to delete an activated discount from the shopping cart, you will again have to create your own route/endpoint for this. You can then use the example code below to remove the discount from the card.
Cart methods
With the introduction of the discount methods you might need to update the methods that are used in your shopping cart to display cart totals. Please see the new methods below.
Cart methods
Item methods
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of cart with dependencies
marshmallow/nova-flexible Version ^v2.0.0
marshmallow/nova-field-string-generator Version ^v2.0.0
marshmallow/priceable Version ^v3.0.0
marshmallow/products Version ^v3.0.0
marshmallow/payable Version ^v2.0.0
marshmallow/dataset-country Version ^v1.2.2
marshmallow/addressable Version ^v1.6.1
marshmallow/nova-tabs Version ^2.0.3
laravel/nova Version ^4.0