예제 #1
0
파일: Review.php 프로젝트: kid17/magento2
 /**
  * Get product view url
  *
  * @param string|int $productId
  * @param string|int $storeId
  * @return string
  */
 public function getProductUrl($productId, $storeId)
 {
     if ($storeId) {
         $this->_urlModel->setScope($storeId);
     }
     return $this->_urlModel->getUrl('catalog/product/view', ['id' => $productId]);
 }
예제 #2
0
 /**
  * Get action url
  *
  * @param string $routePath
  * @param string $scope
  * @param string $store
  * @return string
  */
 public function getUrl($routePath, $scope, $store)
 {
     $this->frontendUrlBuilder->setScope($scope);
     $href = $this->frontendUrlBuilder->getUrl($routePath, ['_current' => false, '_query' => '___store=' . $store]);
     return $href;
 }
예제 #3
0
 /**
  * Retrieve url using store configuration specific
  *
  * @param   string $route
  * @param   array $params
  * @return  string
  */
 public function getUrl($route = '', $params = [])
 {
     /** @var $url UrlInterface */
     $url = $this->_url->setScope($this);
     if ($this->_storeManager->getStore()->getId() != $this->getId()) {
         $params['_scope_to_url'] = true;
     }
     return $url->getUrl($route, $params);
 }
예제 #4
0
 /**
  * Generate URL for the specified store.
  *
  * @param \Magento\Store\Model\Store $store
  * @param string $route
  * @param array $params
  * @return string
  */
 public function getUrl(\Magento\Store\Model\Store $store, $route = '', $params = [])
 {
     $url = $this->urlModel->setScope($store);
     if ($this->storeManager->getStore()->getId() != $store->getId()) {
         $params['_scope_to_url'] = true;
     }
     return $url->getUrl($route, $params);
 }
 /**
  * {@inheritdoc}
  */
 public function initiatePasswordReset($email, $template, $websiteId = null)
 {
     if (is_null($websiteId)) {
         $websiteId = $this->storeManager->getStore()->getWebsiteId();
     }
     // load customer by email
     $customer = $this->customerRegistry->retrieveByEmail($email, $websiteId);
     $newPasswordToken = $this->mathRandom->getUniqueHash();
     $customer->changeResetPasswordLinkToken($newPasswordToken);
     $this->url->setScope($customer->getStoreId());
     $resetUrl = $this->url->getUrl('customer/account/createPassword', ['_query' => array('id' => $customer->getId(), 'token' => $newPasswordToken), '_store' => $customer->getStoreId()]);
     $customer->setResetPasswordUrl($resetUrl);
     try {
         switch ($template) {
             case CustomerAccountServiceInterface::EMAIL_REMINDER:
                 $customer->sendPasswordReminderEmail();
                 break;
             case CustomerAccountServiceInterface::EMAIL_RESET:
                 $customer->sendPasswordResetConfirmationEmail();
                 break;
             default:
                 throw new InputException(InputException::INVALID_FIELD_VALUE, ['value' => $template, 'fieldName' => 'email type']);
         }
     } catch (MailException $e) {
         // If we are not able to send a reset password email, this should be ignored
         $this->logger->logException($e);
     }
 }
예제 #6
0
 /**
  * Retrieve unsubsription url
  *
  * @param \Magento\Newsletter\Model\Subscriber $subscriber
  * @return string
  */
 public function getUnsubscribeUrl($subscriber)
 {
     return $this->_frontendUrlBuilder->setScope($subscriber->getStoreId())->getUrl('newsletter/subscriber/unsubscribe', ['id' => $subscriber->getId(), 'code' => $subscriber->getCode(), '_nosid' => true]);
 }
예제 #7
0
 /**
  * Get action url
  *
  * @param string $routePath
  * @param string $scope
  * @param string $store
  * @return string
  */
 public function getUrl($routePath, $scope, $store)
 {
     $this->frontendUrlBuilder->setScope($scope);
     $href = $this->frontendUrlBuilder->getUrl($routePath, ['_current' => false, '_query' => [StoreResolverInterface::PARAM_NAME => $store]]);
     return $href;
 }