Public Member Functions | |
toQuote (Mage_Sales_Model_Order $order, $quote=null) | |
toQuoteShippingAddress (Mage_Sales_Model_Order $order) | |
addressToQuoteAddress (Mage_Sales_Model_Order_Address $address) | |
paymentToQuotePayment (Mage_Sales_Model_Order_Payment $payment, $quotePayment=null) | |
itemToQuoteItem (Mage_Sales_Model_Order_Item $item) | |
toInvoice (Mage_Sales_Model_Order $order) | |
itemToInvoiceItem (Mage_Sales_Model_Order_Item $item) | |
toShipment (Mage_Sales_Model_Order $order) | |
itemToShipmentItem (Mage_Sales_Model_Order_Item $item) | |
toCreditmemo (Mage_Sales_Model_Order $order) | |
itemToCreditmemoItem (Mage_Sales_Model_Order_Item $item) |
Definition at line 34 of file Order.php.
addressToQuoteAddress | ( | Mage_Sales_Model_Order_Address $ | address | ) |
Convert order address to quote address
Mage_Sales_Model_Order_Address | $address |
Definition at line 139 of file Order.php.
00140 { 00141 $quoteAddress = Mage::getModel('sales/quote_address') 00142 ->setStoreId($address->getStoreId()) 00143 ->setAddressType($address->getAddressType()) 00144 ->setCustomerId($address->getCustomerId()) 00145 ->setCustomerAddressId($address->getCustomerAddressId()); 00146 00147 Mage::helper('core')->copyFieldset('sales_convert_order_address', 'to_quote_address', $address, $quoteAddress); 00148 // ->setPrefix($address->getPrefix()) 00149 // ->setFirstname($address->getFirstname()) 00150 // ->setMiddlename($address->getMiddlename()) 00151 // ->setLastname($address->getLastname()) 00152 // ->setSuffix($address->setSuffix()) 00153 // ->setCompany($address->getCompany()) 00154 // ->setStreet($address->getStreet(-1)) 00155 // ->setCity($address->getCity()) 00156 // ->setRegion($address->getRegion()) 00157 // ->setRegionId($address->getRegionId()) 00158 // ->setPostcode($address->getPostcode()) 00159 // ->setCountryId($address->getCountryId()) 00160 // ->setTelephone($address->getTelephone()) 00161 // ->setFax($address->getFax()); 00162 return $quoteAddress; 00163 }
itemToCreditmemoItem | ( | Mage_Sales_Model_Order_Item $ | item | ) |
Convert order item object to Creditmemo item
Mage_Sales_Model_Order_Item | $item |
Definition at line 362 of file Order.php.
00363 { 00364 $creditmemoItem = Mage::getModel('sales/order_creditmemo_item'); 00365 $creditmemoItem->setOrderItem($item) 00366 ->setProductId($item->getProductId()); 00367 00368 Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_cm_item', $item, $creditmemoItem); 00369 // ->setName($item->getName()) 00370 // ->setSku($item->getSku()) 00371 // ->setDescription($item->getDescription()) 00372 // ->setPrice($item->getPrice()) 00373 // ->setBasePrice($item->getBasePrice()) 00374 // ->setCost($item->getCost()); 00375 00376 return $creditmemoItem; 00377 }
itemToInvoiceItem | ( | Mage_Sales_Model_Order_Item $ | item | ) |
Convert order item object to invoice item
Mage_Sales_Model_Order_Item | $item |
Definition at line 266 of file Order.php.
00267 { 00268 $invoiceItem = Mage::getModel('sales/order_invoice_item'); 00269 $invoiceItem->setOrderItem($item) 00270 ->setProductId($item->getProductId()); 00271 00272 Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_invoice_item', $item, $invoiceItem); 00273 // ->setName($item->getName()) 00274 // ->setSku($item->getSku()) 00275 // ->setDescription($item->getDescription()) 00276 // ->setPrice($item->getPrice()) 00277 // ->setBasePrice($item->getBasePrice()) 00278 // ->setCost($item->getCost()); 00279 00280 return $invoiceItem; 00281 }
itemToQuoteItem | ( | Mage_Sales_Model_Order_Item $ | item | ) |
Retrieve
Mage_Sales_Model_Order_Item | $item |
Definition at line 205 of file Order.php.
00206 { 00207 $quoteItem = Mage::getModel('sales/quote_item') 00208 ->setStoreId($item->getOrder()->getStoreId()) 00209 ->setQuoteItemId($item->getId()) 00210 ->setProductId($item->getProductId()) 00211 ->setParentProductId($item->getParentProductId()); 00212 00213 Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_quote_item', $item, $quoteItem); 00214 // ->setSku($item->getSku()) 00215 // ->setName($item->getName()) 00216 // ->setDescription($item->getDescription()) 00217 // ->setWeight($item->getWeight()) 00218 // ->setCustomPrice($item->getPrice()) 00219 // ->setDiscountPercent($item->getDiscountPercent()) 00220 // ->setDiscountAmount($item->getDiscountAmount()) 00221 // ->setTaxPercent($item->getTaxPercent()) 00222 // ->setTaxAmount($item->getTaxAmount()) 00223 // ->setRowWeight($item->getRowWeight()) 00224 // ->setRowTotal($item->getRowTotal()) 00225 // ->setAppliedRuleIds($item->getAppliedRuleIds()) 00226 // 00227 // ->setBaseDiscountAmount($item->getBaseDiscountAmount()) 00228 // ->setBaseTaxAmount($item->getBaseTaxAmount()) 00229 // ->setBaseRowTotal($item->getBaseRowTotal()) 00230 // ; 00231 00232 return $quoteItem; 00233 }
itemToShipmentItem | ( | Mage_Sales_Model_Order_Item $ | item | ) |
Convert order item object to Shipment item
Mage_Sales_Model_Order_Item | $item |
Definition at line 314 of file Order.php.
00315 { 00316 $shipmentItem = Mage::getModel('sales/order_shipment_item'); 00317 $shipmentItem->setOrderItem($item) 00318 ->setProductId($item->getProductId()); 00319 00320 Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_shipment_item', $item, $shipmentItem); 00321 // ->setName($item->getName()) 00322 // ->setSku($item->getSku()) 00323 // ->setDescription($item->getDescription()) 00324 // ->setPrice($item->getPrice()) 00325 // ->setBasePrice($item->getBasePrice()) 00326 // ->setWeight($item->getWeight()); 00327 00328 return $shipmentItem; 00329 }
paymentToQuotePayment | ( | Mage_Sales_Model_Order_Payment $ | payment, | |
$ | quotePayment = null | |||
) |
Convert order payment to quote payment
Mage_Sales_Model_Order_Payment | $payment |
Definition at line 171 of file Order.php.
00172 { 00173 if (!($quotePayment instanceof Mage_Sales_Model_Quote_Payment)) { 00174 $quotePayment = Mage::getModel('sales/quote_payment'); 00175 } 00176 00177 $quotePayment->setStoreId($payment->getStoreId()) 00178 ->setCustomerPaymentId($payment->getCustomerPaymentId()); 00179 00180 Mage::helper('core')->copyFieldset('sales_convert_order_payment', 'to_quote_payment', $payment, $quotePayment); 00181 // ->setMethod($payment->getMethod()) 00182 // ->setAdditionalData($payment->getAdditionalData()) 00183 // ->setPoNumber($payment->getPoNumber()) 00184 // ->setCcType($payment->getCcType()) 00185 // ->setCcNumberEnc($payment->getCcNumberEnc()) 00186 // ->setCcLast4($payment->getCcLast4()) 00187 // ->setCcOwner($payment->getCcOwner()) 00188 // ->setCcCidEnc($payment->getCcCidEnc()) 00189 // ->setCcExpMonth($payment->getCcExpMonth()) 00190 // ->setCcExpYear($payment->getCcExpYear()) 00191 // 00192 // ->setCcSsIssue($payment->getCcSsIssue()) //for direct payment 00193 // ->setCcSsStartMonth($payment->getCcSsStartMonth()) //for direct payment 00194 // ->setCcSsStartYear($payment->getCcSsStartYear()) //for direct payment 00195 // ; 00196 return $quotePayment; 00197 }
toCreditmemo | ( | Mage_Sales_Model_Order $ | order | ) |
Convert order object to creditmemo
Mage_Sales_Model_Order | $order |
Definition at line 337 of file Order.php.
00338 { 00339 $creditmemo = Mage::getModel('sales/order_creditmemo'); 00340 $creditmemo->setOrder($order) 00341 ->setStoreId($order->getStoreId()) 00342 ->setCustomerId($order->getCustomerId()) 00343 ->setBillingAddressId($order->getBillingAddressId()) 00344 ->setShippingAddressId($order->getShippingAddressId()); 00345 00346 Mage::helper('core')->copyFieldset('sales_convert_order', 'to_cm', $order, $creditmemo); 00347 // ->setBaseCurrencyCode($order->getBaseCurrencyCode()) 00348 // ->setStoreCurrencyCode($order->getStoreCurrencyCode()) 00349 // ->setOrderCurrencyCode($order->getOrderCurrencyCode()) 00350 // ->setStoreToBaseRate($order->getStoreToBaseRate()) 00351 // ->setStoreToOrderRate($order->getStoreToOrderRate()); 00352 00353 return $creditmemo; 00354 }
toInvoice | ( | Mage_Sales_Model_Order $ | order | ) |
Convert order object to invoice
Mage_Sales_Model_Order | $order |
Definition at line 241 of file Order.php.
00242 { 00243 $invoice = Mage::getModel('sales/order_invoice'); 00244 $invoice->setOrder($order) 00245 ->setStoreId($order->getStoreId()) 00246 ->setCustomerId($order->getCustomerId()) 00247 ->setBillingAddressId($order->getBillingAddressId()) 00248 ->setShippingAddressId($order->getShippingAddressId()); 00249 00250 Mage::helper('core')->copyFieldset('sales_convert_order', 'to_invoice', $order, $invoice); 00251 // ->setBaseCurrencyCode($order->getBaseCurrencyCode()) 00252 // ->setStoreCurrencyCode($order->getStoreCurrencyCode()) 00253 // ->setOrderCurrencyCode($order->getOrderCurrencyCode()) 00254 // ->setStoreToBaseRate($order->getStoreToBaseRate()) 00255 // ->setStoreToOrderRate($order->getStoreToOrderRate()); 00256 00257 return $invoice; 00258 }
toQuote | ( | Mage_Sales_Model_Order $ | order, | |
$ | quote = null | |||
) |
Converting order object to quote object
Mage_Sales_Model_Order | $order |
Base Data
Customer data
Not use note from previos order
Currency data
Totals data
Another data
Definition at line 42 of file Order.php.
00043 { 00044 if (!($quote instanceof Mage_Sales_Model_Quote)) { 00045 $quote = Mage::getModel('sales/quote'); 00046 } 00047 00048 $quote 00049 /** 00050 * Base Data 00051 */ 00052 ->setStoreId($order->getStoreId()) 00053 ->setOrderId($order->getId()); 00054 00055 Mage::helper('core')->copyFieldset('sales_convert_order', 'to_quote', $order, $quote); 00056 00057 // /** 00058 // * Customer data 00059 // */ 00060 // ->setCustomerId($order->getCustomerId()) 00061 // ->setCustomerEmail($order->getCustomerEmail()) 00062 // ->setCustomerGroupId($order->getCustomerGroupId()) 00063 // ->setCustomerTaxClassId($order->getCustomerTaxClassId()) 00064 // /** 00065 // * Not use note from previos order 00066 // */ 00067 // //->setCustomerNote($order->getCustomerNote()) 00068 // //->setCustomerNoteNotify($order->getCustomerNoteNotify()) 00069 // ->setCustomerIsGuest($order->getCustomerIsGuest()) 00070 // 00071 // /** 00072 // * Currency data 00073 // */ 00074 // ->setBaseCurrencyCode($order->getBaseCurrencyCode()) 00075 // ->setStoreCurrencyCode($order->getStoreCurrencyCode()) 00076 // ->setQuoteCurrencyCode($order->getOrderCurrencyCode()) 00077 // ->setStoreToBaseRate($order->getStoreToBaseRate()) 00078 // ->setStoreToQuoteRate($order->getStoreToOrderRate()) 00079 // 00080 // /** 00081 // * Totals data 00082 // */ 00083 // ->setGrandTotal($order->getGrandTotal()) 00084 // ->setBaseGrandTotal($order->getBaseGrandTotal()) 00085 // 00086 // /** 00087 // * Another data 00088 // */ 00089 // ->setCouponCode($order->getCouponCode()) 00090 // ->setGiftcertCode($order->getGiftcertCode()) 00091 // ->setAppliedRuleIds($order->getAppliedRuleIds()); 00092 // //->collectTotals(); 00093 // 00094 00095 Mage::dispatchEvent('sales_convert_order_to_quote', array('order'=>$order, 'quote'=>$quote)); 00096 return $quote; 00097 }
toQuoteShippingAddress | ( | Mage_Sales_Model_Order $ | order | ) |
Convert order to shipping address
Mage_Sales_Model_Order | $order |
Definition at line 105 of file Order.php.
00106 { 00107 $address = $this->addressToQuoteAddress($order->getShippingAddress()); 00108 00109 Mage::helper('core')->copyFieldset('sales_convert_order', 'to_quote_address', $order, $address); 00110 // $address->setWeight($order->getWeight()) 00111 // ->setShippingMethod($order->getShippingMethod()) 00112 // ->setShippingDescription($order->getShippingDescription()) 00113 // ->setShippingRate($order->getShippingRate()) 00114 // 00115 // ->setSubtotal($order->getSubtotal()) 00116 // ->setTaxAmount($order->getTaxAmount()) 00117 // ->setDiscountAmount($order->getDiscountAmount()) 00118 // ->setShippingAmount($order->getShippingAmount()) 00119 // ->setGiftcertAmount($order->getGiftcertAmount()) 00120 // ->setCustbalanceAmount($order->getCustbalanceAmount()) 00121 // ->setGrandTotal($order->getGrandTotal()) 00122 // 00123 // ->setBaseSubtotal($order->getBaseSubtotal()) 00124 // ->setBaseTaxAmount($order->getBaseTaxAmount()) 00125 // ->setBaseDiscountAmount($order->getBaseDiscountAmount()) 00126 // ->setBaseShippingAmount($order->getBaseShippingAmount()) 00127 // ->setBaseGiftcertAmount($order->getBaseGiftcertAmount()) 00128 // ->setBaseCustbalanceAmount($order->getBaseCustbalanceAmount()) 00129 // ->setBaseGrandTotal($order->getBaseGrandTotal()); 00130 return $address; 00131 }
toShipment | ( | Mage_Sales_Model_Order $ | order | ) |
Convert order object to Shipment
Mage_Sales_Model_Order | $order |
Definition at line 289 of file Order.php.
00290 { 00291 $shipment = Mage::getModel('sales/order_shipment'); 00292 $shipment->setOrder($order) 00293 ->setStoreId($order->getStoreId()) 00294 ->setCustomerId($order->getCustomerId()) 00295 ->setBillingAddressId($order->getBillingAddressId()) 00296 ->setShippingAddressId($order->getShippingAddressId()); 00297 00298 Mage::helper('core')->copyFieldset('sales_convert_order', 'to_shipment', $order, $shipment); 00299 // ->setBaseCurrencyCode($order->getBaseCurrencyCode()) 00300 // ->setStoreCurrencyCode($order->getStoreCurrencyCode()) 00301 // ->setOrderCurrencyCode($order->getOrderCurrencyCode()) 00302 // ->setStoreToBaseRate($order->getStoreToBaseRate()) 00303 // ->setStoreToOrderRate($order->getStoreToOrderRate()); 00304 00305 return $shipment; 00306 }