/** * Renders grid column * * @param \Magento\Framework\Object $row * @return string */ public function render(\Magento\Framework\Object $row) { $readDetailsHtml = $row->getUrl() ? '<a class="action-details" target="_blank" href="' . $row->getUrl() . '">' . __('Read Details') . '</a>' : ''; $markAsReadHtml = !$row->getIsRead() ? '<a class="action-mark" href="' . $this->getUrl('*/*/markAsRead/', array('_current' => true, 'id' => $row->getId())) . '">' . __('Mark as Read') . '</a>' : ''; $encodedUrl = $this->_urlHelper->getEncodedUrl(); return sprintf('%s%s<a class="action-delete" href="%s" onClick="deleteConfirm(\'%s\', this.href); return false;">%s</a>', $readDetailsHtml, $markAsReadHtml, $this->getUrl('*/*/remove/', array('_current' => true, 'id' => $row->getId(), \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED => $encodedUrl)), __('Are you sure?'), __('Remove')); }
/** * Set auth url * * @param string $key * @param string $url * @return $this */ protected function _setAuthUrl($key, $url) { $url = $this->_coreUrl->removeRequestParam($url, $this->sidResolver->getSessionIdQueryParam($this)); // Add correct session ID to URL if needed $url = $this->_createUrl()->getRebuiltUrl($url); return $this->storage->setData($key, $url); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\View\LayoutInterface $layout * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\View\LayoutInterface $layout, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig) { $this->_coreRegistry = $coreRegistry; $this->_layout = $layout; $this->_scopeConfig = $scopeConfig; parent::__construct($context, $storeManager); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Checkout\Model\Cart $checkoutCart * @param \Magento\Checkout\Model\Session $checkoutSession */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Core\Helper\Data $coreData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Checkout\Model\Cart $checkoutCart, \Magento\Checkout\Model\Session $checkoutSession) { $this->_coreData = $coreData; $this->_scopeConfig = $scopeConfig; $this->_checkoutCart = $checkoutCart; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $storeManager); }
/** * Retrieve create new account url * * @return string */ public function getCreateAccountUrl() { $url = $this->getData('create_account_url'); if (is_null($url)) { $url = $this->_customerHelper->getRegisterUrl(); } if ($this->checkoutData->isContextCheckout()) { $url = $this->coreUrl->addRequestParam($url, array('context' => 'checkout')); } return $url; }
/** * Get item delete url * * @return string */ public function getDeleteUrl() { if ($this->hasDeleteUrl()) { return $this->getData('delete_url'); } $params = ['id' => $this->getItem()->getId()]; if (!$this->_request->isAjax()) { $encodedUrl = $this->_urlHelper->getEncodedUrl(); $params[\Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED] = $encodedUrl; } return $this->getUrl('checkout/cart/delete', $params); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Core\Helper\Data $coreData */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Core\Helper\Data $coreData) { $this->_coreData = $coreData; parent::__construct($context, $storeManager); }
/** * Prepare current URL for referer * * @return string */ public function getUrlForReferer() { return \Magento\Framework\App\Action\Action::PARAM_NAME_URL_ENCODED . '/' . $this->_urlHelper->getEncodedUrl(); }
/** * Redirect to login page * * @return void */ public function redirectLogin() { $this->_actionFlag->set('', 'no-dispatch', true); $this->_customerSession->setBeforeAuthUrl($this->_redirect->getRefererUrl()); $this->getResponse()->setRedirect($this->_urlHelper->addRequestParam($this->_customerHelper->getLoginUrl(), array('context' => 'checkout'))); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\Framework\Data\Form\FormKey $formKey * @param \Magento\Wishlist\Helper\Data $wishlistHelper * @param \Magento\Core\Helper\PostData $coreHelper */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Session $catalogSession, \Magento\Framework\Data\Form\FormKey $formKey, \Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Core\Helper\PostData $coreHelper) { $this->_itemCollectionFactory = $itemCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_logVisitor = $logVisitor; $this->_customerSession = $customerSession; $this->_catalogSession = $catalogSession; $this->_formKey = $formKey; $this->_wishlistHelper = $wishlistHelper; $this->_coreHelper = $coreHelper; parent::__construct($context, $storeManager); }
public function testGetHomeUrl() { $this->assertEquals('http://localhost/index.php/', $this->_helper->getHomeUrl()); }
/** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\Framework\View\Asset\Repository $assetRepo * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Catalog\Model\Attribute\Config $attributeConfig * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig * @param string $typeSwitcherLabel * @param \Magento\Catalog\Model\CategoryFactory $reindexPriceIndexerData */ public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Session $catalogSession, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\Registry $coreRegistry, \Magento\Catalog\Model\Attribute\Config $attributeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, $typeSwitcherLabel, $reindexPriceIndexerData) { $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; $this->_catalogSession = $catalogSession; $this->_typeSwitcherLabel = $typeSwitcherLabel; $this->_attributeConfig = $attributeConfig; $this->_coreRegistry = $coreRegistry; $this->_scopeConfig = $scopeConfig; $this->_assetRepo = $assetRepo; $this->_coreConfig = $coreConfig; $this->_reindexPriceIndexerData = $reindexPriceIndexerData; parent::__construct($context, $storeManager); }