macopedia / module-omnibusdirective
欧盟综合指令在Magento 2中的实现
1.0.8
2022-12-14 13:55 UTC
README
欧盟综合指令在Magento 2中的实现。
要求
Magento版本 > 2.4.x
主要特性
- 历史价格
- 添加
历史价格
和历史价格更新时间
产品属性 - 保持过去30天的最低价格 - 从
价格
和特别价格
属性在管理员面板中保存产品后的更改计算得出 - 定时任务,删除30天前的历史价格
- 在产品查看页面上显示历史价格
- 添加
- 可信评论验证
- 通过额外的输入
order_number
扩展产品评论表单 - 通过订单号(增量ID)验证购买的产品 - 只有验证过的买家才能为产品添加评论
- 通过额外的输入
未实现的功能
- 在删除特别价格值之前检查特别价格日期的范围
- 通过Rest API和Soap API保存后计算历史价格
- 在产品批量操作更新后计算历史价格
- 保留过去30天内的所有价格变更
- 按客户组保留历史价格
- 保留由目录规则计算的历史价格
- 保留历史层价格
安装
- 使用composer
composer require macopedia/module-omnibusdirective
- 使用zip文件
- 下载zip文件
- 在目录
app/code/Macopedia/OmnibusDirective
中解压缩模块
启用模块并安装补丁
bin/magento module:enable Macopedia_OmnibusDirective
bin/magento setup:upgrade
注意 - 如果您有自定义主题和修改过的评论表单模板文件 Magento_Review/templates/form.phtml
,您需要手动添加 order_id
输入(请参阅文件 view/frontend/templates/review/form.phtml
中的示例)
<div class="field review-field-order-id required"> <label for="order_id_field" class="label"><span><?= $block->escapeHtml(__('Order number')) ?></span></label> <div class="control"> <input type="text" name="order_id" id="order_id_field" class="input-text" data-validate="{required:true}" data-bind="value: review().order_id" /> </div> </div>
价格导入
如果您有导入价格的自定义脚本,您可以使用方法 \Macopedia\OmnibusDirective\Model\Product\HistoricalPrice::getHistoricalPriceUpdateValue
来计算历史价格。作为参数,您应传递包含原始价格数组的数组 $origData
(导入值之前)
$origData = [ 'special_price' => xxx, 'historical_price' => xxx, 'price' => xxx ]
和更新后的价格数组 $data
(导入值之后)
$data = [ 'special_price' => xxx, 'price' => xxx ]