当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order::getIsVirtual方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order::getIsVirtual方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::getIsVirtual方法的具体用法?PHP Mage_Sales_Model_Order::getIsVirtual怎么用?PHP Mage_Sales_Model_Order::getIsVirtual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order的用法示例。


在下文中一共展示了Mage_Sales_Model_Order::getIsVirtual方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getShippingMethod

/**
 * Returns the shipping method of the given order.
 *
 * @param Mage_Sales_Model_Order $order The order to return info from
 * @return String The name of the shipping method
 */
function getShippingMethod($order)
{
    if (!$order->getIsVirtual() && $order->getShippingDescription()) {
        return $order->getShippingDescription();
    } else {
        if (!$order->getIsVirtual() && $order->getShippingMethod()) {
            return $order->getShippingMethod();
        }
    }
    return '';
}
开发者ID:Itipart,项目名称:Synchro,代码行数:17,代码来源:Abstract.php

示例2: getShippingMethod

 /**
  * Returns the shipping method of the given order.
  *
  * @param Mage_Sales_Model_Order $order The order to return info from
  * @return String The name of the shipping method
  */
 protected function getShippingMethod($order)
 {
     if (!$order->getIsVirtual() && $order->getShippingMethod()) {
         return $order->getShippingMethod();
     }
     return '';
 }
开发者ID:rob3000,项目名称:fontis_australia,代码行数:13,代码来源:Abstract.php

示例3: _render

 /**
  * (re)Render all items and totals
  */
 protected function _render()
 {
     if (!$this->_shouldRender) {
         return;
     }
     // regular items from the sales entity
     $this->_items = array();
     foreach ($this->_salesEntity->getAllItems() as $item) {
         if (!$item->getParentItem()) {
             $this->_addRegularItem($item);
         }
     }
     end($this->_items);
     $lastRegularItemKey = key($this->_items);
     // regular totals
     $shippingDescription = '';
     if ($this->_salesEntity instanceof Mage_Sales_Model_Order) {
         $shippingDescription = $this->_salesEntity->getShippingDescription();
         $this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(), self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()));
         $this->_applyHiddenTaxWorkaround($this->_salesEntity);
     } else {
         $address = $this->_salesEntity->getIsVirtual() ? $this->_salesEntity->getBillingAddress() : $this->_salesEntity->getShippingAddress();
         $shippingDescription = $address->getShippingDescription();
         $this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getBaseSubtotal(), self::TOTAL_TAX => $address->getBaseTaxAmount(), self::TOTAL_SHIPPING => $address->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()));
         $this->_applyHiddenTaxWorkaround($address);
     }
     $originalDiscount = $this->_totals[self::TOTAL_DISCOUNT];
     // arbitrary items, total modifications
     Mage::dispatchEvent('paypal_prepare_line_items', array('paypal_cart' => $this));
     // distinguish original discount among the others
     if ($originalDiscount > 0.0001 && isset($this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT])) {
         $this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT][] = Mage::helper('sales')->__('Discount (%s)', Mage::app()->getStore()->convertPrice($originalDiscount, true, false));
     }
     // discount, shipping as items
     if ($this->_isDiscountAsItem && $this->_totals[self::TOTAL_DISCOUNT]) {
         $this->addItem(Mage::helper('paypal')->__('Discount'), 1, -1.0 * $this->_totals[self::TOTAL_DISCOUNT], $this->_renderTotalLineItemDescriptions(self::TOTAL_DISCOUNT));
     }
     $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription);
     if ($this->_isShippingAsItem && (double) $this->_totals[self::TOTAL_SHIPPING]) {
         $this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (double) $this->_totals[self::TOTAL_SHIPPING], $shippingItemId);
     }
     // compound non-regular items into subtotal
     foreach ($this->_items as $key => $item) {
         if ($key > $lastRegularItemKey && $item->getAmount() != 0) {
             $this->_totals[self::TOTAL_SUBTOTAL] += $item->getAmount();
         }
     }
     $this->_validate();
     // if cart items are invalid, prepare cart for transfer without line items
     if (!$this->_areItemsValid) {
         $this->removeItem($shippingItemId);
     }
     $this->_shouldRender = false;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:57,代码来源:Cart.php

示例4: _addressesesAreDifferent

 /**
  * @param Mage_Sales_Model_Order $order
  * @return boolean $isDifferent
  */
 protected function _addressesesAreDifferent($order)
 {
     $isDifferent = 0;
     if ($order->getIsVirtual()) {
         return $isDifferent;
     }
     $billingAddress = $order->getBillingAddress();
     $shippingAddress = $order->getShippingAddress();
     $methods = array('getStreetFull', 'getCity', 'getCountryId', 'getPostcode', 'getRegionId');
     foreach ($methods as $method_name) {
         $billingValue = call_user_func(array($billingAddress, $method_name));
         $shippingValue = call_user_func(array($shippingAddress, $method_name));
         if ($billingValue != $shippingValue) {
             $isDifferent = 1;
             break;
         }
     }
     return $isDifferent;
 }
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:23,代码来源:Customer.php

示例5: _captureOrder

 /**
  * Capture order's payment using AIM.
  *
  * @param Mage_Sales_Model_Order $order
  */
 protected function _captureOrder(Mage_Sales_Model_Order $order)
 {
     $payment = $order->getPayment();
     if ($payment->getAdditionalInformation('payment_type') == self::ACTION_AUTHORIZE_CAPTURE) {
         try {
             $payment->setTransactionId(null)->setParentTransactionId($this->getResponse()->getXTransId())->capture(null);
             // set status from config for AUTH_AND_CAPTURE orders.
             if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
                 $orderStatus = $this->getConfigData('order_status');
                 if (!$orderStatus || $order->getIsVirtual()) {
                     $orderStatus = $order->getConfig()->getStateDefaultStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
                 }
                 if ($orderStatus) {
                     $order->setStatus($orderStatus);
                 }
             }
             $order->save();
         } catch (Exception $e) {
             Mage::logException($e);
             //if we couldn't capture order, just leave it as NEW order.
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:28,代码来源:Directpost.php

示例6: addOrderAddress

 /**
  * Add Payex Order Address
  * @param $orderRef
  * @param Mage_Sales_Model_Order $order
  * @return bool
  */
 public function addOrderAddress($orderRef, $order)
 {
     $billingAddress = $order->getBillingAddress()->getStreet();
     $billingCountryCode = $order->getBillingAddress()->getCountry();
     $billingCountry = Mage::getModel('directory/country')->load($billingCountryCode)->getName();
     $params = array('accountNumber' => '', 'orderRef' => $orderRef, 'billingFirstName' => $order->getBillingAddress()->getFirstname(), 'billingLastName' => $order->getBillingAddress()->getLastname(), 'billingAddress1' => $billingAddress[0], 'billingAddress2' => isset($billingAddress[1]) ? $billingAddress[1] : '', 'billingAddress3' => '', 'billingPostNumber' => (string) $order->getBillingAddress()->getPostcode(), 'billingCity' => (string) $order->getBillingAddress()->getCity(), 'billingState' => (string) $order->getBillingAddress()->getRegion(), 'billingCountry' => $billingCountry, 'billingCountryCode' => $billingCountryCode, 'billingEmail' => (string) $order->getBillingAddress()->getEmail(), 'billingPhone' => (string) $order->getBillingAddress()->getTelephone(), 'billingGsm' => '');
     // add Shipping
     $shipping_params = array('deliveryFirstName' => '', 'deliveryLastName' => '', 'deliveryAddress1' => '', 'deliveryAddress2' => '', 'deliveryAddress3' => '', 'deliveryPostNumber' => '', 'deliveryCity' => '', 'deliveryState' => '', 'deliveryCountry' => '', 'deliveryCountryCode' => '', 'deliveryEmail' => '', 'deliveryPhone' => '', 'deliveryGsm' => '');
     if (!$order->getIsVirtual()) {
         $deliveryAddress = $order->getShippingAddress()->getStreet();
         $deliveryCountryCode = $order->getShippingAddress()->getCountry();
         $deliveryCountry = Mage::getModel('directory/country')->load($deliveryCountryCode)->getName();
         $shipping_params = array('deliveryFirstName' => $order->getShippingAddress()->getFirstname(), 'deliveryLastName' => $order->getShippingAddress()->getLastname(), 'deliveryAddress1' => $deliveryAddress[0], 'deliveryAddress2' => isset($deliveryAddress[1]) ? $deliveryAddress[1] : '', 'deliveryAddress3' => '', 'deliveryPostNumber' => (string) $order->getShippingAddress()->getPostcode(), 'deliveryCity' => (string) $order->getShippingAddress()->getCity(), 'deliveryState' => (string) $order->getShippingAddress()->getRegion(), 'deliveryCountry' => $deliveryCountry, 'deliveryCountryCode' => $deliveryCountryCode, 'deliveryEmail' => (string) $order->getShippingAddress()->getEmail(), 'deliveryPhone' => (string) $order->getShippingAddress()->getTelephone(), 'deliveryGsm' => '');
     }
     $params += $shipping_params;
     $result = Mage::helper('payexautopay/api')->getPx()->AddOrderAddress2($params);
     Mage::helper('payexautopay/tools')->debugApi($result, 'PxOrder.AddOrderAddress2');
     return true;
 }
开发者ID:anziv,项目名称:Magento-modules,代码行数:25,代码来源:Order.php

示例7: orderCreateRequest

 /**
  * Initializes the payment.
  * @param Mage_Sales_Model_Order
  * @param Mage_Shipping_Model_Shipping
  * @return array
  */
 public function orderCreateRequest(Mage_Sales_Model_Order $order, $allShippingRates)
 {
     $this->_order = $order;
     $orderCurrencyCode = $this->_order->getOrderCurrencyCode();
     $orderCountryCode = $this->_order->getBillingAddress()->getCountry();
     $shippingCostList = array();
     if (empty($allShippingRates) || Mage::getSingleton('customer/session')->isLoggedIn()) {
         if ($order->getShippingInclTax() > 0) {
             $shippingCostList['shippingMethods'][] = array('name' => $order->getShippingDescription(), 'country' => $orderCountryCode, 'price' => $this->toAmount($order->getShippingInclTax()));
         }
         $grandTotal = $this->_order->getGrandTotal() - $order->getShippingInclTax();
     } else {
         $firstPrice = 0;
         foreach ($allShippingRates as $key => $rate) {
             $gross = $this->toAmount($rate->getPrice());
             if ($key == 0) {
                 $firstPrice = $rate->getPrice();
             }
             $shippingCostList['shippingMethods'][] = array('name' => $rate->getMethodTitle(), 'country' => $orderCountryCode, 'price' => $gross);
         }
         $grandTotal = $this->_order->getGrandTotal() - $firstPrice;
     }
     $shippingCost = array('countryCode' => $orderCountryCode, 'shipToOtherCountry' => 'true', 'shippingCostList' => $shippingCostList);
     $orderItems = $this->_order->getAllVisibleItems();
     $items = array();
     $productsTotal = 0;
     $is_discount = false;
     foreach ($orderItems as $key => $item) {
         $itemInfo = $item->getData();
         if ($itemInfo['discount_amount'] > 0) {
             $itemInfo['price_incl_tax'] = $itemInfo['price_incl_tax'] - $itemInfo['discount_amount'];
             $is_discount = true;
         } else {
             if ($itemInfo['discount_percent'] > 0) {
                 $itemInfo['price_incl_tax'] = $itemInfo['price_incl_tax'] * (100 - $itemInfo['discount_percent']) / 100;
             }
         }
         // Check if the item is countable one
         if ($this->toAmount($itemInfo['price_incl_tax']) > 0) {
             $items['products'][] = array('quantity' => (int) $itemInfo['qty_ordered'], 'name' => $itemInfo['name'], 'unitPrice' => $this->toAmount($itemInfo['price_incl_tax']));
             $productsTotal += $itemInfo['price_incl_tax'] * $itemInfo['qty_ordered'];
         }
     }
     //if($this->_order->getShippingAmount () > 0 && !empty ( $shippingCostList['shippingMethods'][0] ) ){
     //        $items ['products'] ['products'] [] = array (
     //            'quantity' => 1 ,'name' => Mage::helper ( 'payu_account' )->__('Shipping costs') . " - " . $shippingCostList['shippingMethods'][0]['name'] ,'unitPrice' => $this->toAmount ( $this->_order->getShippingAmount () ));
     //}
     // assigning the shopping cart
     $shoppingCart = array('grandTotal' => $this->toAmount($grandTotal), 'CurrencyCode' => $orderCurrencyCode, 'ShoppingCartItems' => $items);
     $orderInfo = array('merchantPosId' => OpenPayU_Configuration::getMerchantPosId(), 'orderUrl' => Mage::getBaseUrl() . 'sales/order/view/order_id/' . $this->_order->getId() . '/', 'description' => 'Order no ' . $this->_order->getRealOrderId(), 'validityTime' => $this->_config->getOrderValidityTime());
     if ($is_discount) {
         $items['products'] = array();
         $items['products'][] = array('quantity' => 1, 'name' => Mage::helper('payu_account')->__('Order # ') . $this->_order->getId(), 'unitPrice' => $this->toAmount($grandTotal));
     }
     $OCReq = $orderInfo;
     $OCReq['products'] = $items['products'];
     $OCReq['customerIp'] = Mage::app()->getFrontController()->getRequest()->getClientIp();
     $OCReq['notifyUrl'] = $this->_myUrl . 'orderNotifyRequest';
     $OCReq['cancelUrl'] = $this->_myUrl . 'cancelPayment';
     $OCReq['continueUrl'] = $this->_myUrl . 'continuePayment';
     $OCReq['currencyCode'] = $orderCurrencyCode;
     $OCReq['totalAmount'] = $shoppingCart['grandTotal'];
     $OCReq['extOrderId'] = $this->_order->getId() . '-' . microtime();
     if (!empty($shippingCostList)) {
         $OCReq['shippingMethods'] = $shippingCostList['shippingMethods'];
     }
     unset($OCReq['shoppingCart']);
     $customer_sheet = array();
     $billingAddressId = $this->_order->getBillingAddressId();
     if (!empty($billingAddressId)) {
         $billingAddress = $this->_order->getBillingAddress();
         $customer_mail = $billingAddress->getEmail();
         if (!empty($customer_mail)) {
             $customer_sheet = array('email' => $billingAddress->getEmail(), 'phone' => $billingAddress->getTelephone(), 'firstName' => $billingAddress->getFirstname(), 'lastName' => $billingAddress->getLastname());
             $shippingAddressId = $this->_order->getShippingAddressId();
             if (!empty($shippingAddressId)) {
                 $shippingAddress = $this->_order->getShippingAddress();
             }
             if (!$this->_order->getIsVirtual()) {
                 $customer_sheet['delivery'] = array('street' => trim(implode(' ', $shippingAddress->getStreet())), 'postalCode' => $shippingAddress->getPostcode(), 'city' => $shippingAddress->getCity(), 'countryCode' => $shippingAddress->getCountry(), 'recipientName' => trim($shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname()), 'recipientPhone' => $shippingAddress->getTelephone(), 'recipientEmail' => $shippingAddress->getEmail());
             }
             $OCReq['buyer'] = $customer_sheet;
         }
     }
     $result = OpenPayU_Order::create($OCReq);
     if ($result->getStatus() == 'SUCCESS') {
         // store session identifier in session info
         Mage::getSingleton('core/session')->setPayUSessionId($result->getResponse()->orderId);
         // assign current transaction id
         $this->_transactionId = $result->getResponse()->orderId;
         $order->getPayment()->setLastTransId($this->_transactionId);
         $locale = Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId());
         $lang_code = explode('_', $locale, 2);
         $ret = array('redirectUri' => $result->getResponse()->redirectUri, 'url' => OpenPayu_Configuration::getSummaryUrl(), 'sessionId' => $result->getResponse()->orderId, 'lang' => strtolower($lang_code[1]));
//.........这里部分代码省略.........
开发者ID:par-orillonsoft,项目名称:plugin_magento,代码行数:101,代码来源:Payment.php

示例8: importOrder

 /**
  * Import order information to the subscription.
  *
  * @param Mage_Sales_Model_Order $order
  * @return Customweb_Subscription_Model_Subscription
  */
 public function importOrder(Mage_Sales_Model_Order $order)
 {
     $this->getSubscription()->setInitialOrderId($order->getId());
     if ($order->getPayment() && $order->getPayment()->getMethod()) {
         $this->getSubscription()->setMethodInstance($order->getPayment()->getMethodInstance());
         if (!$this->getSubscription()->isMethodSuspendOnPendingPayment()) {
             $this->getSubscription()->activate();
         }
     }
     $orderInfo = $order->getData();
     $this->_cleanupArray($orderInfo);
     $this->getSubscription()->setOrderInfo($orderInfo);
     $addressInfo = $order->getBillingAddress()->getData();
     $this->_cleanupArray($addressInfo);
     $this->getSubscription()->setBillingAddressInfo($addressInfo);
     if (!$order->getIsVirtual()) {
         $addressInfo = $order->getShippingAddress()->getData();
         $this->_cleanupArray($addressInfo);
         $this->getSubscription()->setShippingAddressInfo($addressInfo);
     }
     $this->getSubscription()->setCurrencyCode($order->getBaseCurrencyCode());
     $this->getSubscription()->setCustomerId($order->getCustomerId());
     if ($order->getCustomerId() != null) {
         $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
         $this->getSubscription()->setSubscriberName($customer->getName());
     } else {
         $this->getSubscription()->setSubscriberName($order->getBillingAddress()->getName());
     }
     $this->getSubscription()->setStoreId($order->getStoreId());
     $this->getSubscription()->setLastDatetime(Mage::helper('customweb_subscription')->toDateString(Zend_Date::now()));
     if ($order->getPayment()) {
         $this->getSubscription()->setPaymentId($order->getPayment()->getId());
     }
     if ($this->getSubscription()->getData('shipping_amount_type') == 'fixed') {
         $this->getSubscription()->setShippingAmount($this->getSubscription()->getData('shipping_amount'));
     } else {
         $this->getSubscription()->setShippingAmount($order->getShippingAmount() + $order->getShippingTaxAmount());
     }
     $this->getSubscription()->setInitAmount($order->getSubscriptionInitAmount());
     $this->getSubscription()->setLastOrderId($order->getId());
     return $this->getSubscription();
 }
开发者ID:xiaoguizhidao,项目名称:extensiongsd,代码行数:48,代码来源:Create.php

示例9: getAddressParams

 /**
  * Return an array with address (shipping/billing) information to be used on API
  * @param Mage_Sales_Model_Order $order
  * @param string (billing|shipping) $type
  * @return array
  */
 public function getAddressParams(Mage_Sales_Model_Order $order, $type)
 {
     $digits = new Zend_Filter_Digits();
     //address attributes
     /** @var Mage_Sales_Model_Order_Address $address */
     $address = $type == 'shipping' && !$order->getIsVirtual() ? $order->getShippingAddress() : $order->getBillingAddress();
     $addressStreetAttribute = Mage::getStoreConfig('payment/pagseguro/address_street_attribute');
     $addressNumberAttribute = Mage::getStoreConfig('payment/pagseguro/address_number_attribute');
     $addressComplementAttribute = Mage::getStoreConfig('payment/pagseguro/address_complement_attribute');
     $addressNeighborhoodAttribute = Mage::getStoreConfig('payment/pagseguro/address_neighborhood_attribute');
     //gathering address data
     $addressStreet = $this->_getAddressAttributeValue($address, $addressStreetAttribute);
     $addressNumber = $this->_getAddressAttributeValue($address, $addressNumberAttribute);
     $addressComplement = $this->_getAddressAttributeValue($address, $addressComplementAttribute);
     $addressDistrict = $this->_getAddressAttributeValue($address, $addressNeighborhoodAttribute);
     $addressPostalCode = $digits->filter($address->getPostcode());
     $addressCity = $address->getCity();
     $addressState = $this->getStateCode($address->getRegion());
     $return = array($type . 'AddressStreet' => substr($addressStreet, 0, 80), $type . 'AddressNumber' => substr($addressNumber, 0, 20), $type . 'AddressComplement' => substr($addressComplement, 0, 40), $type . 'AddressDistrict' => substr($addressDistrict, 0, 60), $type . 'AddressPostalCode' => $addressPostalCode, $type . 'AddressCity' => substr($addressCity, 0, 60), $type . 'AddressState' => $addressState, $type . 'AddressCountry' => 'BRA');
     //shipping specific
     if ($type == 'shipping') {
         $shippingType = $this->_getShippingType($order);
         $shippingCost = $order->getShippingAmount();
         $return['shippingType'] = $shippingType;
         if ($shippingCost > 0) {
             if ($this->_shouldSplit($order)) {
                 $shippingCost -= 0.01;
             }
             $return['shippingCost'] = number_format($shippingCost, 2, '.', '');
         }
     }
     return $return;
 }
开发者ID:brunoalbim,项目名称:PagSeguro-Magento-Transparente,代码行数:39,代码来源:Params.php

示例10: getInvoiceExtraPrintBlocksXML

 /**
  * Generate Invoice Print XML
  * (only used for Factoring & PartPayment)
  * @param Mage_Sales_Model_Order $order
  * @return mixed
  */
 public function getInvoiceExtraPrintBlocksXML($order)
 {
     $dom = new DOMDocument('1.0', 'utf-8');
     $OnlineInvoice = $dom->createElement('OnlineInvoice');
     $dom->appendChild($OnlineInvoice);
     $OnlineInvoice->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $OnlineInvoice->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsd', 'http://www.w3.org/2001/XMLSchema');
     $OrderLines = $dom->createElement('OrderLines');
     $OnlineInvoice->appendChild($OrderLines);
     // Add Order Lines
     $items = $order->getAllVisibleItems();
     /** @var $item Mage_Sales_Model_Order_Item */
     foreach ($items as $item) {
         $itemQty = (int) $item->getQtyOrdered();
         $priceWithTax = $item->getRowTotalInclTax();
         $priceWithoutTax = $item->getRowTotal();
         $taxPercent = ($priceWithTax / $priceWithoutTax - 1) * 100;
         // works for all types
         $taxPrice = $priceWithTax - $priceWithoutTax;
         mb_regex_encoding("utf-8");
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', trim(mb_ereg_replace('[^a-zA-Z0-9_:!#=?\\[\\]@{}´ %-\\/À-ÖØ-öø-ú]', "-", $item->getName()))));
         $OrderLine->appendChild($dom->createElement('Qty', $itemQty));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $priceWithoutTax / $itemQty)));
         $OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $taxPercent)));
         $OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $taxPrice)));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $priceWithTax)));
         $OrderLines->appendChild($OrderLine);
     }
     // Add Shipping Line
     if (!$order->getIsVirtual()) {
         $shippingExclTax = $order->getShippingAmount();
         $shippingIncTax = $order->getShippingInclTax();
         $shippingTax = $shippingIncTax - $shippingExclTax;
         // find out tax-rate for the shipping
         if ((double) $shippingIncTax && (double) $shippingExclTax) {
             $shippingTaxRate = ($shippingIncTax / $shippingExclTax - 1) * 100;
         } else {
             $shippingTaxRate = 0;
         }
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $order->getShippingDescription()));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $shippingExclTax)));
         $OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $shippingTaxRate)));
         $OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $shippingTax)));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $shippingIncTax)));
         $OrderLines->appendChild($OrderLine);
     }
     // add Payment Fee
     $fee = $order->getPartpaymentPaymentFee();
     if ($fee > 0) {
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $this->getHelper()->__('Payment fee')));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $fee)));
         $OrderLine->appendChild($dom->createElement('VatRate', 0));
         $OrderLine->appendChild($dom->createElement('VatAmount', 0));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $fee)));
         $OrderLines->appendChild($OrderLine);
     }
     // add Discount
     /** @var AAIT_Shared_Helper_Discount $discountHelper */
     $discountHelper = Mage::helper("payexshared/discount");
     $discountData = $discountHelper->getOrderDiscountData($order);
     $discountInclTax = $discountData->getDiscountInclTax();
     $discountExclTax = $discountData->getDiscountExclTax();
     $discountVatAmount = $discountInclTax - $discountExclTax;
     $discountVatPercent = ($discountInclTax / $discountExclTax - 1) * 100;
     if (abs($discountInclTax) > 0) {
         $discount_description = $order->getDiscountDescription() !== null ? Mage::helper('sales')->__('Discount (%s)', $order->getDiscountDescription()) : Mage::helper('sales')->__('Discount');
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $discount_description));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", -1 * $discountExclTax)));
         $OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $discountVatPercent)));
         $OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", -1 * $discountVatAmount)));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", -1 * $discountInclTax)));
         $OrderLines->appendChild($OrderLine);
     }
     // Add reward points
     if ((double) $order->getBaseRewardCurrencyAmount() > 0) {
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $this->getHelper()->__('Reward points')));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', -1 * $order->getBaseRewardCurrencyAmount()));
         $OrderLine->appendChild($dom->createElement('VatRate', 0));
         $OrderLine->appendChild($dom->createElement('VatAmount', 0));
         $OrderLine->appendChild($dom->createElement('Amount', -1 * $order->getBaseRewardCurrencyAmount()));
         $OrderLines->appendChild($OrderLine);
     }
     return str_replace("\n", '', $dom->saveXML());
 }
开发者ID:AndreKlang,项目名称:Payex-Modules-Test,代码行数:99,代码来源:Order.php

示例11: getAddressParams

 /**
  * Retorna um array com informações do endereço de entrega/cobranca para ser enviado pra API
  * @param Mage_Sales_Model_Order $order
  * @param string (billing|shipping) $type
  * @return array
  */
 public function getAddressParams(Mage_Sales_Model_Order $order, $type)
 {
     $digits = new Zend_Filter_Digits();
     //atributos de endereço
     /** @var Mage_Sales_Model_Order_Address $address */
     $address = $type == 'shipping' && !$order->getIsVirtual() ? $order->getShippingAddress() : $order->getBillingAddress();
     $address_street_attribute = Mage::getStoreConfig('payment/pagseguro/address_street_attribute');
     $address_number_attribute = Mage::getStoreConfig('payment/pagseguro/address_number_attribute');
     $address_complement_attribute = Mage::getStoreConfig('payment/pagseguro/address_complement_attribute');
     $address_neighborhood_attribute = Mage::getStoreConfig('payment/pagseguro/address_neighborhood_attribute');
     //obtendo dados de endereço
     $addressStreet = $this->_getAddressAttributeValue($address, $address_street_attribute);
     $addressNumber = $this->_getAddressAttributeValue($address, $address_number_attribute);
     $addressComplement = $this->_getAddressAttributeValue($address, $address_complement_attribute);
     $addressDistrict = $this->_getAddressAttributeValue($address, $address_neighborhood_attribute);
     $addressPostalCode = $digits->filter($address->getPostcode());
     $addressCity = $address->getCity();
     $addressState = $this->getStateCode($address->getRegion());
     $retorno = array($type . 'AddressStreet' => $this->normalizeChars($addressStreet), $type . 'AddressNumber' => $addressNumber, $type . 'AddressComplement' => $this->normalizeChars($addressComplement), $type . 'AddressDistrict' => $this->normalizeChars($addressDistrict), $type . 'AddressPostalCode' => $addressPostalCode, $type . 'AddressCity' => $this->normalizeChars($addressCity), $type . 'AddressState' => $addressState, $type . 'AddressCountry' => 'BRA');
     //específico pra shipping
     if ($type == 'shipping') {
         $shippingType = $this->_getShippingType($order);
         $shippingCost = $order->getShippingAmount();
         $retorno['shippingType'] = $shippingType;
         if ($shippingCost > 0) {
             $retorno['shippingCost'] = number_format($shippingCost, 2, '.', '');
         }
     }
     return $retorno;
 }
开发者ID:Mr-Leonardooliveira,项目名称:PagSeguro-Magento-Transparente,代码行数:36,代码来源:Params.php

示例12: getCommonOrderValues

 /**
  * Returns the values which are identical for each row of the given order. These are
  * all the values which are not item specific: order data, shipping address, billing
  * address and order totals.
  * 
  * @param Mage_Sales_Model_Order $order The order to get values from
  * @return Array The array containing the non item specific values
  */
 protected function getCommonOrderValues($order)
 {
     $shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
     $billingAddress = $order->getBillingAddress();
     return array($order->getRealOrderId(), Mage::helper('core')->formatDate($order->getCreatedAt(), 'medium', true), $order->getStatus(), $this->getStoreName($order), $this->getPaymentMethod($order), $this->getShippingMethod($order), $this->formatPrice($order->getData('subtotal'), $order), $this->formatPrice($order->getData('tax_amount'), $order), $this->formatPrice($order->getData('shipping_amount'), $order), $this->formatPrice($order->getData('discount_amount'), $order), $this->formatPrice($order->getData('grand_total'), $order), $this->formatPrice($order->getData('base_grand_total'), $order), $this->formatPrice($order->getData('total_paid'), $order), $this->formatPrice($order->getData('total_refunded'), $order), $this->formatPrice($order->getData('total_due'), $order), $this->getTotalQtyItemsOrdered($order), $order->getCustomerName(), $order->getCustomerEmail(), $shippingAddress ? $shippingAddress->getName() : '', $shippingAddress ? $shippingAddress->getData("company") : '', $shippingAddress ? $shippingAddress->getData("street") : '', $shippingAddress ? $shippingAddress->getData("postcode") : '', $shippingAddress ? $shippingAddress->getData("city") : '', $shippingAddress ? $shippingAddress->getRegionCode() : '', $shippingAddress ? $shippingAddress->getRegion() : '', $shippingAddress ? $shippingAddress->getCountry() : '', $shippingAddress ? $shippingAddress->getCountryModel()->getName() : '', $shippingAddress ? $shippingAddress->getData("telephone") : '', $billingAddress->getName(), $billingAddress->getData("company"), $billingAddress->getData("street"), $billingAddress->getData("postcode"), $billingAddress->getData("city"), $billingAddress->getRegionCode(), $billingAddress->getRegion(), $billingAddress->getCountry(), $billingAddress->getCountryModel()->getName(), $billingAddress->getData("telephone"));
 }
开发者ID:xiaoguizhidao,项目名称:ortodon,代码行数:14,代码来源:Csv.php

示例13: getInvoiceExtraPrintBlocksXML

 /**
  * Generate Invoice Print XML
  * @param Mage_Sales_Model_Order $order
  * @return mixed
  */
 public function getInvoiceExtraPrintBlocksXML($order)
 {
     $dom = new DOMDocument('1.0', 'utf-8');
     $OnlineInvoice = $dom->createElement('OnlineInvoice');
     $dom->appendChild($OnlineInvoice);
     $OnlineInvoice->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
     $OnlineInvoice->setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsd', 'http://www.w3.org/2001/XMLSchema');
     $OrderLines = $dom->createElement('OrderLines');
     $OnlineInvoice->appendChild($OrderLines);
     // Add Order Lines
     $items = $order->getAllVisibleItems();
     /** @var $item Mage_Sales_Model_Order_Item */
     foreach ($items as $item) {
         // @todo Calculate prices using Discount Rules
         // @todo Get children products from bundle
         //if (!$item->getNoDiscount()) {
         //    Mage::helper('partpayment/tools')->addToDebug('Warning: The product has a discount. There might be problems.', $order->getIncrementId());
         //}
         $itemQty = (int) $item->getQtyOrdered();
         //$taxPrice = $item->getTaxAmount();
         $taxPrice = $itemQty * $item->getPriceInclTax() - $itemQty * $item->getPrice();
         $taxPercent = $item->getTaxPercent();
         $priceWithTax = $itemQty * $item->getPriceInclTax();
         // Calculate tax percent for Bundle products
         if ($item->getProductType() === Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
             $taxPercent = $taxPrice > 0 ? round(100 / (($priceWithTax - $taxPrice) / $taxPrice)) : 0;
         }
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $item->getName()));
         $OrderLine->appendChild($dom->createElement('Qty', $itemQty));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $item->getPrice())));
         $OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $taxPercent)));
         $OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $taxPrice)));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $priceWithTax)));
         $OrderLines->appendChild($OrderLine);
     }
     // Add Shipping Line
     if (!$order->getIsVirtual()) {
         $shipping = $order->getShippingAmount();
         //$shippingIncTax = $order->getShippingInclTax();
         $shippingTax = $order->getShippingTaxAmount();
         $shippingTaxPercent = $shipping != 0 ? (int) (100 * $shippingTax / $shipping) : 0;
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $order->getShippingDescription()));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $shipping)));
         $OrderLine->appendChild($dom->createElement('VatRate', sprintf("%.2f", $shippingTaxPercent)));
         $OrderLine->appendChild($dom->createElement('VatAmount', sprintf("%.2f", $shippingTax)));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $shipping + $shippingTax)));
         $OrderLines->appendChild($OrderLine);
     }
     // add Payment Fee
     $fee = $order->getPartpaymentPaymentFee();
     if ($fee > 0) {
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', Mage::helper('partpayment')->__('Payment fee')));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $fee)));
         $OrderLine->appendChild($dom->createElement('VatRate', 0));
         $OrderLine->appendChild($dom->createElement('VatAmount', 0));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $fee)));
         $OrderLines->appendChild($OrderLine);
     }
     // add Discount
     $discount = $order->getDiscountAmount() + $order->getShippingDiscountAmount();
     if (abs($discount) > 0) {
         $discount_description = $order->getDiscountDescription() !== null ? Mage::helper('sales')->__('Discount (%s)', $order->getDiscountDescription()) : Mage::helper('sales')->__('Discount');
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', $discount_description));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', sprintf("%.2f", $discount)));
         $OrderLine->appendChild($dom->createElement('VatRate', 0));
         $OrderLine->appendChild($dom->createElement('VatAmount', 0));
         $OrderLine->appendChild($dom->createElement('Amount', sprintf("%.2f", $discount)));
         $OrderLines->appendChild($OrderLine);
     }
     // Add reward points
     if ((double) $order->getBaseRewardCurrencyAmount() > 0) {
         $OrderLine = $dom->createElement('OrderLine');
         $OrderLine->appendChild($dom->createElement('Product', Mage::helper('partpayment')->__('Reward points')));
         $OrderLine->appendChild($dom->createElement('Qty', 1));
         $OrderLine->appendChild($dom->createElement('UnitPrice', -1 * $order->getBaseRewardCurrencyAmount()));
         $OrderLine->appendChild($dom->createElement('VatRate', 0));
         $OrderLine->appendChild($dom->createElement('VatAmount', 0));
         $OrderLine->appendChild($dom->createElement('Amount', -1 * $order->getBaseRewardCurrencyAmount()));
         $OrderLines->appendChild($OrderLine);
     }
     return str_replace("\n", '', $dom->saveXML());
 }
开发者ID:anziv,项目名称:Magento-modules,代码行数:94,代码来源:Order.php

示例14: getOrderData

 /**
  * Return the order data in an array for easy processing 
  *
  * @param Mage_Sales_Model_Order $order
  * @return array
  */
 protected function getOrderData($order)
 {
     $data = array();
     $shippingAddress = !$order->getIsVirtual() ? $order->getShippingAddress() : null;
     $billingAddress = $order->getBillingAddress();
     $data['OrderNumber'] = $order->getRealOrderId();
     //$data['OrderCreated'] = Mage::helper('core')->formatDate($order->getCreatedAt(), 'medium', true);
     //$data['OrderUpdated'] = Mage::helper('core')->formatDate($order->getUpdatedAt(), 'medium', true);
     //$data['OrderCreated'] = $order->getCreatedAt();
     //$data['OrderUpdated'] = $order->getUpdatedAt();
     $dateCreated = Mage::app()->getLocale()->date(strtotime($order->getCreatedAt()), null, null);
     $dateCreated = $dateCreated->toString('yyyy-MM-dd HH:mm:ss');
     $dateUpdated = Mage::app()->getLocale()->date(strtotime($order->getUpdatedAt()), null, null);
     $dateUpdated = $dateUpdated->toString('yyyy-MM-dd HH:mm:ss');
     $data['OrderCreated'] = $dateCreated;
     $data['OrderUpdated'] = $dateUpdated;
     $data['Status'] = $order->getStatus();
     $data['PurchasedFrom'] = $this->getStoreName($order);
     if (strtolower($this->getPaymentMethod($order)) == 'paytm_cc') {
         $data['PaymentMethod'] = 'Paytm-wallet';
     } else {
         if (strtolower($this->getPaymentMethod($order)) == 'payumoney_shared') {
             $data['PaymentMethod'] = 'Payumoney-wallet';
         } else {
             $data['PaymentMethod'] = $this->getPaymentMethod($order) == "free" ? 'prepaid' : $this->getPaymentMethod($order);
         }
     }
     $data['ShippingMethod'] = $this->getShippingMethod($order);
     //Shipping Provider
     $data['ShippingProvider'] = $order->getData('blinkecarrier_id');
     //$data['ExpectedDeliveryDate'] = $order->getData('shipping_arrival_date');
     $expectedDelivery = $order->getData('shipping_arrival_date');
     if (is_null($expectedDelivery)) {
         $dateDelivery = "";
     } else {
         $dateDelivery = Mage::app()->getLocale()->date(strtotime($order->getData('shipping_arrival_date')), null, null);
         $dateDelivery = $dateDelivery->toString('yyyy-MM-dd 00:00:00');
     }
     $data['ExpectedDeliveryDate'] = $dateDelivery;
     $timeSlot = $order->getData('shipping_time_slot');
     if (is_null($timeSlot)) {
         $timeSlot = "";
     }
     $data['ExpectedTimeSlot'] = $timeSlot;
     $data['Currency'] = $order->getOrderCurrencyCode();
     $data['ExchangeRate'] = $order->getBaseToOrderRate();
     $data['Subtotal'] = $order->getData('subtotal');
     $data['Tax'] = $order->getData('tax_amount');
     //VAT is for Delhi and CST for other states
     if ($shippingAddress->getRegionCode() == 'IN-DL') {
         $data['TaxCategory'] = 'VAT';
     } else {
         $data['TaxCategory'] = 'CST';
     }
     $data['ShippingAmount'] = $order->getData('shipping_amount');
     $data['Discount'] = $order->getData('discount_amount');
     $data['ShippingDiscountAmount'] = $order->getData('shipping_discount_amount');
     $data['RewardsDiscountAmount'] = $order->getData('rewards_discount_amount');
     $data['GrandTotal'] = $order->getData('grand_total');
     $data['TotalPaid'] = $order->getData('total_paid');
     $data['TotalRefunded'] = $order->getData('total_refunded');
     $data['TotalDue'] = $order->getData('total_due');
     $data['TotalInvoiced'] = $this->getTotalQtyItemsOrdered($order);
     $data['TotalQtyItemsOrdered'] = $this->getTotalQtyItemsOrdered($order);
     $data['Weight'] = $order->getWeight();
     $data['CustomerName'] = $order->getCustomerName();
     $data['CustomerFirstName'] = $order->getCustomerFirstname();
     $data['CustomerLastName'] = $order->getCustomerLastname();
     $data['CustomerMiddleName'] = $order->getCustomerMiddlename();
     $data['CustomerEmail'] = $order->getCustomerEmail();
     //Billing Address
     $data['BillToTitle'] = $billingAddress->getPrefix();
     $data['BillToName'] = $billingAddress->getName();
     $data['BillToFirstName'] = $billingAddress->getFirstname();
     $data['BillToLastName'] = $billingAddress->getLastname();
     $data['BillToMiddleName'] = $billingAddress->getMiddlename();
     $data['BillToAddressStreet'] = $billingAddress->getData("street");
     $data['BillToCity'] = $billingAddress->getData("city");
     $data['BillToRegionCode'] = $billingAddress->getRegionCode();
     $data['BillToRegion'] = $billingAddress->getRegion();
     $data['BillToCountry'] = $billingAddress->getCountry();
     $data['BillToCountryName'] = $billingAddress->getCountryModel()->getName();
     $data['BillToPostalCode'] = $billingAddress->getData("postcode");
     $billPhoneNumber = $billingAddress->getData("telephone");
     $data['BillToCustomerPhoneNum'] = $billPhoneNumber;
     $data['BillToEmail'] = $billingAddress->getData("email");
     //Shipping Address
     $data['ShipToTitle'] = $shippingAddress ? $shippingAddress->getPrefix() : '';
     $data['ShipToName'] = $shippingAddress ? $shippingAddress->getName() : '';
     $data['ShipToFirstName'] = $shippingAddress ? $shippingAddress->getFirstname() : '';
     $data['ShipToLastName'] = $shippingAddress ? $shippingAddress->getLastname() : '';
     $data['ShipToMiddleName'] = $shippingAddress ? $shippingAddress->getMiddlename() : '';
     $data['ShipToAddressStreet'] = $shippingAddress ? $shippingAddress->getData("street") : '';
     $data['ShipToCity'] = $shippingAddress ? $shippingAddress->getData("city") : '';
//.........这里部分代码省略.........
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:101,代码来源:Order.php


注:本文中的Mage_Sales_Model_Order::getIsVirtual方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。