laraplug/shop

Laravel Ecommerce Module built on top of AsgardCMS

Maintainers

Details

github.com/laraplug/shop

Source

Issues

Installs: 148

Dependents: 0

Suggesters: 0

Security: 0

Stars: 10

Watchers: 2

Forks: 6

Open Issues: 3

Type:asgard-module

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

This package is not auto-updated.

Last update: 2024-11-10 06:33:27 UTC


README

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

This module is currently under active development.

Need help! English Translation is incomplete. Any PR would be appreciated :)

Laraplug Shop

Laraplug Shop is a flexible, extendable e-commerce module, built on top of AsgardCMS platform.

Integrated with the modules below
laraplug/product-module
laraplug/attribute-module
laraplug/cart-module
laraplug/order-module
laraplug/theme-module (Deprecated)

Table Of Contents

Installation

  1. Install the package via composer:

    composer require laraplug/shop
  2. Execute migrations via AsgardCMS's module command:

    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. Execute publish via AsgardCMS's module command:

    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. Done!

Usage

Extend Product Model

To create your own Book Product Eloquent model on BookStore module, just extend the \Modules\Product\Entities\Product model like this:

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');
    }

}

Add EAV to Product model

Add $systemAttributes to utilize laraplug/attribute-module on code-level like this:

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',
            ]
        ]
    ];
}

Available SystemAttributes Parameters

type : String of input type (list below)

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

options : Array of option keys

has_translatable_values : boolean

Register Your Product

You can register your Entity using ProductManager like this:

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());

        ...
    }
}

About Laraplug

LaraPlug is a opensource project to build e-commerce solution on top of AsgardCMS.

Contributing

We welcome any pull-requests or issues :)