本文整理汇总了PHP中Magento\Framework\Locale\ResolverInterface::revert方法的典型用法代码示例。如果您正苦于以下问题:PHP ResolverInterface::revert方法的具体用法?PHP ResolverInterface::revert怎么用?PHP ResolverInterface::revert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Locale\ResolverInterface
的用法示例。
在下文中一共展示了ResolverInterface::revert方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例10: 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;
}
示例11: getPdf
/**
* Return PDF document
*
* @param array $invoices
* @return \Zend_Pdf
*/
public function getPdf($invoices = [])
{
$this->_beforeGetPdf();
$this->_initRenderer('invoice');
$pdf = new \Zend_Pdf();
$this->_setPdf($pdf);
$style = new \Zend_Pdf_Style();
$this->_setFontBold($style, 10);
foreach ($invoices as $invoice) {
if ($invoice->getStoreId()) {
$this->_localeResolver->emulate($invoice->getStoreId());
$this->_storeManager->setCurrentStore($invoice->getStoreId());
}
$page = $this->newPage();
$order = $invoice->getOrder();
/* Add image */
$this->insertLogo($page, $invoice->getStore());
/* Add address */
$this->insertAddress($page, $invoice->getStore());
/* Add head */
$this->insertOrder($page, $order, $this->_scopeConfig->isSetFlag(self::XML_PATH_SALES_PDF_INVOICE_PUT_ORDER_ID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $order->getStoreId()));
/* Add document text and number */
$this->insertDocumentNumber($page, __('Invoice # ') . $invoice->getIncrementId());
/* Add table */
$this->_drawHeader($page);
/* Add body */
foreach ($invoice->getAllItems() as $item) {
if ($item->getOrderItem()->getParentItem()) {
continue;
}
/* Draw item */
$this->_drawItem($item, $page, $order);
$page = end($pdf->pages);
}
/* Add totals */
$this->insertTotals($page, $invoice);
if ($invoice->getStoreId()) {
$this->_localeResolver->revert();
}
}
$this->_afterGetPdf();
return $pdf;
}
示例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;
}
示例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));
}
示例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;
}