aminkt/yii2-ordering-module

为购物网站提供的Yii2排序模块

v1.0.0 2017-04-21 07:20 UTC

This package is auto-updated.

Last update: 2024-09-25 15:43:23 UTC


README

如何安装此模块

步骤1:首先将以下代码添加到项目中的 composer.json

"repositories": [
    {
        "type": "gitlab",
        "url": "https://gitlab.com/aminkt/yii2-ordering-module"
    }
],

然后,在 composer.json 的 require 部分添加以下行

"aminkt/yii2-ordering-module": "*",

之后,在您的 composer 中运行以下命令

Composer update aminkt/yii2-ordering-module

步骤2:在您的应用程序配置的 modules 部分添加以下行

'ordering' => [
    'class' => \aminkt\ordering\Order::className(),
    'orderModelName' => models\Order::className(),
    'orderItemModelName' => models\OrderItem::className(),
    'customerProfileModelName' => models\Customer::className(),
    'productModelName' => models\Product::className(),
],

步骤3:在您的应用程序配置的 components 部分添加以下行

'order' => [
    'class' => aminkt\ordering\components\Order::className(),
    'orderModel'=> models\Order::className(),
    'orderItemModel'=> models\OrderItem::className(),
],

步骤4:实现

  • 在您的订单模型中实现 OrderInterface
  • 在您的订单项模型中实现 OrderItemInterface
  • 在您的客户用户模型中实现 CustomerProfileInterface
  • 在您的产品模型中实现 ProductInterface

步骤5:享受模块带来的便利。

由 Amin Keshavarz 创建

ak_1596@yahoo.com

Gitlab 仓库