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


PHP Mage_Sales_Model_Order类代码示例

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


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

示例1: canReorder

 public function canReorder(Mage_Sales_Model_Order $order)
 {
     if (!$this->isAllow()) {
         return false;
     }
     return $order->canReorder();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:7,代码来源:Reorder.php

示例2: addOrderToQueue

 /**
  * Add the items from the given order to the Order Sync queue. Does nothing if
  * Order Sync is disabled for the store that the order was placed in.
  *
  * @param Mage_Sales_Model_Order $order
  * @param bool                   $force Skip enabled check
  *
  * @return $this
  */
 public function addOrderToQueue(Mage_Sales_Model_Order $order, $force = false)
 {
     if (!$this->isEnabled($order->getStoreId()) && !$force) {
         return $this;
     }
     $items = array();
     foreach ($order->getAllVisibleItems() as $item) {
         /** @var Mage_Sales_Model_Order_Item $item */
         // For configurable products add children items only, for all other products add parents
         if ($item->getProductType() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
             foreach ($item->getChildrenItems() as $child) {
                 if ($child->getId() != null) {
                     $items[] = $child->getId();
                 }
             }
         } else {
             if ($item->getId() != null) {
                 $items[] = $item->getId();
             }
         }
     }
     // in case of multiple addresses used for shipping
     // its possible that items object here is empty
     // if so, we do not add to the item.
     if (!empty($items)) {
         $this->addItemsToQueue($items);
     }
     return $this;
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:38,代码来源:Sync.php

示例3: setOrder

 /**
  * @param Mage_Sales_Model_Order $order
  *
  * @return $this
  */
 public function setOrder(Mage_Sales_Model_Order $order)
 {
     if ($order && $order->getId()) {
         $this->_order = $order;
     }
     return $this;
 }
开发者ID:Tracksale,项目名称:tracksale-magento,代码行数:12,代码来源:Connection.php

示例4: filterValidForOrder

 public function filterValidForOrder(Mage_Sales_Model_Order $order)
 {
     $this->addFieldToFilter('is_active', '1');
     $this->addFieldToFilter('website_ids', ['finset' => $order->getStore()->getWebsiteId()]);
     $this->addOrder('sort_order', 'DESC');
     return $this;
 }
开发者ID:aoepeople,项目名称:aoe_fraudmanager,代码行数:7,代码来源:Collection.php

示例5: processOrder

 /**
  * Processes payment for specified order
  * @param Mage_Sales_Model_Order $Order
  * @return
  */
 public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
 {
     $amount = $Order->getGrandTotal();
     $increment = $Order->getIncrementId();
     $VendorTxCode = $increment . "-" . date("y-m-d-H-i-s", time()) . "-" . rand(0, 1000000);
     $model = Mage::getModel('sarp/protxDirect')->load($this->getSubscription()->getId(), 'subscription_id');
     $data = array('VPSProtocol' => self::PROTOCOL_VERSION, 'TxType' => self::REPEAT, 'Vendor' => Mage::getStoreConfig(self::VENDOR), 'VendorTxCode' => $VendorTxCode, 'Amount' => $amount, 'Currency' => $Order->getOrderCurrencyCode(), 'Description' => 'Order', 'RelatedVPSTxId' => $model->getVpsTxId(), 'RelatedVendorTxCode' => $model->getVendorTxCode(), 'RelatedSecurityKey' => $model->getSecurityKey(), 'RelatedTxAuthNo' => $model->getTxAuthNo());
     $ready = array();
     foreach ($data as $key => $value) {
         $ready[] = $key . '=' . $value;
     }
     $str = implode('&', $ready);
     switch (Mage::getStoreConfig(self::MODE)) {
         case 'test':
             $url = self::TEST_REPEAT_URL;
             break;
         case 'live':
             $url = self::LIVE_REPEAT_URL;
             break;
         default:
             $url = self::SIMULATOR_REPEAT_URL;
     }
     $ready = $this->requestPost($url, $str);
     if (empty($ready)) {
         throw new AW_Sarp_Exception($this->__("Order cannot be completed. Unknown error"));
     }
     if ($ready['Status'] != 'OK') {
         throw new AW_Sarp_Exception($ready['Status'] . " - " . $ready['StatusDetail']);
     }
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:35,代码来源:ProtxDirect.php

示例6: getOrderSecret

 /**
  * Generate and return order secret
  *
  * @param Mage_Sales_Model_Order $order
  * @return string
  */
 public function getOrderSecret($order)
 {
     $email = $order->getCustomerEmail();
     $orderId = $order->getRealOrderId();
     $storeSecret = $this->getSBSecret();
     return md5($email . $orderId . $storeSecret);
 }
开发者ID:ruuska,项目名称:magento-storebadge-ordertracking,代码行数:13,代码来源:Success.php

示例7: _getQuoteFromOrder

 /**
  * Load a Quote object from an Order object
  * @param Mage_Sales_Model_Order $order
  * @return Mage_Sales_Model_Quote
  */
 protected function _getQuoteFromOrder($order)
 {
     if (!$this->_quote instanceof Mage_Sales_Model_Quote) {
         $this->_quote = Mage::getModel('sales/quote')->load($order->getQuoteId());
     }
     return $this->_quote;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:12,代码来源:Beacon.php

示例8: create

 /**
  * @throws Payone_Core_Exception_InvoicePreparationNoItems|Payone_Core_Exception_InvoiceSave
  * @param Mage_Sales_Model_Order $order
  * @param array $itemsQty
  * @param null $invoiceIncrementId
  * @return Mage_Sales_Model_Order_Invoice
  */
 protected function create(Mage_Sales_Model_Order $order, array $itemsQty = array(), $invoiceIncrementId = null)
 {
     /* @var $invoice Mage_Sales_Model_Order_Invoice */
     $invoice = $order->prepareInvoice($itemsQty);
     if ($invoiceIncrementId) {
         $invoice->setIncrementId($invoiceIncrementId);
     }
     $invoice->setTransactionId($order->getPayment()->getLastTransId());
     if (count($invoice->getAllItems()) <= 0) {
         throw new Payone_Core_Exception_InvoicePreparationNoItems($order->getIncrementId());
     }
     if ($invoice) {
         $invoice->register();
         $invoice->setEmailSent(false);
         $invoice->getOrder()->setIsInProcess(true);
         try {
             $transactionSave = $this->getFactory()->getModelResourceTransaction();
             $transactionSave->addObject($invoice);
             $transactionSave->addObject($invoice->getOrder());
             $transactionSave->save();
         } catch (Mage_Core_Exception $e) {
             throw new Payone_Core_Exception_InvoiceSave($e->getMessage());
         }
         return $invoice;
     }
     return null;
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:34,代码来源:InvoiceCreate.php

示例9: is_aplazame_payment

 /**
  * @param Mage_Sales_Model_Order $order
  * @return bool
  */
 protected function is_aplazame_payment($order)
 {
     $code = Aplazame_Aplazame_Model_Payment::METHOD_CODE;
     /** @var Mage_Sales_Model_Order $parentOrder */
     $parentOrder = Mage::getModel('sales/order')->loadByIncrementId($order->getIncrementId());
     return $code == $parentOrder->getPayment()->getMethod();
 }
开发者ID:aplazame,项目名称:magento,代码行数:11,代码来源:Observer.php

示例10: orderSuccessEvent

 /**
  * Adiciona o Link do meio de pagamento a página de sucesso.
  * @param $observer
  */
 public function orderSuccessEvent($observer)
 {
     try {
         $order = new Mage_Sales_Model_Order();
         $lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
         $order->loadByIncrementId($lastOrderId);
         $quoteId = $order->getQuoteId();
         $quote = Mage::getModel("sales/quote")->loadByIdWithoutStore($quoteId);
         $type = null;
         $payment_method_bcash = $quote->getPaymentMethodBcash();
         if ($payment_method_bcash) {
             $helper = new Bcash_Pagamento_Helper_PaymentMethod();
             $type = $helper->getPaymentMethod($payment_method_bcash);
         }
         $layout = Mage::app()->getLayout();
         $block = $layout->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
         $block->setOrder($order);
         $block->setQuote($quote);
         $block->setType($type);
         $layout->getBlock('content')->append($block);
         $bcashTransacation = $order->getTransactionIdBcash();
         Mage::helper("bcash")->saveLog("Pedido '" . $lastOrderId . "' realizado com sucesso. Transacao: " . $bcashTransacation);
     } catch (Exception $e) {
         Mage::helper("bcash")->saveLog($e->getMessage());
     }
 }
开发者ID:payu-br,项目名称:bcash-magento-transparente,代码行数:30,代码来源:Observer.php

示例11: checkRelation

 public function checkRelation(Mage_Sales_Model_Order $order)
 {
     /**
      * Check customer existing
      */
     $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
     if (!$customer->getId()) {
         $this->_getSession()->addNotice(Mage::helper('adminhtml')->__(' The customer does not exist in the system anymore.'));
     }
     /**
      * Check Item products existing
      */
     $productIds = array();
     foreach ($order->getAllItems() as $item) {
         $productIds[] = $item->getProductId();
     }
     $productCollection = Mage::getModel('catalog/product')->getCollection()->addIdFilter($productIds)->load();
     $hasBadItems = false;
     foreach ($order->getAllItems() as $item) {
         if (!$productCollection->getItemById($item->getProductId())) {
             $this->_getSession()->addError(Mage::helper('adminhtml')->__('The item %s (SKU %s) does not exist in the catalog anymore.', $item->getName(), $item->getSku()));
             $hasBadItems = true;
         }
     }
     if ($hasBadItems) {
         $this->_getSession()->addError(Mage::helper('adminhtml')->__('Some of the ordered items do not exist in the catalog anymore and will be removed if you try to edit the order.'));
     }
     return $this;
 }
开发者ID:hirentricore,项目名称:devmagento,代码行数:29,代码来源:Order.php

示例12: _redirectByOrder

 /**
  * @param Mage_Sales_Model_Order $order
  *
  * @return $this
  */
 protected function _redirectByOrder(Mage_Sales_Model_Order $order)
 {
     if (!$order->getId()) {
         $this->_redirectCart();
         return $this;
     }
     if ($order->isCanceled()) {
         $this->_redirectPaymentError();
         return $this;
     }
     switch ($order->getState()) {
         case Mage_Sales_Model_Order::STATE_NEW:
             $this->_redirectOrderPending();
             break;
         case Mage_Sales_Model_Order::STATE_CANCELED:
             $this->_redirectPaymentError();
             break;
         case Mage_Sales_Model_Order::STATE_PROCESSING:
         case Mage_Sales_Model_Order::STATE_COMPLETE:
         case Mage_Sales_Model_Order::STATE_CLOSED:
         case Mage_Sales_Model_Order::STATE_HOLDED:
         case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW:
         default:
             $this->_redirectOrderState();
             break;
     }
     return $this;
 }
开发者ID:marcoescudeiro,项目名称:clickpag-magento,代码行数:33,代码来源:Action.php

示例13: applyOrder

 public function applyOrder(Mage_Sales_Model_Order $order, $sendEmail = false)
 {
     $this->_order = $order;
     $timestamp = new Zend_Date();
     $this->setOrderId($order->getId())->setIsNotified($sendEmail ? 1 : 0)->setAssignTime($timestamp->toString(Zend_Date::ISO_8601))->save();
     return $this;
 }
开发者ID:rjocoleman,项目名称:magpleasure_assignorder,代码行数:7,代码来源:History.php

示例14: prepareValues

 public function prepareValues(Mage_Sales_Model_Order $order)
 {
     $billing_address = $order->getBillingAddress();
     $additional_data = unserialize($order->getPayment()->getAdditionalData());
     $code_banco = $additional_data['code_banco'];
     $data_vencimento = $additional_data['data_vencimento'];
     $numero_boleto = str_replace('-', '', $order->getIncrementId());
     $strtotime = strtotime($order->getCreatedAt());
     $data = array('logoempresa' => $this->getConfig('logoempresa'), 'nosso_numero' => $numero_boleto, 'numero_documento' => $numero_boleto, 'data_vencimento' => $data_vencimento, 'data_documento' => date('d/m/Y', $strtotime), 'data_processamento' => date('d/m/Y', $strtotime), 'valor_boleto' => number_format($order->getGrandTotal() + $this->getLayoutConfig($code_banco, 'valor_adicional'), 2, ',', ''), 'valor_unitario' => number_format($order->getGrandTotal() + $this->getLayoutConfig($code_banco, 'valor_adicional'), 2, ',', ''), 'sacado' => $billing_address->getFirstname() . ' ' . $billing_address->getLastname(), 'sacadocpf' => $order->getCustomerTaxvat(), 'endereco1' => implode(' ', $billing_address->getStreet()), 'endereco2' => $billing_address->getCity() . ' - ' . $billing_address->getRegion() . ' - CEP: ' . $billing_address->getPostcode(), 'identificacao' => $this->getLayoutConfig($code_banco, 'identificacao'), 'cpf_cnpj' => $this->getLayoutConfig($code_banco, 'cpf_cnpj'), 'endereco' => $this->getLayoutConfig($code_banco, 'endereco'), 'cidade_uf' => $this->getLayoutConfig($code_banco, 'cidade_uf'), 'cedente' => $this->getLayoutConfig($code_banco, 'cedente'), 'agencia' => $this->getLayoutConfig($code_banco, 'agencia'), 'agencia_dv' => $this->getLayoutConfig($code_banco, 'agencia_dv'), 'conta' => $this->getLayoutConfig($code_banco, 'conta'), 'conta_dv' => $this->getLayoutConfig($code_banco, 'conta_dv'), 'carteira' => $this->getLayoutConfig($code_banco, 'carteira'), 'especie' => $this->getLayoutConfig($code_banco, 'especie'), 'especie_doc' => $this->getLayoutConfig($code_banco, 'especie_doc'), 'aceite' => $this->getLayoutConfig($code_banco, 'aceite'), 'quantidade' => $this->getLayoutConfig($code_banco, 'quantidade'));
     if ($code_banco == 'santander_banespa') {
         $data['ponto_venda'] = $this->getLayoutConfig($code_banco, 'ponto_venda');
         $data['carteira_descricao'] = $this->getLayoutConfig($code_banco, 'carteira_descricao');
         $data['codigo_cliente'] = $this->getLayoutConfig($code_banco, 'codigo_cliente');
     }
     if ($code_banco == 'bradesco') {
         $data['conta_cedente'] = $this->getLayoutConfig($code_banco, 'conta_cedente');
         $data['conta_cedente_dv'] = $this->getLayoutConfig($code_banco, 'conta_cedente_dv');
     }
     if ($code_banco == 'cef' || $code_banco == 'cef_sinco' || $code_banco == 'cef_sigcb') {
         $data['conta_cedente_caixa'] = $this->getLayoutConfig($code_banco, 'conta_cedente_caixa');
         $data['conta_cedente_dv_caixa'] = $this->getLayoutConfig($code_banco, 'conta_cedente_dv_caixa');
         $data['inicio_nosso_numero'] = $this->getLayoutConfig($code_banco, 'inicio_nosso_numero');
     }
     if ($code_banco == 'bb') {
         $data['convenio'] = $this->getLayoutConfig($code_banco, 'convenio');
         $data['contrato'] = $this->getLayoutConfig($code_banco, 'contrato');
         $data['variacao_carteira'] = $this->getLayoutConfig($code_banco, 'variacao_carteira');
         $data['formatacao_convenio'] = $this->getLayoutConfig($code_banco, 'formatacao_convenio');
         $data['formatacao_nosso_numero'] = $this->getLayoutConfig($code_banco, 'formatacao_nosso_numero');
     }
     if ($code_banco == 'hsbc') {
         $data['codigo_cedente'] = $this->getLayoutConfig($code_banco, 'codigo_cedente');
     }
     if ($code_banco == 'cef_sinco') {
         $data['campo_fixo_obrigatorio'] = $this->getLayoutConfig($code_banco, 'campo_fixo_obrigatorio');
     }
     if ($code_banco == 'cef_sigcb') {
         $data['nosso_numero1'] = $this->getLayoutConfig($code_banco, 'nosso_numero1');
         $data['nosso_numero_const1'] = $this->getLayoutConfig($code_banco, 'nosso_numero_const1');
         $data['nosso_numero2'] = $this->getLayoutConfig($code_banco, 'nosso_numero2');
         $data['nosso_numero_const2'] = $this->getLayoutConfig($code_banco, 'nosso_numero_const2');
         $data['nosso_numero3'] = $numero_boleto;
     }
     if ($code_banco == 'sicoob') {
         $data['convenio'] = $this->getLayoutConfig($code_banco, 'codigo_cedente');
         $data["numero_parcela"] = '001';
     }
     $instrucoes = explode("\n", $this->getLayoutConfig($code_banco, 'instrucoes_boleto'));
     for ($i = 0; $i < 4; $i++) {
         $instrucao = isset($instrucoes[$i]) ? $instrucoes[$i] : '';
         $data['instrucoes' . ($i + 1)] = $instrucao;
     }
     $info = sprintf($this->getLayoutConfig($code_banco, 'informacoes'), $order->getIncrementId());
     $informacoes = explode("\n", $info);
     for ($i = 0; $i < 3; $i++) {
         $informacao = isset($informacoes[$i]) ? $informacoes[$i] : '';
         $data['demonstrativo' . ($i + 1)] = $informacao;
     }
     return $data;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:60,代码来源:Standard.php

示例15: getOrderItemValue

 /**
  * Retrieve order item value by key
  *
  * @param Mage_Sales_Model_Order $order
  * @param string $key
  * @return string
  */
 public function getOrderItemValue(Mage_Sales_Model_Order $order, $key)
 {
     $escape = true;
     switch ($key) {
         case 'order_increment_id':
             $value = $order->getIncrementId();
             break;
         case 'created_at':
             $value = $this->helper('core')->formatDate($order->getCreatedAt(), 'short', true);
             break;
         case 'shipping_address':
             $value = $order->getShippingAddress() ? $this->escapeHtml($order->getShippingAddress()->getName()) : $this->__('N/A');
             break;
         case 'order_total':
             $value = $order->formatPrice($order->getGrandTotal());
             $escape = false;
             break;
         case 'status_label':
             $value = $order->getStatusLabel();
             break;
         case 'view_url':
             $value = $this->getUrl('*/order/view', array('order_id' => $order->getId()));
             break;
         default:
             $value = $order->getData($key) ? $order->getData($key) : $this->__('N/A');
     }
     return $escape ? $this->escapeHtml($value) : $value;
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:35,代码来源:View.php


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