pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

Magento:在審查期間向報價添加關(guān)稅/稅款

Magento: adding duties/taxes to a quote during review(Magento:在審查期間向報價添加關(guān)稅/稅款)
本文介紹了Magento:在審查期間向報價添加關(guān)稅/稅款的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我需要調(diào)用第 3 方 API,以便在結(jié)帳流程的審核階段了解國際運輸?shù)淖钚玛P(guān)稅/稅費.我已準(zhǔn)備好 API 調(diào)用,但是我缺少將退回的關(guān)稅和稅款添加到報價中的方法.

I need to make a call to a 3rd party API to get up to date Duties/Taxes for international shipping during the review stage of the checkout process. I have the API call ready to go, however I am missing a way to add the returned duties and taxes to the quote.

有沒有內(nèi)置的方法來做到這一點?

Is there a built in way to do this?

我希望有類似的東西

$quote->addCostComponent("Duties", 5.0);

推薦答案

您需要執(zhí)行以下步驟:

  1. 首先,您需要為您的關(guān)稅/稅款創(chuàng)建屬性以按順序顯示它們,而不僅僅是添加到總計中.應(yīng)該至少有兩個屬性,一個是網(wǎng)站貨幣的價值(用于支付捕獲,它應(yīng)該有 base_ 前綴)和一個顯示貨幣的價值(僅用于顯示客戶所需貨幣的金額).應(yīng)將此屬性添加到具有財務(wù)部分(quote_address、order、invoice)的每個實體.例如它應(yīng)該是:base_your_attribute_codeyour_attribute_code 十進制類型.

  1. First of all you need to create attributes for your custom duties/taxes for displaying them in order, not only just add to the grand total. There should be at least two attributes one for value in website currency (used in payment capture and it should have base_ prefix) and one value in displayed currency (used just for displaying amount in desired currency for customer). This attributes should be added to every entity with financial part (quote_address, order, invoice). For instance it should be: base_your_attribute_code and your_attribute_code with decimal type.

然后你需要創(chuàng)建你的總收集器模型,它應(yīng)該從 Mage_Sales_Model_Quote_Address_Total_Abstract 擴展,并實現(xiàn)像這個例子中的收集和獲取方法:

Then you need create your total collector model that should be extended from Mage_Sales_Model_Quote_Address_Total_Abstract and implement collect and fetch methods like in this example:

/**
 * Your custom total model
 *
 */
class Your_Module_Model_Total_Custom extends Mage_Sales_Model_Quote_Address_Total_Abstract
{
    /** 
     * Constructor that should initiaze 
     */
    public function __construct()
    {
        $this->setCode('your_attribute_code');
    }

    /**
     * Used each time when collectTotals is invoked
     * 
     * @param Mage_Sales_Model_Quote_Address $address
     * @return Your_Module_Model_Total_Custom
     */
    public function collect(Mage_Sales_Model_Quote_Address $address)
    {
        parent::collect($address);

        // ... Some your api calls to retrive amount ...

        // Set base amount of your custom fee
        $this->_setBaseAmount($calculatedAmount);

        // Set amount of your custom fee in displayed currency
        $this->_setAmount(
            $address->getQuote()->getStore()->convertPrice($calculatedAmount, false)
        );

        return $this;
    }

    /**
     * Used each time when totals are displayed
     * 
     * @param Mage_Sales_Model_Quote_Address $address
     * @return Your_Module_Model_Total_Custom
     */
    public function fetch(Mage_Sales_Model_Quote_Address $address)
    {
        // Display total only if it is not zero
        if ($address->getYourAttributeCode() != 0) {
            $address->addTotal(array(
                'code' => $this->getCode(),
                'title' => 'My Custom Duty',
                'value' => $address->getYourAttributeCode()
            ));
        }
    }
}

  • 收集器模型創(chuàng)建后,您需要將其添加到配置中:

  • After you the collector model is created you need add it to configuration:

    <config>
        <global>
            <sales>
                <quote>
                    <totals>
                        <your_total_code>
                            <class>your_module/total_custom</class>
                            <before>grand_total</before>
                            <after>shipping</after>
                        </your_total_code>
                    </totals>
                </quote>
            </sales>
        </global>
    </config>
    

    • class 節(jié)點包含收集器模型的類別名
    • beforeafter 節(jié)點表示收集器的調(diào)用順序.
      • class node contains the class alias of your collector model
      • before and after nodes indicate invocation order of your collector.
      • 您需要將您的總屬性添加到將用于將計算數(shù)據(jù)復(fù)制到訂單或發(fā)票中的字段集:

        You need to add your total attributes to field-sets that will be used for copying calculated data into order or invoice:

        <config>
            <global>
                <fieldsets>
                    <!-- copies data from quote address to order during the order placement -->
                    <sales_convert_quote_address>
                        <base_your_attribute_code><to_order>*</to_order></base_your_attribute_code>
                        <your_attribute_code><to_order>*</to_order></your_attribute_code>
                    </sales_convert_quote_address>
        
                    <!-- copies data from order to invoice/shipment/creditmemo during their creation -->
                    <sales_convert_order>
                        <base_your_attribute_code><to_invoice>*</to_invoice><to_shipment>*</to_shipment><to_cm>*</to_cm></base_your_attribute_code>
                        <your_attribute_code><to_invoice>*</to_invoice><to_shipment>*</to_shipment><to_cm>*</to_cm></your_attribute_code>
                    </sales_convert_order>
        
                </fieldsets>
            </global>
        </config>
        

      • 執(zhí)行此步驟后,您將能夠在訂單總額中看到自定義費用

      • After performing this steps you will be able to see your custom fee in order totals

        這篇關(guān)于Magento:在審查期間向報價添加關(guān)稅/稅款的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

    Override Magento Config(覆蓋 Magento 配置)
    What would cause a print_r and/or a var_dump to fail debugging a variable?(什么會導(dǎo)致 print_r 和/或 var_dump 調(diào)試變量失敗?)
    How to update custom options programatically in magento?(如何在 magento 中以編程方式更新自定義選項?)
    Magento 404 on Admin Page(管理頁面上的 Magento 404)
    Magento - get price rules from order(Magento - 從訂單中獲取價格規(guī)則)
    Magento Change Product Page Titles to Include Attributes(Magento 更改產(chǎn)品頁面標(biāo)題以包含屬性)
    主站蜘蛛池模板: 皮带机_移动皮带机_大倾角皮带机_皮带机厂家 - 新乡市国盛机械设备有限公司 | 雨水收集系统厂家-雨水收集利用-模块雨水收集池-徐州博智环保科技有限公司 | 钢制拖链生产厂家-全封闭钢制拖链-能源钢铝拖链-工程塑料拖链-河北汉洋机械制造有限公司 | 海日牌清洗剂-打造带电清洗剂、工业清洗剂等清洗剂国内一线品牌 海外整合营销-独立站营销-社交媒体运营_广州甲壳虫跨境网络服务 | 今日热点_实时热点_奇闻异事_趣闻趣事_灵异事件 - 奇闻事件 | 智能汉显全自动量热仪_微机全自动胶质层指数测定仪-鹤壁市科达仪器仪表有限公司 | 苏州西朗门业-欧盟CE|莱茵UL双认证的快速卷帘门品牌厂家 | 四探针电阻率测试仪-振实密度仪-粉末流动性测定仪-宁波瑞柯微智能 | 行星齿轮减速机,减速机厂家,山东减速机-淄博兴江机械制造 | 工业车间焊接-整体|集中除尘设备-激光|等离子切割机配套除尘-粉尘烟尘净化治理厂家-山东美蓝环保科技有限公司 | 万濠投影仪_瑞士TRIMOS高度仪_尼康投影仪V12BDC|量子仪器 | 艾默生变频器,艾默生ct,变频器,ct驱动器,广州艾默生变频器,供水专用变频器,风机变频器,电梯变频器,艾默生变频器代理-广州市盟雄贸易有限公司官方网站-艾默生变频器应用解决方案服务商 | 好杂志网-首页 | 超声波清洗机-超声波清洗设备定制生产厂家 - 深圳市冠博科技实业有限公司 | 成都竞价托管_抖音代运营_网站建设_成都SEM外包-成都智网创联网络科技有限公司 | 北京网站建设-企业网站建设-建站公司-做网站-北京良言多米网络公司 | 芝麻黑-芝麻黑石材厂家-永峰石业 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | FFU_空气初效|中效|高效过滤器_空调过滤网-广州梓净净化设备有限公司 | 龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司_龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司 | 打包钢带,铁皮打包带,烤蓝打包带-高密市金和金属制品厂 | 深圳宣传片制作-企业宣传视频制作-产品视频拍摄-产品动画制作-短视频拍摄制作公司 | 大数据营销公司_舆情监测软件_上海SEO公司-文军营销官网 | 齿轮减速机电机一体机_齿轮减速箱加电机一体化-德国BOSERL蜗轮蜗杆减速机电机生产厂家 | 流变仪-热分析联用仪-热膨胀仪厂家-耐驰科学仪器商贸 | 南京交通事故律师-专打交通事故的南京律师 | 旗帜网络笔记-免费领取《旗帜网络笔记》电子书| 震动筛选机|震动分筛机|筛粉机|振筛机|振荡筛-振动筛分设备专业生产厂家高服机械 | 雷达液位计_超声波风速风向仪_雨量传感器_辐射传感器-山东风途物联网 | 早报网| 代办建筑资质升级-建筑资质延期就找上海国信启航 | 东莞ERP软件_广州云ERP_中山ERP_台湾工厂erp系统-广东顺景软件科技有限公司 | 大立教育官网-一级建造师培训-二级建造师培训-造价工程师-安全工程师-监理工程师考试培训 | 机床主轴维修|刀塔维修|C轴维修-常州翔高精密机械有限公司 | 上海软件开发-上海软件公司-软件外包-企业软件定制开发公司-咏熠科技 | 减速机电机一体机_带电机减速器一套_德国BOSERL电动机与减速箱生产厂家 | 合肥钣金加工-安徽激光切割加工-机箱机柜加工厂家-合肥通快 | 铝合金电阻-无源谐波滤波器-上海稳达电讯设备厂 | PCB接线端子_栅板式端子_线路板连接器_端子排生产厂家-置恒电气 喷码机,激光喷码打码机,鸡蛋打码机,手持打码机,自动喷码机,一物一码防伪溯源-恒欣瑞达有限公司 假肢-假肢价格-假肢厂家-河南假肢-郑州市力康假肢矫形器有限公司 | 气动隔膜阀_气动隔膜阀厂家_卫生级隔膜阀价格_浙江浙控阀门有限公司 | 单级/双级旋片式真空泵厂家,2xz旋片真空泵-浙江台州求精真空泵有限公司 |