zakharov-andrew/yii2-shop

Yii2 Shop

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

0.0.10 2024-02-11 15:28 UTC

This package is auto-updated.

Last update: 2024-10-23 22:13:04 UTC


README

Latest Stable Version Total Downloads License Yii2

Yii2 shop module. Supports loading images for products, editing descriptions of decoctions and categories through the WYSIWYG editor.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require zakharov-andrew/yii2-shop

or add

"zakharov-andrew/yii2-shop": "*"

to the require section of your composer.json file.

Subsequently, run

./yii migrate/up --migrationPath=@vendor/zakharov-andrew/yii2-shop/migrations

in order to create the settings table in your database.

Or add to console config

return [
    // ...
    'controllerMap' => [
        // ...
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@console/migrations', // Default migration folder
                '@vendor/zakharov-andrew/yii2-shop/src/migrations'
            ]
        ]
        // ...
    ]
    // ...
];

Usage

Add this to your main configuration's modules array

    'modules' => [
        'shop' => [
            'class' => 'ZakharovAndrew\shop\Module',
            'catalogTitle' => 'Catalog Title',
            'bootstrapVersion' => 5, // if use bootstrap 5
            'params' => [
                '1' => [
                    'title' => [
                        'en' => 'Weight',
                        'ru' => 'Вес'
                    ]
                ]
            ],
            'uploadWebDir' => '/web/path/to/upload/dir/'
        ],
        'imageupload' => [
            'class' => 'ZakharovAndrew\imageupload\Module',
            'uploadDir' => '/path/to/upload/dir/',
        ],
        // ...
    ],

Note: the maximum number of additional parameters is 3. Change the value of uploadDir to the directory for uploading images. Uses the yii2-image-upload-widget module to upload images.

Add this to your main configuration's urlManager array

'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
                // ...
                'catalog/<url:[\w\-]+>' => 'shop/product-category/view',
                'catalog' => 'shop/catalog/index',
                'product/<url:[\w\d\-]+>' => 'shop/product/view',
                // ...
            ],
        ],

License

yii2-shop it is available under a MIT License. Detailed information can be found in the LICENSE.md.