ACP2E-4653:REST API中缺少购物车价格规则类别范围条件
ACP2E-4653修补程序修复了在通过REST API检索或更新规则时,未显示 Category (Parent Only) 和 Category (Children Only) 的购物车价格规则条件属性范围的问题。 安装Quality Patches Tool (QPT) 1.1.80时,此修补程序可用。 修补程序ID为ACP2E-4653。 请注意,此问题计划在Adobe Commerce 2.4.9中修复。
受影响的产品和版本
为Adobe Commerce版本创建了修补程序:
- Adobe Commerce(所有部署方法) 2.4.8-p2
与Adobe Commerce版本兼容:
- Adobe Commerce(所有部署方法) 2.4.8 - 2.4.8-p5
NOTE
该修补程序可能适用于具有新Quality Patches Tool发行版本的其他版本。 要检查修补程序是否与您的Adobe Commerce版本兼容,请将
magento/quality-patches包更新到最新版本,并在Quality Patches Tool:搜索修补程序页面上检查兼容性。 使用修补程序ID作为搜索关键字来查找修补程序。问题
当通过REST API检索或更新购物车价格规则时,Category (Parent Only)和 Category (Children Only) 的属性范围未公开。
重现步骤:
- 使用管理员凭据向
rest/V1/integration/admin/token发送POST请求以生成管理员令牌。 - 通过使用REST终结点
rest/V1/salesRules和使用category_ids属性的操作条件来创建购物车价格规则。 - 在“管理”面板中,打开购物车价格规则。 在 Actions 部分的 Apply the rule only to cart items matching the following conditions (leave blank for all items 下,手动添加 Category (Children Only) 条件。
- 设置条件,使 Category (Children Only) 不是
<category_id>。 - 通过向
rest/V1/salesRules/<rule_id>发送GET请求,通过API检索规则。 - 观察响应中返回的
action_condition值。
预期的结果:
-
应该可以通过REST API创建、检索和更新具有 Category (Children Only) 条件的购物车价格规则。
-
应显式公开属性作用域,以便正确区分类别、Category (Parent Only)和Category (Children Only)。 例如,
action_condition应按如下方式返回:code language-none "action_condition": { "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine", "conditions": [ { "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product", "operator": "!=", "attribute_name": "category_ids", "value": "4", "extension_attributes": { "attribute_scope": "" } }, { "condition_type": "Magento\\SalesRule\\Model\\Rule\\Condition\\Product", "operator": "==", "attribute_name": "category_ids", "value": "5", "extension_attributes": { "attribute_scope": "children" } } ], "aggregator_type": "all", "operator": null, "value": "1" },
实际结果:
- 两个条件属性名称都作为
category_ids返回。 - 不清楚如何通过REST API创建或更新具有 Category (Children Only) 条件的规则。
应用修补程序
要应用单独的修补程序,请根据您的部署方法使用以下链接:
- Adobe Commerce或Magento Open Source内部部署: Quality Patches Tool指南中的Quality Patches Tool >使用情况。
- 云基础架构上的Adobe Commerce:云基础架构上的Commerce指南中的升级和修补程序>应用修补程序。
相关阅读
要了解有关Quality Patches Tool的更多信息,请参阅:
recommendation-more-help
commerce-operations-help-tools