【问题标题】:drupal commerce order save custom field valuedrupal commerce order 保存自定义字段值
【发布时间】:2016-09-29 11:12:22
【问题描述】:

Drupal Commerece,在订单表单中添加了新的自定义字段,称为位置的自定义字段,当应用程序创建新的订单条目时我想更新位置时,首先是下订单时。

当客户添加第二个和第三个项目时,不再对位置字段执行任何操作。

是否有任何钩子会执行上述请求。

【问题讨论】:

    标签: drupal drupal-7 drupal-commerce


    【解决方案1】:

    这里是订单相关的钩子列表:

    http://www.drupalcontrib.org/api/drupal/contributions%21commerce%21modules%21order%21commerce_order.api.php/7

    所以我想说最适合您要求的候选人是:

    hook_commerce_order_presave($order);
    

    在这里您可以检查订单是否刚刚创建或更新,并且可以选择丢弃位置字段值。

    但是,如果您想在下单表单上隐藏该字段,您应该使用

    hook_form_alter() 禁用或隐藏该字段。在此处查看如何执行此操作:

    Drupal 7 - Hide certain form fields of a content edit form depending on the content data

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-14
      • 1970-01-01
      相关资源
      最近更新 更多