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


PHP Http::getParam方法代码示例

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


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

示例1: aroundExecute

    /**
     * @param \Magento\Framework\App\ActionInterface $subject
     * @param callable $proceed
     * @param \Magento\Framework\App\RequestInterface $request
     * @return mixed
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function aroundExecute(
        \Magento\Framework\App\ActionInterface $subject,
        \Closure $proceed,
        \Magento\Framework\App\RequestInterface $request
    ) {
        /** @var \Magento\Store\Model\Store $defaultStore */
        $defaultStore = $this->storeManager->getWebsite()->getDefaultStore();

        $requestedStoreCode = $this->httpRequest->getParam(
            StoreResolverInterface::PARAM_NAME,
            $this->storeCookieManager->getStoreCodeFromCookie()
        );
        /** @var \Magento\Store\Model\Store $currentStore */
        $currentStore = $requestedStoreCode ? $this->storeManager->getStore($requestedStoreCode) : $defaultStore;

        $this->httpContext->setValue(
            StoreManagerInterface::CONTEXT_STORE,
            $currentStore->getCode(),
            $this->storeManager->getDefaultStoreView()->getCode()
        );

        $this->httpContext->setValue(
            HttpContext::CONTEXT_CURRENCY,
            $this->session->getCurrencyCode() ?: $currentStore->getDefaultCurrencyCode(),
            $defaultStore->getDefaultCurrencyCode()
        );
        return $proceed($request);
    }
开发者ID:nblair,项目名称:magescotch,代码行数:35,代码来源:Context.php

示例2: aroundDispatch

 /**
  * @param \Magento\Framework\App\Action\Action $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return mixed
  */
 public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     $defaultStore = $this->storeManager->getWebsite()->getDefaultStore();
     $this->httpContext->setValue(\Magento\Core\Helper\Data::CONTEXT_CURRENCY, $this->session->getCurrencyCode(), $defaultStore->getDefaultCurrency()->getCode());
     $this->httpContext->setValue(\Magento\Core\Helper\Data::CONTEXT_STORE, $this->httpRequest->getParam('___store', $defaultStore->getStoreCodeFromCookie()), $this->storeManager->getWebsite()->getDefaultStore()->getCode());
     return $proceed($request);
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:13,代码来源:Context.php

示例3: execute

 /**
  * Redirects tracking popup to specific URL
  * @param \Magento\Framework\Event\Observer $observer
  *
  * @return $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $shippingInfoModel = $this->_shippingInfoFactory->create()->loadByHash($this->_request->getParam('hash'));
     if ($url = $this->shipmentHelper->getTrackingUrlByShippingInfo($shippingInfoModel)) {
         $controller = $observer->getControllerAction();
         $controller->getResponse()->setRedirect($url);
         $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
     }
     return $observer;
 }
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:16,代码来源:TrackingPopup.php

示例4: getLabel

 /**
  * @return mixed
  */
 public function getLabel()
 {
     if ($this->fieldName == 'discountedPrice') {
         return str_replace("-", " - ", $this->_request->getParam('bx_discountedPrice'));
     }
     return $this->bxFacets->getSelectedValueLabel($this->fieldName);
 }
开发者ID:boxalino,项目名称:plugin-magento2,代码行数:10,代码来源:LayerFilterItem.php

示例5: aroundDispatch

 /**
  * @param \Magento\Framework\App\ActionInterface $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return mixed
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\ActionInterface $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     /** @var \Magento\Store\Model\Store $defaultStore */
     $defaultStore = $this->storeManager->getWebsite()->getDefaultStore();
     $storeCode = $this->httpRequest->getParam(StoreResolverInterface::PARAM_NAME, $this->storeCookieManager->getStoreCodeFromCookie());
     if (is_array($storeCode)) {
         if (!isset($storeCode['_data']['code'])) {
             throw new \InvalidArgumentException(new Phrase('Invalid store parameter.'));
         }
         $storeCode = $storeCode['_data']['code'];
     }
     /** @var \Magento\Store\Model\Store $currentStore */
     $currentStore = $storeCode ? $this->storeManager->getStore($storeCode) : $defaultStore;
     $this->httpContext->setValue(StoreManagerInterface::CONTEXT_STORE, $currentStore->getCode(), $this->storeManager->getDefaultStoreView()->getCode());
     $this->httpContext->setValue(HttpContext::CONTEXT_CURRENCY, $this->session->getCurrencyCode() ?: $currentStore->getDefaultCurrencyCode(), $defaultStore->getDefaultCurrencyCode());
     return $proceed($request);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:24,代码来源:Context.php

示例6: _beforeSave

 /**
  * Before model save
  * @param  \Magefan\Blog\Model\Post $model
  * @param  \Magento\Framework\App\Request\Http $request
  * @return void
  */
 protected function _beforeSave($model, $request)
 {
     if ($links = $request->getParam('links')) {
         foreach (array('post', 'product') as $key) {
             $param = 'related' . $key . 's';
             if (!empty($links[$param])) {
                 $ids = array_unique(array_map('intval', explode('&', $links[$param])));
                 if (count($ids)) {
                     $model->setData('related_' . $key . '_ids', $ids);
                 }
             }
         }
     }
 }
开发者ID:samitrimal,项目名称:Blog-Extension-for-Magento-2,代码行数:20,代码来源:Save.php

示例7: getCurrentPage

 /**
  * Return current page from request
  *
  * @return int
  */
 public function getCurrentPage()
 {
     $page = (int) $this->request->getParam(self::PAGE_PARM_NAME);
     return $page ? $page : 1;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:Toolbar.php


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