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


PHP ResolverInterface::emulate方法代码示例

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


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

示例1: execute

 /**
  * Refresh sales refunded report statistics for last day
  *
  * @return void
  */
 public function execute()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->subHour(25);
     $this->refundedFactory->create()->aggregate($date);
     $this->localeResolver->revert();
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:13,代码来源:AggregateSalesReportRefundedData.php

示例2: execute

 /**
  * Refresh sales order report statistics for last day
  *
  * @return void
  */
 public function execute()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->sub(new \DateInterval('PT25H'));
     $this->orderFactory->create()->aggregate($date);
     $this->localeResolver->revert();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:AggregateSalesReportOrderData.php

示例3: execute

 /**
  * Refresh sales coupons report statistics for last day
  *
  * @return $this
  */
 public function execute()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->modify('-25 hours');
     $this->_reportRule->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:AggregateSalesReportCouponsData.php

示例4: aggregateSalesReportShipmentData

 /**
  * Refresh sales shipment report statistics for last day
  *
  * @return $this
  */
 public function aggregateSalesReportShipmentData()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = new \DateTime();
     $date = $currentDate->modify('-25 hours');
     $this->_shippingFactory->create()->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:14,代码来源:Observer.php

示例5: aggregateSalesReportShipmentData

 /**
  * Refresh sales shipment report statistics for last day
  *
  * @return $this
  */
 public function aggregateSalesReportShipmentData()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_coreLocale->date();
     $date = $currentDate->subHour(25);
     $this->_shippingFactory->create()->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:Observer.php

示例6: invoke

 /**
  * Refresh sales tax report statistics for last day
  *
  * @return $this
  */
 public function invoke()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->modify('-25 hours');
     /** @var $reportTax \Magento\Tax\Model\ResourceModel\Report\Tax */
     $reportTax = $this->reportTaxFactory->create();
     $reportTax->aggregate($date);
     $this->localeResolver->revert();
     return $this;
 }
开发者ID:IlyaGluschenko,项目名称:protection,代码行数:16,代码来源:AggregateSalesReportTaxData.php

示例7: aggregateSalesReportCouponsData

 /**
  * Refresh sales coupons report statistics for last day
  *
  * @return $this
  */
 public function aggregateSalesReportCouponsData()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     $this->_reportRule->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:Observer.php

示例8: getPriceFormat

 /**
  * Get prices javascript format json
  *
  * @param  null|int|string|Store $store
  * @return string
  */
 public function getPriceFormat($store = null)
 {
     $this->_localeResolver->emulate($store);
     $priceFormat = $this->_localeFormat->getPriceFormat();
     $this->_localeResolver->revert();
     if ($store) {
         $priceFormat['pattern'] = $this->_storeManager->getStore($store)->getCurrentCurrency()->getOutputFormat();
     }
     return $this->jsonHelper->jsonEncode($priceFormat);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:Data.php

示例9: aggregateSalesReportTaxData

 /**
  * Refresh sales tax report statistics for last day
  *
  * @param \Magento\Cron\Model\Schedule $schedule
  * @return $this
  */
 public function aggregateSalesReportTaxData($schedule)
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     /** @var $reportTax \Magento\Tax\Model\Resource\Report\Tax */
     $reportTax = $this->_reportTaxFactory->create();
     $reportTax->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Observer.php

示例10: getPdf

 /**
  * Return PDF document
  *
  * @param  array $shipments
  * @return \Zend_Pdf
  */
 public function getPdf($shipments = [])
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('shipment');
     $pdf = new \Zend_Pdf();
     $this->_setPdf($pdf);
     $style = new \Zend_Pdf_Style();
     $this->_setFontBold($style, 10);
     foreach ($shipments as $shipment) {
         if ($shipment->getStoreId()) {
             $this->_localeResolver->emulate($shipment->getStoreId());
             $this->_storeManager->setCurrentStore($shipment->getStoreId());
         }
         $page = $this->newPage();
         $order = $shipment->getOrder();
         /* Add image */
         $this->insertLogo($page, $shipment->getStore());
         /* Add address */
         $this->insertAddress($page, $shipment->getStore());
         /* Add head */
         $this->insertOrder($page, $shipment, $this->_scopeConfig->isSetFlag(self::XML_PATH_SALES_PDF_SHIPMENT_PUT_ORDER_ID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $order->getStoreId()));
         /* Add document text and number */
         $this->insertDocumentNumber($page, __('Packing Slip # ') . $shipment->getIncrementId());
         /* Add table */
         $this->_drawHeader($page);
         /* Add body */
         foreach ($shipment->getAllItems() as $item) {
             if ($item->getOrderItem()->getParentItem()) {
                 continue;
             }
             /* Draw item */
             $this->_drawItem($item, $page, $order);
             $page = end($pdf->pages);
         }
     }
     $this->_afterGetPdf();
     if ($shipment->getStoreId()) {
         $this->_localeResolver->revert();
     }
     return $pdf;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:47,代码来源:Shipment.php

示例11: getPdf

 /**
  * Format pdf file
  *
  * @param  null $shipment
  * @return \Zend_Pdf
  */
 public function getPdf($shipment = null)
 {
     $this->_beforeGetPdf();
     $this->_initRenderer('shipment');
     $pdf = new \Zend_Pdf();
     $this->_setPdf($pdf);
     $page = $this->newPage();
     if ($shipment->getStoreId()) {
         $this->_localeResolver->emulate($shipment->getStoreId());
         $this->_storeManager->setCurrentStore($shipment->getStoreId());
     }
     $this->_setFontRegular($page);
     $this->_drawHeaderBlock($page);
     $this->y = 740;
     $this->_drawPackageBlock($page);
     $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0));
     $this->_afterGetPdf();
     if ($shipment->getStoreId()) {
         $this->_localeResolver->revert();
     }
     return $pdf;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:28,代码来源:Packaging.php

示例12: getStoreDate

 /**
  * Retrieve Date value for store
  *
  * @param int $storeId
  * @param string $date
  * @return string|null
  */
 protected function getStoreDate($storeId, $date = null)
 {
     if (!isset($this->dates[$storeId])) {
         $timezone = $this->scopeConfig->getValue($this->localeDate->getDefaultTimezonePath(), \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
         $this->localeResolver->emulate($storeId);
         $dateObj = new \DateTime();
         $dateObj->setTimezone(new \DateTimeZone($timezone));
         $this->dates[$storeId] = $dateObj;
         $this->localeResolver->revert();
     }
     if (!$this->dateTime->isEmptyDate($date)) {
         /** @var \DateTime $dateObj */
         $dateObj = $this->dates[$storeId];
         return $this->localeDate->formatDateTime($dateObj, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE);
     }
     return null;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:24,代码来源:Full.php

示例13: getPaymentMarkWhatIsPaypalUrl

 /**
  * Get "What Is PayPal" localized URL
  * Supposed to be used with "mark" as popup window
  *
  * @param \Magento\Framework\Locale\ResolverInterface $localeResolver
  * @return string
  */
 public function getPaymentMarkWhatIsPaypalUrl(\Magento\Framework\Locale\ResolverInterface $localeResolver = null)
 {
     $countryCode = 'US';
     if (null !== $localeResolver) {
         $shouldEmulate = null !== $this->_storeId && $this->_storeManager->getStore()->getId() != $this->_storeId;
         if ($shouldEmulate) {
             $localeResolver->emulate($this->_storeId);
         }
         $countryCode = \Locale::getRegion($localeResolver->getLocale());
         if ($shouldEmulate) {
             $localeResolver->revert();
         }
     }
     return sprintf('https://www.paypal.com/%s/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside', strtolower($countryCode));
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:22,代码来源:Config.php

示例14: aggregateSalesReportBestsellersData

 /**
  * Refresh bestsellers report statistics for last day
  *
  * @param \Magento\Cron\Model\Schedule $schedule
  * @return $this
  */
 public function aggregateSalesReportBestsellersData($schedule)
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     $this->_bestsellersFactory->create()->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:Observer.php


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