black-lamp / blcms-shop
Black-Lamp CMS的商店模块
Requires
- php: >=7.0
- 2amigos/yii2-tinymce-widget: *
- black-lamp/blcms-staticpage: 0.*
- black-lamp/yii2-email-templates: ^3.0.0
- black-lamp/yii2-imagable: 1.*
- black-lamp/yii2-multi-lang: ^1.0.0
- black-lamp/yii2-seo: 0.1.*
- evgeniyrru/yii2-slick: 1.0.1
- kartik-v/yii2-widgets: *
- marqu3s/yii2-summernote: dev-master
- yii2tech/ar-position: *
- yiisoft/yii2: >=2.0.4
- yiisoft/yii2-bootstrap: *
- dev-master
- v0.5.21
- 0.5.20
- 0.5.19
- 0.5.18
- 0.5.17
- 0.5.16
- 0.5.15
- 0.5.14
- 0.5.13
- 0.5.12
- 0.5.11
- 0.5.10
- v0.5.9
- v0.5.8
- v0.5.7
- v0.5.6
- v0.5.5
- 0.5.4
- v0.5.3
- v0.5.2
- v0.5.1
- v0.5.0
- 0.4.9
- 0.4.8
- 0.4.7
- v0.4.6
- v0.4.5
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.3.1
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.0
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- 0.1.7
- 0.1.6
- 0.1.5.9
- 0.1.5.5
- v0.1.5.4
- v0.1.5.3
- 0.1.5.2
- 0.1.5.1
- 0.1.5.0
- 0.1.4.11
- 0.1.4.10
- 0.1.4.9
- 0.1.4.8
- 0.1.4.7
- 0.1.4.6
- 0.1.4.5
- 0.1.4.4
- 0.1.4.3
- 0.1.4.2
- 0.1.4.1
- 0.1.4.0
- 0.1.3.12
- 0.1.3.11
- 0.1.3.10
- 0.1.3.9
- 0.1.3.8
- 0.1.3.7
- 0.1.3.6
- 0.1.3.5
- 0.1.3.4
- 0.1.3.3
- 0.1.3.2
- 0.1.3.1
- 0.1.3.0
- 0.1.2.9
- 0.1.2.8
- 0.1.2.7
- 0.1.2.6
- 0.1.2.5
- 0.1.2.4
- 0.1.2.3
- 0.1.2.2
- 0.1.2.1
- 0.1.2.0
- 0.1.1.9
- 0.1.1.8
- 0.1.1.7
- 0.1.1.6
- 0.1.1.5
- 0.1.1.4
- 0.1.1.3
- 0.1.1.2
- 0.1.1.1
- 0.1.1
- 0.1.0.9
- 0.1.0.8
- 0.1.0.7
- 0.1.0.6
- 0.1.0.5
- 0.1.0.4
- 0.1.0.3
- 0.1.0.2
- 0.1.0.1
- 0.1
- 0.0.10
- 0.0.9.1
- 0.0.9
- 0.0.8.2
- 0.0.8.1
- 0.0.8
- 0.0.7
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- 0
- dev-poolsgallery
This package is not auto-updated.
Last update: 2024-09-17 04:12:51 UTC
README
应用迁移: !重要:必须在Dectrium-User模块迁移之后应用此迁移。
- php yii migrate --migrationPath=@yii/rbac/migrations - php yii migrate --migrationPath=@vendor/black-lamp/blcms-shop/migrations
对于购物车模块
- php yii migrate --migrationPath=@vendor/black-lamp/blcms-cart/migrations
Imagable模块的配置
'shop_imagable' => [ 'class' => bl\imagable\Imagable::className(), 'imageClass' => \bl\imagable\instances\CreateImageImagine::className(), 'nameClass' => bl\imagable\name\CRC32Name::className(), 'imagesPath' => '@frontend/web/images', 'categories' => [ 'origin' => false, 'category' => [ 'shop-product' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 500, 'height' => 500, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], 'shop-vendors' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 320, 'height' => 240, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], 'delivery' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 500, 'height' => 500, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], 'shop-category/cover' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 500, 'height' => 500, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], 'shop-category/thumbnail' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 500, 'height' => 500, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], 'shop-category/menu_item' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 500, 'height' => 500, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], 'payment' => [ 'origin' => false, 'size' => [ 'big' => [ 'width' => 1500, 'height' => 500 ], 'thumb' => [ 'width' => 500, 'height' => 500, ], 'small' => [ 'width' => 150, 'height' => 150 ] ] ], ] ] ],
将模块添加到您的后端配置中
'bootstrap' => [ //'bl\cms\shop\backend\components\events\PartnersBootstrap', 'bl\cms\shop\backend\components\events\ShopLogBootstrap', 'bl\cms\cart\backend\components\events\CartBootstrap', ], 'modules' => [ 'shop' => [ 'class' => 'bl\cms\shop\backend\Module', 'enableCurrencyConversion' => true ] ], 'components' => [ 'urlManagerFrontend' => [ 'class' => bl\multilang\MultiLangUrlManager::className(), 'baseUrl' => '/', 'showScriptName' => false, 'enablePrettyUrl' => true, 'enableDefaultLanguageUrlCode' => false, 'rules' => [ [ 'class' => bl\articles\UrlRule::className() ], [ 'class' => bl\cms\shop\UrlRule::className(), 'prefix' => 'shop' ], ] ] ]
将模块添加到您的前端配置中
'modules' => [ ... 'shop' => [ 'class' => bl\cms\shop\frontend\Module::className(), 'enableCurrencyConversion' => true, 'partnerManagerEmail' => $params['partnerManagerEmail'], 'senderEmail' => $params['senderEmail'], 'showChildCategoriesProducts' => false ], ... ], 'components' => [ ... 'urlManager' => [ ... 'rules' => [ ... [ 'class' => bl\cms\shop\UrlRule::className(), 'prefix' => 'shop' ] ], ... ], 'partnerMailer' => [ 'class' => yii\swiftmailer\Mailer::className(), 'useFileTransport' => false, 'messageConfig' => [ 'charset' => 'UTF-8', ], 'viewPath' => '@vendor/black-lamp/blcms-shop/frontend/views/partner-request/mail', 'htmlLayout' => '@vendor/black-lamp/blcms-shop/frontend/views/partner-request/mail/layout', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'username' => 'info@mail.com', 'password' => '55555555', 'host' => 'pop.mail.com', 'port' => '587', ], ], ... ] 'bootstrap' => [ 'bl\cms\shop\frontend\components\events\PartnersBootstrap', 'bl\cms\cart\frontend\components\events\UserRegistrationBootstrap' ],
如果您需要一些控制台导入脚本
'modules' => [ 'shop' => [ 'class' => \bl\cms\shop\console\Module::className(), 'importActions' => [ 'basic' => [ 'class' => bl\cms\shop\console\actions\import\BasicAction::className() ] ] ] ],
需求
- PHP版本:7.0或更高
- PHP扩展:file-info, imagick, intl
角色及其权限
attributeManager
- addAttributeValue
- deleteAttribute
- saveAttribute
- viewAttributeList
countryManager
- saveCountry
- viewCountryList
- deleteCountry
currencyManager
- updateCurrency
- viewCurrencyList
- deleteCurrency
deliveryMethodManager
- saveDeliveryMethod
- viewDeliveryMethodList
- deleteDeliveryMethod
filterManager
- deleteFilter
- saveFilter
- viewFilterList
orderManager
- deleteOrder
- deleteOrderProduct
- viewOrder
- viewOrderList
orderStatusManager
- saveOrderStatus
- viewOrderStatusList
- deleteOrderStatus
productAvailabilityManager
- saveProductAvailability
- viewProductAvailabilityList
- deleteProductAvailability
productManager
- createProduct
- createProductWithoutModeration
- deleteOwnProduct
- deleteProduct
- updateOwnProduct
- updateProduct
- viewCompleteProductList
- viewProductList
productPartner
- accessAdminPanel
- createProduct
- createProductWithoutModeration
- deleteOwnProduct
- deleteProduct
- updateOwnProduct
- updateProduct
- viewCompleteProductList
- viewProductList
shopCategoryManager
- saveShopCategory
- viewShopCategoryList
vendorManager
- saveVendor
- viewVendorList
- deleteVendor
shopAdministrator继承自所有管理员的权限。
小部件
推荐产品
示例
<?= \bl\cms\shop\widgets\RecommendedProducts::widget([
'id' => $product->id,
]); ?>
您也可以在视图中使用bl\cms\shop\widgets\assets\RecommendedProductsAsset。
筛选小部件
要使用小部件,您必须在模型中设置关系。例如在Product模型中
/** * @return \yii\db\ActiveQuery */ public function getProductCountry() { return $this->hasOne(ProductCountry::className(), ['id' => 'country_id']); }
日志记录
您的应用程序可以记录有多少人观看特定的产品。要启用日志记录,您必须在前端配置文件中添加以下设置
public $log = [
'enabled' => true,
'maxProducts' => 10 // Max number of viewed products by one user.
];
在其中,您指定要存储在shop_product_views表中一个用户的产品数量。此值可以是'全部',即无限。
如果'maxProducts'属性值为'全部',则注册用户的产品对象'浏览'次数将增加一次。否则,每次注册用户查看产品时都会增加一次。
翻译
该模块在几种语言上都有翻译。如果没有您需要的语言或如果您想自己更改它,您可以在后端或前端配置文件中配置它
'i18n' => [
'translations' => [
'shop' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@backend/messages',
'sourceLanguage' => 'en-us',
]
],
],
报告
- "未找到类'Imagick'"
如果您使用PHP 7的OpenServer,您必须像这里一样安装Imagick扩展http://open-server.ru/forum/viewtopic.php?f=4&t=2897&hilit=imagick
产品显示
您可以选择两种模式之一:显示当前分类及其子分类的产品或仅显示当前分类的产品。使用前端模块类配置中的$showChildCategoriesProducts属性。迁移
日志记录 此配置适用于商店模块和购物车模块。
要启用日志记录,请在通用配置文件中添加日志组件。
'components' => [
'log' => [
'targets' => [
[
'logTable' => 'shop_log',
'class' => 'yii\log\DbTarget',
'levels' => ['info'],
'categories' => [
'afterCreateProduct', 'afterDeleteProduct', 'afterEditProduct',
'afterCreateCategory', 'afterEditCategory', 'afterDeleteCategory',
],
],
[
'logTable' => 'cart_log',
'class' => 'yii\log\DbTarget',
'levels' => ['info'],
'categories' => [
'afterChangeOrderStatus'
],
],
[
'logTable' => 'user_log',
'class' => 'yii\log\DbTarget',
'levels' => ['info'],
'categories' => [
'afterRegister', 'afterConfirm'
],
],
],
],
然后在配置您的应用程序之后应用迁移。迁移将创建配置中列出的日志目标的表格。
php yii migrate --migrationPath=@yii/log/migrations/
在您的模块的后端和前端配置中添加
'enableLog' => true,
供应商列表
- /shop/vendor
合作伙伴请求电子邮件 创建新的模板 'partner-request-manager' 和 'partner-request-partner':/admin/email-templates/default/list
您可以使用以下变量:'{contact_person}', '{company_name}', '{website}', '{message}', '{name}', '{surname}', '{patronymic}', '{info}'
同时创建没有变量的模板 'partner-request-accept'。
产品合作伙伴向经理的新产品信息 - 模板 'new-product-to-manager'。您可以使用以下变量:{productId}, {title}, {ownerId}, {ownerEmail}, {owner}, {link}。为了将有关新产品的信息发送给创建此产品的合作伙伴,添加带有变量 {productId}, {title}, {ownerId}, {ownerEmail}, {owner}, {link} 的模板 'new-product-to-partner'。
如果产品经过审核并且状态为 '接受',则将发送邮件 'accept-product-to-owner'。您可以使用以下变量:{title}, {ownerEmail}, {owner}, {link}