Mage_Sales_Model_Convert_Quote Class Reference

Inheritance diagram for Mage_Sales_Model_Convert_Quote:

Varien_Object

List of all members.

Public Member Functions

 toOrder (Mage_Sales_Model_Quote $quote, $order=null)
 addressToOrder (Mage_Sales_Model_Quote_Address $address, $order=null)
 addressToOrderAddress (Mage_Sales_Model_Quote_Address $address)
 paymentToOrderPayment (Mage_Sales_Model_Quote_Payment $payment)
 itemToOrderItem (Mage_Sales_Model_Quote_Item_Abstract $item)


Detailed Description

Definition at line 37 of file Quote.php.


Member Function Documentation

addressToOrder ( Mage_Sales_Model_Quote_Address address,
order = null 
)

Convert quote address model to order

Parameters:
Mage_Sales_Model_Quote $quote
Returns:
Mage_Sales_Model_Order

Definition at line 115 of file Quote.php.

00116     {
00117         if (!($order instanceof Mage_Sales_Model_Order)) {
00118             $order = $this->toOrder($address->getQuote());
00119         }
00120 
00121         Mage::helper('core')->copyFieldset('sales_convert_quote_address', 'to_order', $address, $order);
00122 
00123 //        $order
00124 //            ->setWeight($address->getWeight())
00125 //            ->setShippingMethod($address->getShippingMethod())
00126 //            ->setShippingDescription($address->getShippingDescription())
00127 //            ->setShippingRate($address->getShippingRate())
00128 //
00129 //            ->setSubtotal($address->getSubtotal())
00130 //            ->setTaxAmount($address->getTaxAmount())
00131 //            ->setDiscountAmount($address->getDiscountAmount())
00132 //            ->setShippingAmount($address->getShippingAmount())
00133 //            ->setShippingTaxAmount($address->getShippingTaxAmount())
00134 //            ->setGiftcertAmount($address->getGiftcertAmount())
00135 //            ->setCustbalanceAmount($address->getCustbalanceAmount())
00136 //            ->setGrandTotal($address->getGrandTotal())
00137 //
00138 //            ->setBaseSubtotal($address->getBaseSubtotal())
00139 //            ->setBaseTaxAmount($address->getBaseTaxAmount())
00140 //            ->setBaseDiscountAmount($address->getBaseDiscountAmount())
00141 //            ->setBaseShippingAmount($address->getBaseShippingAmount())
00142 //            ->setBaseShippingTaxAmount($address->getBaseShippingTaxAmount())
00143 //            ->setBaseGiftcertAmount($address->getBaseGiftcertAmount())
00144 //            ->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())
00145 //            ->setBaseGrandTotal($address->getBaseGrandTotal());
00146 
00147         Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address'=>$address, 'order'=>$order));
00148         return $order;
00149     }

addressToOrderAddress ( Mage_Sales_Model_Quote_Address address  ) 

Convert quote address to order address

Parameters:
Mage_Sales_Model_Quote_Address $address
Returns:
Mage_Sales_Model_Order_Address

Definition at line 157 of file Quote.php.

00158     {
00159         $orderAddress = Mage::getModel('sales/order_address')
00160             ->setStoreId($address->getStoreId())
00161             ->setAddressType($address->getAddressType())
00162             ->setCustomerId($address->getCustomerId())
00163             ->setCustomerAddressId($address->getCustomerAddressId());
00164 
00165         Mage::helper('core')->copyFieldset('sales_convert_quote_address', 'to_order_address', $address, $orderAddress);
00166 //            ->setPrefix($address->getPrefix())
00167 //            ->setFirstname($address->getFirstname())
00168 //            ->setMiddlename($address->getMiddlename())
00169 //            ->setLastname($address->getLastname())
00170 //            ->setSuffix($address->getSuffix())
00171 //            ->setCompany($address->getCompany())
00172 //            ->setStreet($address->getStreet(-1))
00173 //            ->setCity($address->getCity())
00174 //            ->setRegion($address->getRegion())
00175 //            ->setRegionId($address->getRegionId())
00176 //            ->setPostcode($address->getPostcode())
00177 //            ->setCountryId($address->getCountryId())
00178 //            ->setTelephone($address->getTelephone())
00179 //            ->setFax($address->getFax());
00180 
00181         Mage::dispatchEvent('sales_convert_quote_address_to_order_address',
00182             array('address' => $address, 'order_address' => $orderAddress));
00183 
00184         return $orderAddress;
00185     }

itemToOrderItem ( Mage_Sales_Model_Quote_Item_Abstract item  ) 

Convert quote item to order item

Parameters:
Mage_Sales_Model_Quote_Item_Abstract $item
Returns:
Mage_Sales_Model_Order_Item

Definition at line 229 of file Quote.php.

00230     {
00231         $orderItem = Mage::getModel('sales/order_item')
00232             ->setStoreId($item->getStoreId())
00233             ->setQuoteItemId($item->getId())
00234             ->setQuoteParentItemId($item->getParentItemId())
00235             ->setProductId($item->getProductId())
00236             ->setProductType($item->getProductType())
00237             ->setProductOptions($item->getProduct()->getTypeInstance(true)->getOrderOptions($item->getProduct()))
00238             ->setQtyBackordered($item->getBackorders())
00239             ;
00240 
00241         Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item', $item, $orderItem);
00242 
00243         if ($item->getParentItem()) {
00244             $orderItem->setQtyOrdered($orderItem->getQtyOrdered()*$item->getParentItem()->getQty());
00245         }
00246 //            ->setSku($item->getSku())
00247 //            ->setName($item->getName())
00248 //            ->setDescription($item->getDescription())
00249 //            ->setWeight($item->getWeight())
00250 //            ->setIsQtyDecimal($item->getIsQtyDecimal())
00251 //            ->setQtyOrdered($item->getQty())
00252 //            ->setOriginalPrice($item->getOriginalPrice())
00253 //            ->setAppliedRuleIds($item->getAppliedRuleIds())
00254 //            ->setAdditionalData($item->getAdditionalData())
00255 //
00256 //            ->setPrice($item->getCalculationPrice())
00257 //            ->setTaxPercent($item->getTaxPercent())
00258 //            ->setTaxAmount($item->getTaxAmount())
00259 //            ->setRowWeight($item->getRowWeight())
00260 //            ->setRowTotal($item->getRowTotal())
00261 //
00262 //            ->setBasePrice($item->getBaseCalculationPrice())
00263 //            ->setBaseOriginalPrice($item->getPrice())
00264 //            ->setBaseTaxAmount($item->getBaseTaxAmount())
00265 //            ->setBaseRowTotal($item->getBaseRowTotal());
00266 
00267         if (!$item->getNoDiscount()) {
00268             Mage::helper('core')->copyFieldset('sales_convert_quote_item', 'to_order_item_discount', $item, $orderItem);
00269 //            $orderItem->setDiscountPercent($item->getDiscountPercent())
00270 //                ->setDiscountAmount($item->getDiscountAmount())
00271 //                ->setBaseDiscountAmount($item->getBaseDiscountAmount());
00272         }
00273 
00274         Mage::dispatchEvent('sales_convert_quote_item_to_order_item',
00275             array('order_item'=>$orderItem, 'item'=>$item)
00276         );
00277         return $orderItem;
00278     }

paymentToOrderPayment ( Mage_Sales_Model_Quote_Payment payment  ) 

Convert quote payment to order payment

Parameters:
Mage_Sales_Model_Quote_Payment $payment
Returns:
Mage_Sales_Model_Quote_Payment

Definition at line 193 of file Quote.php.

00194     {
00195         $orderPayment = Mage::getModel('sales/order_payment')
00196             ->setStoreId($payment->getStoreId())
00197             ->setCustomerPaymentId($payment->getCustomerPaymentId());
00198         Mage::helper('core')->copyFieldset('sales_convert_quote_payment', 'to_order_payment', $payment, $orderPayment);
00199 //            ->setMethod($payment->getMethod())
00200 //            ->setAdditionalData($payment->getAdditionalData())
00201 //            ->setPoNumber($payment->getPoNumber())
00202 //            ->setCcType($payment->getCcType())
00203 //            ->setCcNumberEnc($payment->getCcNumberEnc())
00204 //            ->setCcLast4($payment->getCcLast4())
00205 //            ->setCcOwner($payment->getCcOwner())
00206 //            ->setCcExpMonth($payment->getCcExpMonth())
00207 //            ->setCcExpYear($payment->getCcExpYear())
00208 //
00209 //            ->setCcNumber($payment->getCcNumber()) // only for doing first transaction, not for save
00210 //            ->setCcCid($payment->getCcCid()) // only for doing first transaction, not for save
00211 //
00212 //                        ->setCcSsIssue($payment->getCcSsIssue())  //for direct payment
00213 //                        ->setCcSsStartMonth($payment->getCcSsStartMonth()) //for direct payment
00214 //            ->setCcSsStartYear($payment->getCcSsStartYear())  //for direct payment
00215 //            ;
00216 
00217         Mage::dispatchEvent('sales_convert_quote_payment_to_order_payment',
00218             array('order_payment' => $orderPayment, 'quote_payment' => $payment));
00219 
00220         return $orderPayment;
00221     }

toOrder ( Mage_Sales_Model_Quote quote,
order = null 
)

Convert quote model to order model

Parameters:
Mage_Sales_Model_Quote $quote
Returns:
Mage_Sales_Model_Order

Base Data

Customer data

Currency data

Another data

Definition at line 46 of file Quote.php.

00047     {
00048         if (!($order instanceof Mage_Sales_Model_Order)) {
00049             $order = Mage::getModel('sales/order');
00050         }
00051         /* @var $order Mage_Sales_Model_Order */
00052 
00053         $order
00054             /**
00055              * Base Data
00056              */
00057             ->setIncrementId($quote->getReservedOrderId())
00058             ->setStoreId($quote->getStoreId())
00059             ->setQuoteId($quote->getId());
00060 
00061         Mage::helper('core')->copyFieldset('sales_convert_quote', 'to_order', $quote, $order);
00062 
00063         if (!$quote->getCustomerId()) {
00064             $order->setCustomerId(null);
00065         }
00066 //
00067 //            ->setRemoteIp($quote->getRemoteIp())
00068 //
00069 //            /**
00070 //             * Customer data
00071 //             */
00072 //            ->setCustomerId($quote->getCustomerId())
00073 //            ->setCustomerEmail($quote->getCustomerEmail())
00074 //            ->setCustomerPrefix($quote->getCustomerPrefix())
00075 //            ->setCustomerFirstname($quote->getCustomerFirstname())
00076 //            ->setCustomerMiddlename($quote->getCustomerMiddlename())
00077 //            ->setCustomerLastname($quote->getCustomerLastname())
00078 //            ->setCustomerSuffix($quote->getCustomerSuffix())
00079 //            ->setCustomerGroupId($quote->getCustomerGroupId())
00080 //            ->setCustomerTaxClassId($quote->getCustomerTaxClassId())
00081 //            ->setCustomerNote($quote->getCustomerNote())
00082 //            ->setCustomerNoteNotify($quote->getCustomerNoteNotify())
00083 //            ->setCustomerIsGuest($quote->getCustomerIsGuest())
00084 //            ->setCustomerDob($quote->getCustomerDob())
00085 //
00086 //            /**
00087 //             * Currency data
00088 //             */
00089 //            ->setBaseCurrencyCode($quote->getBaseCurrencyCode())
00090 //            ->setStoreCurrencyCode($quote->getStoreCurrencyCode())
00091 //            ->setOrderCurrencyCode($quote->getQuoteCurrencyCode())
00092 //            ->setStoreToBaseRate($quote->getStoreToBaseRate())
00093 //            ->setStoreToOrderRate($quote->getStoreToQuoteRate())
00094 //
00095 //            /**
00096 //             * Another data
00097 //             */
00098 //            ->setCouponCode($quote->getCouponCode())
00099 //            ->setGiftcertCode($quote->getGiftcertCode())
00100 //            ->setIsVirtual($quote->getIsVirtual())
00101 //            ->setIsMultiPayment($quote->getIsMultiPayment())
00102 //            ->setAppliedRuleIds($quote->getAppliedRuleIds());
00103 
00104 
00105         Mage::dispatchEvent('sales_convert_quote_to_order', array('order'=>$order, 'quote'=>$quote));
00106         return $order;
00107     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:40 2009 for Magento by  doxygen 1.5.8