更新时间:2023-11-30 13:20:40
好的,所以这是我根据您在问题中提供的新信息给出的新答案
OK, so here's my new answer based on the new info you provided in your question
================================
=================================
因此,这可能比您预期的要复杂一些,但并非不可能!有两点很重要:
So this is probably a little more complicated than you expected, but not impossible! Two things are important:
这是操作方法:
在配置循环时,告诉它通过"commerce-order:commerce-line-items"进行迭代,然后重命名,或者记住在调用每个订单项时要调用的内容.
When configuring the loop, tell it to iterate through 'commerce-order:commerce-line-items' and either rename, or remember what it's going to call each line item as it goes through it.
现在-当它遍历您订单的每个订单项时,我们将要使用其自己的条件"和操作"集调用一条完整的新规则.我们需要的条件是检查订单项是否包含您期望的产品,并且该操作可以是您想要的任何操作-根据特定字段或任何内容发布节点.就我而言,该操作只是发送电子邮件以证明我找到了产品.当我们需要规则中的条件操作集时,我们需要创建一个规则组件!
Now - as it's going through each of your order's line items, we'll want to call an entire new rule with its own set of 'condition' and 'action'. The condition we need is to check that the line item contains the product you expect, and the action can be whatever you want - publish a node based on a certain field or whatever. In my case, the action will just be sending an email to prove I found a product. When we need condition-action sets within a rule, we need to create a rule component!!
转到/admin/config/workflow/rules/components创建一个新的规则组件,以针对上述每个项目运行.点击页面顶部的添加新组件"链接
Go to /admin/config/workflow/rules/components to create a new rule component to run for each of the above items. Click the 'Add new component' link at the top of the page
从下拉选项中选择"规则",因为这将是既包含条件又包含操作的组件
Select 'Rule' from the drop-down options, since this will be a component that contains both a condition and an action
命名规则,在变量"部分中,我们必须让它知道我们将为其传递一个要使用的参数.在我们的例子中,将是当前正在迭代的商务订单项.
Name the rule, and in the 'Variables' section, we have to let it know we're going to pass it a parameter to work with. In our case, it will be the commerce line item that is currently being iterated through.
但是首先-保存后,如何为每种订单项类型调用此组件?继续阅读:
But first - how do I call this component for each of my line item types after I save it?? Read on:
哇!有点复杂,但我希望它能使您朝正确的方向前进!
Whew! It's a little complicated, but I hope it puts you in the right direction!