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

Magento - 從訂單中獲取價(jià)格規(guī)則

Magento - get price rules from order(Magento - 從訂單中獲取價(jià)格規(guī)則)
本文介紹了Magento - 從訂單中獲取價(jià)格規(guī)則的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

有誰(shuí)知道如何從訂單中獲取目錄和購(gòu)物車(chē)價(jià)格規(guī)則?

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

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

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?

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

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

現(xiàn)在我想確定在用戶提交訂單時(shí)實(shí)際應(yīng)用了哪些規(guī)則.我需要這個(gè)用于訂單導(dǎo)出界面,我必須在其中提供用戶獲得的所有折扣.

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 表.有一個(gè)名為 applied_rule_ids 的字段,它將為您提供應(yīng)用于該項(xiàng)目的規(guī)則的 ID.您還可以在此表中找到應(yīng)用了多少折扣和百分比.

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>";
        }

    }

這篇關(guān)于Magento - 從訂單中獲取價(jià)格規(guī)則的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Override Magento Config(覆蓋 Magento 配置)
What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會(huì)導(dǎo)致 print_r 和/或 var_dump 調(diào)試變量失敗?)
How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項(xiàng)?)
Magento 404 on Admin Page(管理頁(yè)面上的 Magento 404)
Magento Change Product Page Titles to Include Attributes(Magento 更改產(chǎn)品頁(yè)面標(biāo)題以包含屬性)
Magento: adding duties/taxes to a quote during review(Magento:在審查期間向報(bào)價(jià)添加關(guān)稅/稅款)
主站蜘蛛池模板: 国产一区二区三区四区区 | 超碰欧美| 国产国产精品久久久久 | 狠狠干天天干 | 91久久精品一区二区二区 | 欧美中文字幕一区二区 | 在线三级电影 | 中文字幕亚洲精品 | 成年免费大片黄在线观看一级 | 成人做爰999 | 精品国产鲁一鲁一区二区张丽 | 人人性人人性碰国产 | 91视视频在线观看入口直接观看 | 免费色网址 | 久久久国产一区二区三区四区小说 | 国产一级成人 | 欧美一区二区三区国产精品 | 欧美一级毛片久久99精品蜜桃 | 国产一区二区三区免费观看视频 | 一区二区三区国产好 | 国产成人精品久久二区二区91 | 中文字幕一区在线观看视频 | 真人女人一级毛片免费播放 | 精品久久一区 | 日韩在线免费视频 | 欧美日韩在线一区 | 成人欧美日韩一区二区三区 | 99视频在线播放 | 精品国产91亚洲一区二区三区www | 欧美日韩精品久久久免费观看 | 一区二区三区精品视频 | 亚洲a在线观看 | 日韩在线观看视频一区 | 国产日屁 | 国产成人免费视频网站高清观看视频 | 欧美精品久久一区 | av资源中文在线 | chengrenzaixian| 精品久久国产 | 精品久久成人 | 性色av一区二区三区 |