本文整理汇总了PHP中Mage_Sales_Model_Order_Item::getOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Item::getOrder方法的具体用法?PHP Mage_Sales_Model_Order_Item::getOrder怎么用?PHP Mage_Sales_Model_Order_Item::getOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Item
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Item::getOrder方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadDefaultAddressForItem
/**
* Get a default address for an item if one exists. For virtual items,
* the default address will be the billing address of the order the item
* belongs to. For non-virtual items, the default address will be the
* primary shipping address of the order the item belongs to. If the
* appropriate default address for the item does not exits, no address
* will be returned.
*
* @param Mage_Sales_Model_Order_Item
* @return Mage_Sales_Model_Order_Address|null
*/
protected function _loadDefaultAddressForItem(Mage_Sales_Model_Order_Item $item)
{
$order = $item->getOrder();
if (!$order) {
return null;
}
$defaultAddress = $item->getIsVirtual() ? $order->getBillingAddress() : $order->getShippingAddress();
// If the appropriate default address did not exist in the order, false
// will have been returned. In such cases, return null to indicate that
// no such address exists.
return $defaultAddress ?: null;
}
示例2: itemToQuoteItem
/**
* Retrieve
*
* @param Mage_Sales_Model_Order_Item $item
* @return unknown
*/
public function itemToQuoteItem(Mage_Sales_Model_Order_Item $item)
{
$quoteItem = Mage::getModel('sales/quote_item')->setStoreId($item->getOrder()->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setParentProductId($item->getParentProductId());
Mage::helper('core')->copyFieldset('sales_convert_order_item', 'to_quote_item', $item, $quoteItem);
return $quoteItem;
}
示例3: itemToQuoteItem
/**
* Retrieve
*
* @param Mage_Sales_Model_Order_Item $item
* @return unknown
*/
public function itemToQuoteItem(Mage_Sales_Model_Order_Item $item)
{
$quoteItem = AO::getModel('sales/quote_item')->setStoreId($item->getOrder()->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setParentProductId($item->getParentProductId());
AO::helper('core')->copyFieldset('sales_convert_order_item', 'to_quote_item', $item, $quoteItem);
// ->setSku($item->getSku())
// ->setName($item->getName())
// ->setDescription($item->getDescription())
// ->setWeight($item->getWeight())
// ->setCustomPrice($item->getPrice())
// ->setDiscountPercent($item->getDiscountPercent())
// ->setDiscountAmount($item->getDiscountAmount())
// ->setTaxPercent($item->getTaxPercent())
// ->setTaxAmount($item->getTaxAmount())
// ->setRowWeight($item->getRowWeight())
// ->setRowTotal($item->getRowTotal())
// ->setAppliedRuleIds($item->getAppliedRuleIds())
//
// ->setBaseDiscountAmount($item->getBaseDiscountAmount())
// ->setBaseTaxAmount($item->getBaseTaxAmount())
// ->setBaseRowTotal($item->getBaseRowTotal())
// ;
return $quoteItem;
}
示例4: getItemFinalPriceInclTax
/**
* Get the final price in base currency for an ordered item including
* taxes as discounts.
*
* @param Mage_Sales_Model_Order_Item $item the item model.
*
* @return float
*/
public function getItemFinalPriceInclTax(Mage_Sales_Model_Order_Item $item)
{
$quantity = (double) $item->getQtyOrdered();
$basePrice = $item->getBaseRowTotal() + $item->getBaseTaxAmount() + $item->getBaseHiddenTaxAmount() - $item->getBaseDiscountAmount();
$orderCurrencyCode = $item->getOrder()->getOrderCurrencyCode();
$baseCurrencyCode = $item->getOrder()->getBaseCurrencyCode();
if ($orderCurrencyCode != $baseCurrencyCode) {
$priceInOrderCurrency = Mage::helper('directory')->currencyConvert($basePrice, $baseCurrencyCode, $orderCurrencyCode);
} else {
$priceInOrderCurrency = $basePrice;
}
if ($quantity > 1) {
$priceInOrderCurrency = round($priceInOrderCurrency / $quantity, 2);
}
return $priceInOrderCurrency;
}
示例5: _createOrderItemStatus
/**
* Creates OCL OrderStatus record
*
* @param Mage_Sales_Model_Order_Item $item
* @return string
*/
protected function _createOrderItemStatus(Mage_Sales_Model_Order_Item $item)
{
switch ($item->getStatusId()) {
case Mage_Sales_Model_Order_Item::STATUS_SHIPPED:
return self::STATUS_SHIPPED;
case Mage_Sales_Model_Order_Item::STATUS_BACKORDERED:
return self::STATUS_BACKORDERED;
case Mage_Sales_Model_Order_Item::STATUS_CANCELED:
return self::STATUS_CANCELLED;
case Mage_Sales_Model_Order_Item::STATUS_PARTIAL:
return self::STATUS_PARTIALLY_SHIPPED;
case Mage_Sales_Model_Order_Item::STATUS_REFUNDED:
case Mage_Sales_Model_Order_Item::STATUS_RETURNED:
return self::STATUS_PROCESSING_RETURN;
}
$orderState = $item->getOrder()->getState();
switch ($orderState) {
case Mage_Sales_Model_Order::STATE_NEW:
return self::STATUS_NEW;
case Mage_Sales_Model_Order::STATE_HOLDED:
return self::STATUS_ON_HOLD;
case Mage_Sales_Model_Order::STATE_COMPLETE:
case Mage_Sales_Model_Order::STATE_CLOSED:
return self::STATUS_COMPLETED;
}
if ($orderState == Mage_Sales_Model_Order::STATE_PROCESSING && $item->getStatus() == Mage_Sales_Model_Order_Item::STATUS_INVOICED) {
return $item->getIsVirtual() ? self::STATUS_PAID : self::STATUS_READY_TO_SHIP;
}
return self::STATUS_NEW;
}
示例6: getDetailsForOrderItem
/**
* Get item details for the given order item.
* returns null if the item was excluded from the request or if
* there was an error in the sdk
*
* @param Mage_Sales_Model_Order_Item
* @return EbayEnterprise_Inventory_Model_Details_Item|null
*/
public function getDetailsForOrderItem(Mage_Sales_Model_Order_Item $item)
{
try {
$result = $this->factory->createDetailsModel()->fetch($item->getOrder()->getQuote());
return !is_null($result) ? $result->lookupDetailsByItemId($item->getQuoteItemId()) : $result;
} catch (EbayEnterprise_Inventory_Exception_Details_Operation_Exception $e) {
return null;
}
}
示例7: _logInOrderHistory
/**
* @param Mage_Sales_Model_Order_Item $orderItem
* @return bool
*/
private function _logInOrderHistory(Mage_Sales_Model_Order_Item $orderItem)
{
// Isolate exceptions.
try {
$downloadableHelper = Mage::helper('ecodes/downloadable');
$orderItem->getOrder()->addStatusHistoryComment($downloadableHelper->generateSerialsAssignedHistoryComment($this->getInfo('serials_added'), $this->getInfo('num_serials_not_assigned')))->setIsVisibleOnFront(false)->setIsCustomerNotified(false)->save();
return true;
} catch (Exception $e) {
Mage::logException($e);
$this->addError($e->getMessage());
}
}
示例8: loadData
/**
* Loads the item info from the Magento order item model.
*
* @param Mage_Sales_Model_Order_Item $item the item model.
*/
public function loadData(Mage_Sales_Model_Order_Item $item)
{
$order = $item->getOrder();
$this->_productId = (int) $this->fetchProductId($item);
$this->_quantity = (int) $item->getQtyOrdered();
$this->_name = $this->fetchProductName($item);
$this->_unitPrice = $item->getPriceInclTax();
$this->_currencyCode = strtoupper($order->getOrderCurrencyCode());
}
示例9: getFrontendProductPrice
/**
* @param Mage_Sales_Model_Order_Item $orderItem
*
* @return string
*/
public function getFrontendProductPrice(Mage_Sales_Model_Order_Item $orderItem)
{
$itemPrice = $orderItem->getPrice();
if ($orderItem->getParentItemId()) {
$parentItem = Mage::getModel('sales/order_item')->load($orderItem->getParentItemId());
if ($parentItem->getProductType() != 'bundle') {
$itemPrice = $parentItem->getPrice();
}
}
return $orderItem->getOrder()->getOrderCurrency()->format($itemPrice);
}