當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Order::getStore方法代碼示例

本文整理匯總了PHP中Magento\Sales\Model\Order::getStore方法的典型用法代碼示例。如果您正苦於以下問題:PHP Order::getStore方法的具體用法?PHP Order::getStore怎麽用?PHP Order::getStore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Sales\Model\Order的用法示例。


在下文中一共展示了Order::getStore方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: send

 /**
  * Send email to customer
  *
  * @param Order $order
  * @param bool $notify
  * @param string $comment
  * @return bool
  */
 public function send(Order $order, $notify = true, $comment = '')
 {
     $transport = ['order' => $order, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order)];
     $this->eventManager->dispatch('email_order_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport]);
     $this->templateContainer->setTemplateVars($transport);
     return $this->checkAndSend($order, $notify);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:15,代碼來源:OrderCommentSender.php

示例2: canReorder

 /**
  * @param \Magento\Sales\Model\Order $order
  * @return bool
  */
 public function canReorder(\Magento\Sales\Model\Order $order)
 {
     if (!$this->isAllowed($order->getStore())) {
         return false;
     }
     if ($this->_customerSession->isLoggedIn()) {
         return $order->canReorder();
     } else {
         return true;
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:15,代碼來源:Reorder.php

示例3: send

 /**
  * Send email to customer
  *
  * @param Order $order
  * @param bool $notify
  * @param string $comment
  * @return bool
  */
 public function send(Order $order, $notify = true, $comment = '')
 {
     if ($order->getShippingAddress()) {
         $formattedShippingAddress = $this->addressRenderer->format($order->getShippingAddress(), 'html');
     } else {
         $formattedShippingAddress = '';
     }
     $formattedBillingAddress = $this->addressRenderer->format($order->getBillingAddress(), 'html');
     $transport = new \Magento\Framework\Object(['template_vars' => ['order' => $order, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore(), 'formattedShippingAddress' => $formattedShippingAddress, 'formattedBillingAddress' => $formattedBillingAddress]]);
     $this->eventManager->dispatch('email_order_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport]);
     $this->templateContainer->setTemplateVars($transport->getTemplateVars());
     return $this->checkAndSend($order, $notify);
 }
開發者ID:opexsw,項目名稱:magento2,代碼行數:21,代碼來源:OrderCommentSender.php

示例4: checkAndSend

 /**
  * @param Order $order
  * @return bool
  */
 protected function checkAndSend(Order $order)
 {
     $this->identityContainer->setStore($order->getStore());
     if (!$this->identityContainer->isEnabled()) {
         return false;
     }
     $this->prepareTemplate($order);
     /** @var SenderBuilder $sender */
     $sender = $this->getSender();
     $sender->send();
     $sender->sendCopyTo();
     return true;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:17,代碼來源:Sender.php

示例5: checkAndSend

 /**
  * Send email to customer
  *
  * @param Order $order
  * @param bool $notify
  * @return bool
  */
 protected function checkAndSend(Order $order, $notify = true)
 {
     $this->identityContainer->setStore($order->getStore());
     if (!$this->identityContainer->isEnabled()) {
         return false;
     }
     $this->prepareTemplate($order);
     /** @var SenderBuilder $sender */
     $sender = $this->getSender();
     if ($notify) {
         $sender->send();
     } else {
         // Email copies are sent as separated emails if their copy method is 'copy' or a customer should not be notified
         $sender->sendCopyTo();
     }
     return true;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:24,代碼來源:NotifySender.php

示例6: checkAndSend

 /**
  * @param Order $order
  * @return bool
  */
 protected function checkAndSend(Order $order)
 {
     $this->identityContainer->setStore($order->getStore());
     if (!$this->identityContainer->isEnabled()) {
         return false;
     }
     $this->prepareTemplate($order);
     /** @var SenderBuilder $sender */
     $sender = $this->getSender();
     try {
         $sender->send();
         $sender->sendCopyTo();
     } catch (\Exception $e) {
         $this->logger->error($e->getMessage());
     }
     return true;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:21,代碼來源:Sender.php

示例7: getCalculatedTaxes

 /**
  * Get calculated taxes for each tax class
  *
  * This method returns array with format:
  * array(
  *  $index => array(
  *      'tax_amount'        => $taxAmount,
  *      'base_tax_amount'   => $baseTaxAmount,
  *      'hidden_tax_amount' => $hiddenTaxAmount,
  *      'title'             => $title,
  *      'percent'           => $percent
  *  )
  * )
  *
  * @param \Magento\Sales\Model\Order $source
  * @return array
  */
 public function getCalculatedTaxes($source)
 {
     if ($this->_coreRegistry->registry('current_invoice')) {
         $current = $this->_coreRegistry->registry('current_invoice');
     } elseif ($this->_coreRegistry->registry('current_creditmemo')) {
         $current = $this->_coreRegistry->registry('current_creditmemo');
     } else {
         $current = $source;
     }
     $taxClassAmount = array();
     if ($current && $source) {
         if ($current == $source) {
             $orderTaxDetails = $this->orderTaxService->getOrderTaxDetails($current->getId());
             $appliedTaxes = $orderTaxDetails->getAppliedTaxes();
             foreach ($appliedTaxes as $appliedTax) {
                 $taxCode = $appliedTax->getCode();
                 $taxClassAmount[$taxCode]['tax_amount'] = $appliedTax->getAmount();
                 $taxClassAmount[$taxCode]['base_tax_amount'] = $appliedTax->getBaseAmount();
                 $taxClassAmount[$taxCode]['title'] = $appliedTax->getTitle();
                 $taxClassAmount[$taxCode]['percent'] = $appliedTax->getPercent();
             }
         } else {
             $orderTaxDetails = $this->orderTaxService->getOrderTaxDetails($source->getId());
             // Calculate taxes for shipping
             $shippingTaxAmount = $current->getShippingTaxAmount();
             if ($shippingTaxAmount) {
                 $shippingTax = $this->getShippingTax($current);
                 $taxClassAmount = array_merge($taxClassAmount, $shippingTax);
             }
             /** @var $item \Magento\Sales\Model\Order\Invoice\Item|\Magento\Sales\Model\Order\Creditmemo\Item */
             foreach ($current->getItemsCollection() as $item) {
                 $orderItem = $item->getOrderItem();
                 $orderItemId = $orderItem->getId();
                 $orderItemTax = $orderItem->getTaxAmount();
                 $itemTax = $item->getTaxAmount();
                 if (!$itemTax || !$orderItemTax) {
                     continue;
                 }
                 //In the case that invoiced item or creditmemo item qty is different from order item qty
                 $ratio = $itemTax / $orderItemTax;
                 $itemTaxDetails = $orderTaxDetails->getItems();
                 foreach ($itemTaxDetails as $itemTaxDetail) {
                     //Aggregate taxable items associated with an item
                     if ($itemTaxDetail->getItemId() == $orderItemId || $itemTaxDetail->getAssociatedItemId() == $orderItemId) {
                         $itemAppliedTaxes = $itemTaxDetail->getAppliedTaxes();
                         foreach ($itemAppliedTaxes as $itemAppliedTax) {
                             $taxCode = $itemAppliedTax->getCode();
                             if (!isset($taxClassAmount[$taxCode])) {
                                 $taxClassAmount[$taxCode]['title'] = $itemAppliedTax->getTitle();
                                 $taxClassAmount[$taxCode]['percent'] = $itemAppliedTax->getPercent();
                                 $taxClassAmount[$taxCode]['tax_amount'] = $itemAppliedTax->getAmount() * $ratio;
                                 $taxClassAmount[$taxCode]['base_tax_amount'] = $itemAppliedTax->getBaseAmount() * $ratio;
                             } else {
                                 $taxClassAmount[$taxCode]['tax_amount'] += $itemAppliedTax->getAmount() * $ratio;
                                 $taxClassAmount[$taxCode]['base_tax_amount'] += $itemAppliedTax->getBaseAmount() * $ratio;
                             }
                         }
                     }
                 }
             }
         }
         foreach ($taxClassAmount as $key => $tax) {
             if ($tax['tax_amount'] == 0 && $tax['base_tax_amount'] == 0) {
                 unset($taxClassAmount[$key]);
             } else {
                 $taxClassAmount[$key]['tax_amount'] = $source->getStore()->roundPrice($tax['tax_amount']);
                 $taxClassAmount[$key]['base_tax_amount'] = $source->getStore()->roundPrice($tax['base_tax_amount']);
             }
         }
         $taxClassAmount = array_values($taxClassAmount);
     }
     return $taxClassAmount;
 }
開發者ID:pavelnovitsky,項目名稱:magento2,代碼行數:90,代碼來源:Data.php

示例8: currencyFromOQ

 /**
  * 2016-09-07
  * @param O|Q $oq [optional]
  * @return Currency
  */
 private function currencyFromOQ($oq)
 {
     return $this->currency($oq->getStore(), dfp_currency($oq));
 }
開發者ID:mage2pro,項目名稱:core,代碼行數:9,代碼來源:Settings.php

示例9: send

 /**
  * Send email to customer
  *
  * @param Order $order
  * @param bool $notify
  * @param string $comment
  * @return bool
  */
 public function send(Order $order, $notify = true, $comment = '')
 {
     $this->templateContainer->setTemplateVars(['order' => $order, 'comment' => $comment, 'billing' => $order->getBillingAddress(), 'store' => $order->getStore()]);
     return $this->checkAndSend($order, $notify);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:13,代碼來源:OrderCommentSender.php

示例10: informCustomer

 public function informCustomer(\Magento\Sales\Model\Order $order, $amount, $currency)
 {
     try {
         if (!($order_increment_id = $order->getRealOrderId()) or !($method_config = $this->_s2pModel->getFullConfigArray())) {
             return false;
         }
         $siteUrl = $order->getStore()->getBaseUrl();
         $siteName = $this->_helper->getStoreName();
         $supportEmail = $this->_helper->getStoreConfig('trans_email/ident_support/email');
         $supportName = $this->_helper->getStoreConfig('trans_email/ident_support/name');
         $payment_details_arr['site_url'] = $siteUrl;
         $payment_details_arr['order_increment_id'] = $order_increment_id;
         $payment_details_arr['site_name'] = $siteName;
         $payment_details_arr['customer_name'] = $order->getCustomerName();
         $payment_details_arr['order_date'] = $order->getCreatedAtFormatted(\IntlDateFormatter::LONG);
         $payment_details_arr['support_email'] = $supportEmail;
         $payment_details_arr['total_paid'] = number_format($amount / 100, 2);
         $payment_details_arr['currency'] = $currency;
         $transport = $this->_transportBuilder->setTemplateIdentifier($method_config['smart2pay_email_payment_confirmation'])->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_ADMINHTML, 'store' => $order->getStore()->getId()])->setTemplateVars($payment_details_arr)->setFrom(['name' => $supportName, 'email' => $supportEmail])->addTo($order->getCustomerEmail())->getTransport();
         $transport->sendMessage();
     } catch (\Magento\Framework\Exception\MailException $e) {
         $this->_s2pLogger->write('Error sending customer informational email to [' . $order->getCustomerEmail() . ']', 'email_template');
         $this->_s2pLogger->write($e->getMessage(), 'email_exception');
     } catch (\Exception $e) {
         $this->_s2pLogger->write($e->getMessage(), 'exception');
     }
     return true;
 }
開發者ID:smart2pay,項目名稱:magento20,代碼行數:28,代碼來源:Notification.php

示例11: getStore

 /**
  * Get order store object
  *
  * @return \Magento\Store\Model\Store
  */
 public function getStore()
 {
     return $this->_order->getStore();
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:9,代碼來源:Tax.php


注:本文中的Magento\Sales\Model\Order::getStore方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。