zakharov-andrew/yii2-shop

Yii2 Shop

Installs: 29

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

v0.1.6 2025-04-05 13:16 UTC

This package is auto-updated.

Last update: 2025-04-19 20:30:22 UTC


README

Latest Stable Version Total Downloads License Yii2

Yii2 shop module. A module for creating an online store based on Yii2. This module provides basic functionality for managing products, categories, orders, and other elements of an e-commerce store.

Features β€’ Installation β€’ Usage β€’ Contributing β€’ License

πŸ‡·πŸ‡Ί Русская вСрсия

✨ Features

  • πŸ“¦ Product Management

    • Create, edit, and delete products.
    • Add attributes and specifications to products.
    • Upload product images.
    • Manage product stock levels.
  • πŸ—‚οΈ Categories and Filters

    • Hierarchical category system.
    • Support for subcategories.
    • Filter products by attributes (color, size, price, etc.).
    • Flexible filter configuration for categories.
  • πŸ“ Order Management

    • Create and manage orders.
    • Order statuses (new, processing, delivered, canceled, etc.).
    • Order history and change tracking.
    • Support for various delivery methods.
  • πŸ›’ Shopping Cart and Checkout

    • Add products to the cart.
    • Edit the cart (change quantities, remove products).
    • Checkout with customer details.
    • Coupon and discount support (planned for future updates).
  • πŸ‘€ User and Role Management

    • User registration and authentication.
    • Role and permission management (admin, manager, customer).
    • User account with order history.
  • πŸ” Search and SEO

    • Search products by name, description, and attributes.
    • SEO optimization: meta tags, human-readable URLs (slug).
    • Sitemap generation (sitemap.xml).
  • 🌐 Multilingual Support

    • Support for multiple languages in the store interface.
  • πŸ“Š Analytics and Reports

    • Sales reports.
    • Product popularity analysis.
    • Export data to CSV, Excel, and other formats.
  • βš™οΈ Store Settings

    • Flexible configuration of core store parameters.
    • Email notification settings for customers and administrators.

πŸš€ 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',
            'storeName' => 'My Store',
            'bootstrapVersion' => 5, // if use bootstrap 5
            'params' => [
                '1' => [
                    'title' => [
                        'en-US' => 'Weight',
                        'ru' => 'ВСс'
                    ]
                ]
            ],
            'defaultProductImage' => '/images/default-product-image.jpg', // Path to the default image for a product
            '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',
                'cart' => 'shop/cart/index',
                'checkout' => 'shop/checkout/index',
                'admin/orders' => 'shop/admin-order/index',
                'admin/orders/<id:\d+>' => 'shop/admin-order/view',
                'admin/orders/update-status/<id:\d+>' => 'shop/admin-order/update-status',
                // ...
            ],
        ],

πŸ‘₯ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.