Правила скидки на Объем Торгового количества


Я пытаюсь установить правило ценообразования в торговле drupal, чтобы, если у клиента в корзине 14 товаров, он получал скидку 10 % от своего заказа. Вот что я попробовал:

{ "rules_overall_discount" : {
    "LABEL" : "Volume Discount",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [
      "php",
      "inline_conditions",
      "commerce_line_item",
      "commerce_product_reference"
    ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "commerce_order_has_specific_quantity_products" : {
          "commerce_order" : [ "site:current-cart-order" ],
          "products" : "\u003C? $commerce_line_item ?\u003E",
          "operator" : "\u003C",
          "quantity" : "14"
        }
      }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_multiply" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : ".9",
          "component_name" : "base_price",
          "round_mode" : "1"
        }
      }
    ]
  }
}

Я думаю, что:

"products" : "\u003C? $commerce_line_item ?\u003E",

Может быть проблема. Он запрашивает артикул, но я просто хочу, чтобы он применялся ко всему.

Author: Matt Coady, 2014-09-22

1 answers

Понял это. Вот настройки правил. Это приведет к снижению вашего заказа на 10%, если общее количество вашей корзины составляет 14+

{ "rules_overall_discount" : {
    "LABEL" : "Volume Discount",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "commerce_order", "commerce_line_item", "commerce_product_reference" ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "commerce_order_compare_total_product_quantity" : {
          "commerce_order" : [ "site:current-cart-order" ],
          "operator" : "\u003E=",
          "value" : "14"
        }
      }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_multiply" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : ".9",
          "component_name" : "base_price",
          "round_mode" : "1"
        }
      }
    ]
  }
}
 2
Author: Matt Coady, 2014-09-22 06:27:22