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


PHP OrderInjectable::getCouponCode方法代碼示例

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


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

示例1: test

 /**
  * Sales coupon report
  *
  * @param OrderInjectable $order
  * @param array $viewsReport
  * @return void
  */
 public function test(OrderInjectable $order, array $viewsReport)
 {
     // Precondition
     $order->persist();
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->salesOrderView->getPageActions()->invoice();
     $this->orderInvoiceNew->getTotalsBlock()->submit();
     $this->reportStatistic->open();
     $this->reportStatistic->getGridBlock()->massaction([['report' => 'Coupons']], 'Refresh Statistics for the Last Day', true);
     // Steps
     $this->salesCouponReportView->open();
     $ruleName = $order->getCouponCode()->getName();
     if (isset($viewsReport['rules_list'])) {
         $viewsReport['rules_list'] = str_replace('%rule_name%', $ruleName, $viewsReport['rules_list']);
     }
     $this->salesCouponReportView->getFilterBlock()->viewsReport($viewsReport);
     $this->salesCouponReportView->getActionBlock()->showReport();
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:26,代碼來源:SalesCouponReportEntityTest.php

示例2: setCoupon

 /**
  * Set coupon to quote.
  *
  * @param OrderInjectable $order
  * @return void
  * @throws \Exception
  */
 protected function setCoupon(OrderInjectable $order)
 {
     if (!$order->hasData('coupon_code')) {
         return;
     }
     $url = $this->url . '/coupons/' . $order->getCouponCode()->getCouponCode();
     $data = ['cartId' => $this->quote, 'couponCode' => $order->getCouponCode()->getCouponCode()];
     $this->webapiTransport->write($url, $data, WebapiDecorator::PUT);
     $response = json_decode($this->webapiTransport->read(), true);
     $this->webapiTransport->close();
     if ($response !== true) {
         $this->eventManager->dispatchEvent(['webapi_failed'], [$response]);
         throw new \Exception('Could not apply coupon code!');
     }
 }
開發者ID:VoblaSmile,項目名稱:php56-magento2-data,代碼行數:22,代碼來源:Webapi.php


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