【问题标题】:Combine like products on the same line item in the cart在购物车中的同一行项目中合并同类产品
【发布时间】:2015-07-13 15:29:19
【问题描述】:

我遇到了与here 相同的问题,但以下解决方案不起作用。我确实启用了“商务产品选项”。

我也用这个钩子改变价格,

function mectronic_get_amount_qty($price, $length) {
    //print '<pre>P ' . print_r($price, 1) . '</pre>';
    //print '<pre>L ' . print_r($length, 1) . '</pre>';

    if ($length >= 1 && $length <= 5) return $price;
    elseif ($length >= 6 && $length <= 10) return $price * (1 - 0.166666667);
    elseif ($length > 10) return $price * (1 - 0.285714286);
}

我试过了

$entity->commerce_pricing_attributes[$set_id['set_id']][$field_name] = $price;

与 #4 一样,但它不起作用。

【问题讨论】:

  • 抱歉添加了链接

标签: drupal drupal-7 drupal-commerce drupal-hooks


【解决方案1】:

https://www.drupal.org/node/2056711#comment-9474069

使用 hook_commerce_cart_product_comparison_properties_alter() 取消设置“commerce_pricing_attributes”属性。

如果您需要通过此属性区分您的订单项。我建议你使用规则模块。

【讨论】:

    猜你喜欢
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-10
    • 1970-01-01
    • 2018-02-17
    • 1970-01-01
    • 2017-07-13
    相关资源
    最近更新 更多