laraplug/shop

Laravel Ecommerce Module基于AsgardCMS构建

维护者

详细信息

github.com/laraplug/shop

源代码

问题

安装: 148

依赖: 0

建议者: 0

安全性: 0

星标: 10

关注者: 2

分支: 6

开放性问题: 3

类型:asgard-module

v0.3.0 2018-05-09 14:44 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:55:16 UTC


README

Latest Stable Version Software License Daily Downloads Monthly Downloads Total Downloads PHP7 Compatible

此模块目前正在积极开发中。

需要帮助!英文翻译不完整。任何PR都将是受欢迎的 :)

Laraplug Shop

Laraplug Shop是一个灵活、可扩展的电子商务模块,基于AsgardCMS平台。

集成了以下模块
laraplug/product-module
laraplug/attribute-module
laraplug/cart-module
laraplug/order-module
laraplug/theme-module(已弃用)

目录

安装

  1. 通过composer安装包

    composer require laraplug/shop
  2. 通过AsgardCMS的模块命令执行迁移

    php artisan module:migrate Attribute
    php artisan module:migrate Product
    php artisan module:migrate Cart
    php artisan module:migrate Order --seed
    php artisan module:migrate Shop --seed
  3. 通过AsgardCMS的模块命令执行发布

    php artisan module:publish Attribute
    php artisan module:publish Product
    php artisan module:publish Cart
    php artisan module:publish Order
    php artisan module:publish Shop
    
  4. 完成!

使用

扩展产品模型

要在BookStore模块上创建自己的Book产品Eloquent模型,只需像这样扩展\Modules\Product\Entities\Product模型

use Modules\Product\Entities\Product;

class Book extends Product
{
    // Override entityNamespace to identify your Model on database
    protected static $entityNamespace = 'bookstore/book';

    // Override this method to convert Namespace into Human-Readable name
    public function getEntityName()
    {
        return trans('bookstore::books.title.books');
    }

}

将EAV添加到产品模型

$systemAttributes添加到代码级别上利用laraplug/attribute-module,如下所示

use Modules\Product\Entities\Product;

class Book extends Product
{
    ...

    // Set systemAttributes to define EAV attributes
    protected $systemAttributes = [
        'isbn' => [
            'type' => 'input'
        ],
        'media' => [
            'type' => 'checkbox',
            'options' => [
                'audio-cd',
                'audio-book',
                'e-book',
            ]
        ]
    ];
}

可用的系统属性参数

type:输入类型字符串(如下所示)

  • input:input[type=text]
  • textarea:teaxarea
  • radio:input[type=radio]
  • checkbox:input[type=checkbox]
  • select:select
  • multiselect:select[multiple]

options:选项键数组

has_translatable_values:布尔值

注册您的产品

您可以使用ProductManager注册您的实体,如下所示

use Modules\Product\Repositories\ProductManager;
use Modules\BookStore\Products\Book;

class BookStoreServiceProvider extends ServiceProvider
{
    ...

    public function boot()
    {
        ...

        // Register Book
        $this->app[ProductManager::class]->registerEntity(new Book());

        ...
    }
}

关于Laraplug

LaraPlug是一个开源项目,旨在在AsgardCMS之上构建电子商务解决方案。

贡献

我们欢迎任何pull-requests或问题 :)