久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Magento - 從訂單中獲取價格規則

Magento - get price rules from order(Magento - 從訂單中獲取價格規則)
本文介紹了Magento - 從訂單中獲取價格規則的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

有誰知道如何從訂單中獲取目錄和購物車價格規則?

does anyone know how one can get the catalog- and cart price rules from an order?

我知道我可以通過 getDiscountPercent() 方法獲取訂單商品的折扣百分比,但是我如何獲取應用于整個訂單的所有規則?

I know that I can get the discount percentage from an order item via the method getDiscountPercent(), but how can I get all the rules that were applied to the whole order?

例如,我有一個規則客戶組 X 可享受商店中所有商品 20% 的折扣".

For example, I have a rule "Customer Group X gets 20% off all items in the store".

現在我想確定在用戶提交訂單時實際應用了哪些規則.我需要這個用于訂單導出界面,我必須在其中提供用戶獲得的所有折扣.

Now I want to determine which rules were actually applied when the order has been submitted by the user. I need this for an order export interface where I have to supply all discounts that the user got.

提前致謝!

推薦答案

查看 sales_flat_order_item 表.有一個名為 applied_rule_ids 的字段,它將為您提供應用于該項目的規則的 ID.您還可以在此表中找到應用了多少折扣和百分比.

Have a look in the sales_flat_order_item table. there is a field called applied_rule_ids which will give you the id of the rule applied to that item. Also you can find out in this table how much discount was applied and the percentage.

例子

//The order I want to check
    $order_id = 859;

    //Get the list of items for your order
    $items = Mage::getModel('sales/order_item')
    ->getCollection()
    ->addFilter('order_id',array('eq'=>$order_id));

    //loop through each item
    foreach($items as $item){

        //if the item has not had a rule applied to it skip it
        if($item->getAppliedRuleIds() == '')continue;

        /*
        * I cant remember in the database they might be comma separated or space if multiple rules were applied
        * the getAppliedRuleIds() function is the one you want
        */
        foreach(explode(",",$item->getAppliedRuleIds()) as $ruleID){        

            //Load the rule object
            $rule = Mage::getModel('catalogrule/rule')->load($ruleID);

            // Throw out some information like the rule name what product it was applied to

            echo "<p>".$item->getSku()." had rule ".$rule->getName()."(".$item->getAppliedRuleIds().") applied </p>";
        }

    }

這篇關于Magento - 從訂單中獲取價格規則的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Override Magento Config(覆蓋 Magento 配置)
What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會導致 print_r 和/或 var_dump 調試變量失敗?)
How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項?)
Magento 404 on Admin Page(管理頁面上的 Magento 404)
Magento Change Product Page Titles to Include Attributes(Magento 更改產品頁面標題以包含屬性)
Magento: adding duties/taxes to a quote during review(Magento:在審查期間向報價添加關稅/稅款)
主站蜘蛛池模板: 国产精品美女久久久久久免费 | 亚洲不卡在线观看 | www.亚洲一区 | 欧美日韩不卡 | 久久久精品一区 | 香蕉一区二区 | 亚洲国产网站 | 欧美日韩成人影院 | 久久精品日产第一区二区三区 | 国产亚洲精品精品国产亚洲综合 | 国产亚洲人成a在线v网站 | 久久精品一 | 91精品中文字幕一区二区三区 | 玖玖爱365| 草草网 | 国产视频一区二区 | 欧美精产国品一二三区 | 精产国产伦理一二三区 | 国产日韩欧美在线观看 | 一区二区三区高清在线观看 | 亚洲精品乱码久久久久久蜜桃 | 网站国产 | 日韩精品久久久 | 久久精品女人天堂av | 亚洲免费观看视频网站 | 国产在线资源 | 亚洲国产精品久久久久婷婷老年 | 国产精品视频久久 | 久久毛片| 国产精品亚洲欧美日韩一区在线 | 一区二区三区四区在线免费观看 | 成人午夜激情 | gogo肉体亚洲高清在线视 | 欧美日韩在线免费 | 在线观看成人小视频 | 久久躁日日躁aaaaxxxx | 日本成人午夜影院 | 日韩精品一区在线 | 一级欧美 | 国产精品永久免费 | 成年人在线视频 |