An abp application module group that provides basic e-shop service.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
gdlcf88 76b9621666 Upgrade to ABP 9.2.1 7 months ago
..
host/EasyAbp.EShop.Plugins.Baskets.Host.Shared Upgrade to ABP 9.0.2 1 year ago
src Upgrade to ABP 9.2.1 7 months ago
test Upgrade to ABP 9.2.1 7 months ago
.gitattributes Remove the basket module and add plugin module 6 years ago
.gitignore Remove the basket module and add plugin module 6 years ago
EasyAbp.EShop.Plugins.Baskets.sln Fix .sln files and Host.Shared projects 6 years ago
EasyAbp.EShop.Plugins.Baskets.sln.DotSettings Remove the basket module and add plugin module 6 years ago
README.md Create README.md for the baskets module 4 years ago
docker-compose.migrations.yml Remove the basket module and add plugin module 6 years ago
docker-compose.override.yml Remove the basket module and add plugin module 6 years ago
docker-compose.yml Remove the basket module and add plugin module 6 years ago

README.md

EShop.Plugins.Baskets

ABP version NuGet NuGet Download Discord online GitHub stars

🛒 A baskets (cart) plugin for EShop. It supports both the server-side pattern and the client-side pattern.

Installation

  1. Install the following NuGet packages. (see how)

    • EasyAbp.EShop.Plugins.Baskets.Application
    • EasyAbp.EShop.Plugins.Baskets.Application.Contracts
    • EasyAbp.EShop.Plugins.Baskets.Domain
    • EasyAbp.EShop.Plugins.Baskets.Domain.Shared
    • EasyAbp.EShop.Plugins.Baskets.EntityFrameworkCore
    • EasyAbp.EShop.Plugins.Baskets.HttpApi
    • EasyAbp.EShop.Plugins.Baskets.HttpApi.Client
    • (Optional) EasyAbp.EShop.Plugins.Baskets.MongoDB
    • (Optional) EasyAbp.EShop.Plugins.Baskets.Web
  2. Add DependsOn(typeof(EShopXxxModule)) attribute to configure the module dependencies. (see how)

  3. Add builder.ConfigureEShopPluginsBaskets(); to the OnModelCreating() method in MyProjectMigrationsDbContext.cs.

  4. Add EF Core migrations and update your database. See: ABP document.

Server-side Baskets Pattern

The server-side basket is for identified(logon) users. It requests the basket backend service APIs are available.

  1. Before you create a basket item, use /api/e-shop/orders/order/check-create (POST) to check whether the current user is allowed to create an order with it.
  2. Use /api/e-shop/plugins/baskets/basket-item (POST) to create basket items on the server side. Extra properties are allowed.
  3. Use /api/e-shop/plugins/baskets/basket-item (GET) to get basket the item list. The returned "IsInvalid" property shows whether you can use the item to create an order.
  4. Use /api/e-shop/plugins/baskets/basket-item/{id} (PUT) or /api/e-shop/plugins/baskets/basket-item/{id} (DELETE) to change an item's quantity or remove an item.

Client-side Baskets Pattern

You should store the basket items in the client(browser) cache as a collection of IBasketItem. The client-side doesn't depend on the baskets module backend service APIs.

With Backend

If you install the backend, it provides APIs to help refresh your client-side basket items.

  1. Before you create a basket item, use /api/e-shop/orders/order/check-create (POST) to check whether the current user is allowed to create an order with it.
  2. Use /api/e-shop/plugins/baskets/basket-item/generate-client-side-data (POST) to refresh your client-side basket items anytime.

Without Backend

If you don't install the backend, you can still create and store the basket items locally, but the client-side basket items will not validate and never update.

How To Determine a Basket Pattern

The server-side baskets pattern will take effect if all the following conditions are met:

  1. The baskets module backend has been installed and is available.
  2. The EasyAbp.EShop.Plugins.Baskets.EnableServerSideBaskets setting value is "True".
  3. The current user has the EasyAbp.EShop.Plugins.Baskets.BasketItem permission.

What if Anonymous Users Add Basket Items and Then Log In?

The client(browser) should try to add the existing items to the server-side and remove them from the client-side. You can implement it by referring to the index.js.

Use Basket Items To Create an Order

We don't provide a built-in way to convert basket items to an order creation DTO.

Create an order manually by the front end, and remember to map the basket item's extra properties to the order creation DTO since some special product may need them.

After creating the order, the front end should clear the unused basket items.