英文:
Check if a rule is passed in Cart rules
问题
我可以看到规则应用于购物车,并在 CheckoutCartPageLoadedEvent
事件中使用以下代码:
$event->getPage()->getCart()->getRuleIds()
但是,我如何知道某个规则是否已通过或未通过呢?根据我理解,RuleIds 数组包含了所有已评估的规则,但我无法确定它们是否通过或未通过。
英文:
I can see the rules applied to a cart with
CheckoutCartPageLoadedEvent
$event->getPage()->getCart()->getRuleIds()
but how can I know if a certain rule passed or not? For what I understand the RuleIds array contains all the rules evaulated, but I can't see if they are passed or not.
答案1
得分: 2
ruleIds
列表属性应仅包含从当前Context
对象或当前Cart
对象检索的rule
实体的ID,这些实体的评估结果为true
。如果包括某个ID,则表示规则的条件得到满足,否则表示条件未得到满足。
英文:
Both ruleIds
list properties retrieved from either the current Context
object or the current Cart
object should only contain the ids of rule
entities that evaluated to true
. If an id is included, the rule's conditions were met, otherwise they weren't.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论