首页>Magento>source

默认情况下,目录价格规则适用于"价格"字段。

我需要将目录价格规则应用于"special_price"字段。

Default use 例: 如果price = 100,special_price = 90且目录价格规则是80%,则final_price = 80,"价格"的80%

I would like the discount to apply to special_price: 例: 如果price = 100,special_price = 90且目录价格规则是80%,则final_price = 72,80%的"special_price"

最新回答
  • 2019-8-16
    1 #

    创建从收集产品加载开始的观察者.获得此系列的活动。 想法是下一个 - 你有自己的数据库,你有规则(名称,数量,产品的ID)。然后你从观察者那里收集产品,只需比较观察者收集的产品ID和你的产品id s in your 自定义创建的数据库。如果id来自观察者=来自数据库的id,我们设置discount / special_price / price / regullar价格(你可以从你的数据库获得)。

    $qwe = $this->getEvent()->getCollection();
    $your_custom_rule_amount=80%;//get from db your disscount amount.
    foreach($qwe as $product)
    {
      $product->setSpecialPrice($your_custom_rule_amount);//amount set.
       // $product->save(); // you can save this special price in magento db.
    }
    

    对我来说它很完美。

    您还可以在此处阅读有关规则教程的更多信息:

    https://www.mageplaza.com/kb/how-create-a-cart-price-rule-in-magento-2.html

    https://docs.magento.com/m2/ce/user_guide/marketing/price-rules-catalog.html

  • magento 1.9:不发送交易邮件
  • magento 1.7:在不使用load()方法的情况下在模块块中加载产品属性