【问题标题】:Magento retrieve the 'Minimum order amount' for free shipping valueMagento 检索“最低订单金额”以获得免费送货价值
【发布时间】:2010-02-10 14:38:19
【问题描述】:

我想在 'CartController.php' 类中检索 'Minimum order amount' 值以获得免费送货。

我怎样才能得到这个值? Mage::getStoreConfig() 能胜任吗?但是哪条路呢?

【问题讨论】:

    标签: php magento shipping


    【解决方案1】:

    不含增值税:

    function getRemainingAmount() 
    {
          $symbol  = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
          $total   = Mage::getSingleton('checkout/cart')->getQuote()->getSubtotal();    
          $minimum = Mage::getStoreConfig("carriers/freeshipping/free_shipping_subtotal");
    
          $value = $minimum - $total;
    
          if ($value < 0) {
               return false;    
          } else {   
               return number_format($value, 2) . $symbol;
          }
    }
    

    【讨论】:

      【解决方案2】:

      这些值存储在 core_config_data 表中,搜索WHERE path like '%minimum%' 应该会产生足够少的行,以便您找出哪一个。或者,管理区域中输入字段的“名称”将是用 _s 代替 /s 的路径。

      【讨论】:

      • 非常感谢,感谢您的提示,我设法获得了价值。我还发现了一个通过 print_r(Mage::getStoreConfig('carriers')) 找到路径的好方法。如果有人需要免费送货的最低订单金额,这里是路径“carriers/freeshipping/free_shipping_subtotal”。
      猜你喜欢
      • 2014-12-22
      • 1970-01-01
      • 2016-11-05
      • 2017-07-01
      • 2020-11-26
      • 1970-01-01
      • 1970-01-01
      • 2021-07-05
      相关资源
      最近更新 更多