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


PHP Mage_Sales_Model_Order::hasInvoices方法代码示例

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


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

示例1: cancelaPedido

 public function cancelaPedido(Mage_Sales_Model_Order $order)
 {
     $paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
     $listPaymentMethodsIdeasa = Mage::helper('base')->listPaymentMethods();
     $this->logger->info('Processando cancelamento do pedido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
     try {
         if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
             $order->cancel();
             //força o cancelamento
             if ($order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED) {
                 $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('Pedido cancelado'), $notified = false);
             } else {
                 $order->addStatusToHistory($order->getStatus(), Mage::helper('base')->__('Pedido cancelado.'));
             }
             if ($order->hasInvoices() != '') {
                 $order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('O pagamento e o pedido foram cancelados, mas não foi possível retornar os produtos ao estoque pois já havia uma fatura gerada para este pedido.'), $notified = false);
             }
             $order->save();
         }
         if (Mage::helper('base')->isIdeasaPaymentMethod($paymentMethod) && Mage::helper('base/module')->isPagSeguroDiretoExists() && $paymentMethod == $listPaymentMethodsIdeasa[0]) {
             Mage::getModel('pagsegurodireto/notification')->sendEmail($order);
         }
     } catch (Exception $e) {
         $this->logger->error("Erro ao cancelar pedido {$orderId} \n {$e->__toString}()");
     }
     $this->logger->info('Cancelamento do pedido foi concluido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
     return;
 }
开发者ID:adrianomelo5,项目名称:magento,代码行数:28,代码来源:ExpiraPedido.php

示例2: _saveInvoice

 /**
  * Saves an invoice and sets total-paid for the order
  *
  * @return bool
  */
 protected function _saveInvoice()
 {
     if ($this->_order->canInvoice() && !$this->_order->hasInvoices()) {
         $payment = $this->_order->getPayment();
         $payment->registerCaptureNotification($this->_order->getBaseGrandTotal());
         $this->_order->save();
         $this->_debugEmail .= 'Invoice created and saved. \\n';
         //sets the invoice's transaction ID as the Buckaroo TRX. This is to allow the order to be refunded using Buckaroo later on.
         foreach ($this->_order->getInvoiceCollection() as $invoice) {
             if (!isset($this->_postArray['brq_transactions'])) {
                 continue;
             }
             $invoice->setTransactionId($this->_postArray['brq_transactions'])->save();
         }
         return true;
     }
     return false;
 }
开发者ID:technomagegithub,项目名称:olgo.nl,代码行数:23,代码来源:Push.php

示例3: canCancel

 public function canCancel(Mage_Sales_Model_Order $order)
 {
     if ($order->getCustomerId() != Mage::getSingleton('customer/session')->getCustomerId()) {
         return false;
     }
     if (!in_array($order->getState(), Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates(), $strict = true)) {
         return false;
     }
     if (!$order->canCancel() || $order->hasInvoices() || $order->hasShipments()) {
         return false;
     }
     if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW && $this->canCancelNew($order->getStore())) {
         return true;
     }
     if ($order->getState() == Mage_Sales_Model_Order::STATE_PENDING_PAYMENT && $this->canCancelPending($order->getStore())) {
         return true;
     }
     return false;
 }
开发者ID:sequra,项目名称:Modgit-Order-Monitor,代码行数:19,代码来源:Customer.php

示例4: process

 /**
  * @return self
  */
 public function process()
 {
     $orderId = $this->_payload->getCustomerOrderId();
     $this->_order = $this->_getOrder($orderId);
     $logData = ['order_id' => $orderId];
     if (!$this->_order) {
         $logMessage = 'Order ({order_id}) not found in Magento. Could not process that order.';
         $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
         return $this;
     }
     if (!$this->_order->canCreditMemo()) {
         $logMessage = 'Credit memo cannot be created for order {order_id}';
         $this->_logger->warning($logMessage, $this->_context->getMetaData(__CLASS__, $logData));
         return $this;
     }
     $this->_order->getAllVisibleItems();
     if ($this->_order->hasInvoices()) {
         $this->_processInvoicedCreditMemos();
     } else {
         $this->_processCreditMemo();
     }
     return $this;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:26,代码来源:Creditissued.php

示例5: updateOrderFromTransactionData

 /**
  * edit order if something changed
  * 
  * @param SofortLib_TransactionData $transData
  * @param Mage_Sales_Model_Order $order
  * @return boolean
  */
 public function updateOrderFromTransactionData($transData, $order)
 {
     // total amount without refunded
     $amount = number_format($order->getGrandTotal() - $order->getBaseTotalRefunded(), 2, '.', '');
     // if amount still the same, there was nothing edit
     if ($amount == $transData->getAmount()) {
         return false;
     }
     // transaction was cancel, nothing change, order will cancel full
     if ($transData->isLoss()) {
         return false;
     }
     // store items get from remote
     $checkItems = array();
     foreach ($transData->getItems() as $item) {
         $checkItems[$item['item_id']] = $item;
     }
     // order already invoice => create creditmemo
     if ($order->hasInvoices()) {
         return $this->_createCreditMemo($transData, $order, $checkItems);
     }
     // update total
     $order->setGrandTotal($transData->getAmount());
     $order->setBaseGrandTotal($transData->getAmount());
     $subTotal = 0;
     $taxAmount = array();
     // if discount value change the discount store on each row is broken
     // so we just remove it
     $removeDiscount = false;
     // edit discount amount
     if (empty($checkItems[2])) {
         $order->setDiscountAmount(0);
         $removeDiscount = true;
     } else {
         $order->setDiscountAmount($checkItems[2]['quantity'] * $checkItems[2]['unit_price']);
         $removeDiscount = true;
     }
     // check all items in the current order
     foreach ($order->getAllVisibleItems() as $item) {
         $uid = md5($item->getSku() . "-" . $item->getItemId());
         // if not exist it should removed
         if (empty($checkItems[$uid])) {
             // item was cancel
             $this->_cancelItem($item);
             unset($checkItems[$uid]);
             continue;
         }
         // quantity or price change, new row values will be calculated
         if ($checkItems[$uid]['quantity'] != $item->getQtyOrdered() || $item->getPrice() != $checkItems[$uid]['unit_price']) {
             $item->setQtyCanceled($item->getQtyOrdered() - $checkItems[$uid]['quantity']);
             $singleTax = $checkItems[$uid]['unit_price'] - $checkItems[$uid]['unit_price'] * (100 / ($checkItems[$uid]['tax'] + 100));
             $item->setPrice($checkItems[$uid]['unit_price'] - $singleTax);
             $item->setBasePrice($checkItems[$uid]['unit_price'] - $singleTax);
             $item->setPriceInclTax($checkItems[$uid]['unit_price']);
             $item->setBasePriceInclTax($checkItems[$uid]['unit_price']);
             $rowTotalInclTag = $checkItems[$uid]['quantity'] * $checkItems[$uid]['unit_price'];
             $rowTax = $rowTotalInclTag - $rowTotalInclTag * (100 / ($checkItems[$uid]['tax'] + 100));
             $rowTotal = $rowTotalInclTag - $rowTax;
             $item->setRowTotalInclTax($rowTotalInclTag);
             $item->setBaseRowTotalInclTax($rowTotalInclTag);
             $item->setRowTotal($rowTotal);
             $item->setBaseRowTotal($rowTotal);
             $item->setTaxAmount($rowTax);
             $item->setBaseTaxAmount($rowTax);
         }
         // add to subtotal
         $subTotal += $checkItems[$uid]['quantity'] * $checkItems[$uid]['unit_price'];
         // appent to tax group
         if (empty($taxAmount[$checkItems[$uid]['tax']])) {
             $taxAmount[$checkItems[$uid]['tax']] = 0;
         }
         $taxAmount[$checkItems[$uid]['tax']] += $item->getRowTotalInclTax();
         // remove discount from order row
         if ($removeDiscount) {
             $item->setDiscountPercent(0);
             $item->setDiscountAmount(0);
             $item->setBaseDiscountAmount(0);
         }
         unset($checkItems[$uid]);
     }
     // edit shipment amount if it was removed
     if (empty($checkItems[1]) && $order->getShippingAmount()) {
         $order->setShippingAmount(0);
         $order->setBaseShippingAmount(0);
         $order->setShippingTaxAmount(0);
         $order->setBaseShippingTaxAmount(0);
         $order->setShippingInclTax(0);
         $order->setBaseShippingInclTax(0);
     } else {
         $shippingWithTax = $checkItems[1]['quantity'] * $checkItems[1]['unit_price'];
         $shippingTax = $shippingWithTax - $shippingWithTax * (100 / ($checkItems[1]['tax'] + 100));
         $shippingAmount = $shippingWithTax - $shippingTax;
         $order->setShippingAmount($shippingAmount);
//.........这里部分代码省略.........
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:101,代码来源:Sofortrechnung.php

示例6: createInvoice

 /**
  * Depending on the settings we create an invoice and capture it.
  *
  * @param Mage_Sales_Model_Order $order
  * @param boolean Returns true if an invoice has been created.
  */
 protected function createInvoice(Mage_Sales_Model_Order $order, Customweb_SaferpayCw_Model_Transaction $transaction)
 {
     try {
         $isSettlementAfterOrder = $this->getPaymentMethodConfigurationValue('settlement');
         $isCaptureAfterOrder = $transaction->getTransactionObject()->isCaptured();
         $this->getHelper()->log("Payment config: settlement='" . $isSettlementAfterOrder . "' capturing='" . $isCaptureAfterOrder . "'");
         if ($isSettlementAfterOrder != 'settlement_direct') {
             return false;
         }
         // Do not create multiple invoices
         if ($order->hasInvoices()) {
             return false;
         }
         $invoice = $order->prepareInvoice();
         if ($isCaptureAfterOrder) {
             $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
         }
         $invoice->register();
         $invoice->setTransactionId($transaction->getTransactionObject()->getPaymentId());
         $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
         $transactionSave->save();
         if ($this->getConfigData('invoice_send_email')) {
             $invoice->sendEmail();
         }
         return true;
     } catch (Exception $e) {
         $this->getHelper()->log("Create Invoice: " . $e->getMessage());
         return false;
     }
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:36,代码来源:Method.php


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