Magento-报价与订单之间的区别 [英] Magento - Difference between Quote and Order

查看:61
本文介绍了Magento-报价与订单之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对在付款方式中如何调用报价和订单感到怀疑.我所知道的是,报价是提供的一组产品或服务.在magento中,报价数据是在单击一页结帐"的下单"按钮之前创建的.下订单后,在Magento中创建订单数据.如果确认订单,发票将显示在订单旁边.

I have a doubt about how quotes and orders are being called in payment method. What I know is that a Quote is a set of products or services offered. In magento Quote data is created just before clicking Place Order button of Onepage Checkout. After the Order is placed Order data is created in Magento. Invoice comes next to Order if Order is confirmed.

但是我想知道为什么validate方法中的Mage_Payment_Model_Method_Abstract类会检查Info类实例(如果它是Mage_Sales_Model_Order_Payment的实例),请使用getOrder();否则请使用getQuote()

But I was wondering why the Class Mage_Payment_Model_Method_Abstract in validate Method checks Info class Instance if it is an instance of Mage_Sales_Model_Order_Payment take getOrder() else take getQuote()

我不清楚.是否两次调用Validate()函数,即第一次创建报价时,第二次创建订单时,还是两次调用付款方式类"本身.

I am not clear with this. Does the Validate() function is called two time i.e first time when Quote is created and second time when Order is Created OR does the Payment Method Class itself is called two times.

请澄清我的困惑.

/**
         * Validate payment method information object
         *
         * @param   Varien_Object $info
         * @return  Mage_Payment_Model_Abstract
         */
        public function validate()
        {
             /**
              * to validate paymene method is allowed for billing country or not
              */
             $paymentInfo = $this->getInfoInstance();
             if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
                 $billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
             } else {
                 $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
             }
             if (!$this->canUseForCountry($billingCountry)) {
                 Mage::throwException($this->_getHelper()->__('Selected payment type is not allowed for billing country.'));
             }
             return $this;
        }

推荐答案

Magento中的报价基本上是尚未下达的订单.它包含产品项目(购物车),地址和付款/运输方式.将商品添加到购物车后即会创建它.在结帐期间,将开票和运输数据添加到报价中.最后,当用户单击下订单时,报价将转换为订单.

A quote in Magento is basically an order that hasn't been placed yet. It contains product items (shopping cart), addresses and payment/shipping methods. It is created as soon as you add an item to cart. During checkout, billing and shipping data is added to the quote. Finally, when the user clicks place order, the quote is converted to an order.

要回答有关付款验证的问题:报价和订单中均包含付款方式,并在两个地方均进行了验证.付款方式可能只限于某些国家/地区,因此在验证方法中,报价的付款方式将验证报价国家/地区,而订单的付款方式将验证订单国家/地区.

To answer your question about the payment validation: The payment method is included in the quote as well as the order and validated in both places. A payment method may be restricted to certain countries, so in the validate method, a payment method for a quote will validate the quote country, and a payment method for an order will validate the order country.

这篇关于Magento-报价与订单之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆