本文整理汇总了PHP中Magento\Framework\App\Http\Context::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getValue方法的具体用法?PHP Context::getValue怎么用?PHP Context::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Http\Context
的用法示例。
在下文中一共展示了Context::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBackTitle
/**
* Return back title for logged in and guest users
*
* @return \Magento\Framework\Phrase
*/
public function getBackTitle()
{
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
return __('Back to My Orders');
}
return __('View Another Order');
}
示例2: _toHtml
/**
* @return string
*/
protected function _toHtml()
{
if ($this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH)) {
return '';
}
return parent::_toHtml();
}
示例3: _toHtml
/**
* @return string
*/
protected function _toHtml()
{
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
return '';
}
return parent::_toHtml();
}
示例4: getReorderUrl
/**
* Get url for reorder action
*
* @param \Magento\Sales\Model\Order $order
* @return string
*/
public function getReorderUrl($order)
{
if (!$this->httpContext->getValue(Context::CONTEXT_AUTH)) {
return $this->getUrl('sales/guest/reorder', ['order_id' => $order->getId()]);
}
return $this->getUrl('sales/order/reorder', ['order_id' => $order->getId()]);
}
示例5: _toHtml
/**
* {@inheritdoc}
*/
protected function _toHtml()
{
if (!$this->_customerHelper->isRegistrationAllowed() || $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH)) {
return '';
}
return parent::_toHtml();
}
示例6: _toHtml
/**
* {@inheritdoc}
*/
protected function _toHtml()
{
if (!$this->_registration->isAllowed() || $this->httpContext->getValue(Context::CONTEXT_AUTH)) {
return '';
}
return parent::_toHtml();
}
示例7: getCustomerGroupId
/**
* Get customer group id
*
* @return int
*/
protected function getCustomerGroupId()
{
$customerGroupId = (int) $this->getRequest()->getParam('cid');
if ($customerGroupId == null) {
$customerGroupId = $this->httpContext->getValue(Context::CONTEXT_GROUP);
}
return $customerGroupId;
}
示例8: getWelcome
/**
* Retrieve welcome text
*
* @return string
*/
public function getWelcome()
{
if (empty($this->_data['welcome'])) {
if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
$customerName = $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject());
$this->_data['welcome'] = __('Welcome, %1!', $this->escapeHtml($customerName));
} else {
$this->_data['welcome'] = $this->_scopeConfig->getValue('design/header/welcome', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
}
}
return $this->_data['welcome'];
}
示例9: getReorderUrl
/**
* Get url for reorder action
*
* @param \Magento\Sales\Model\Order $order
* @return string
*/
public function getReorderUrl($order)
{
if (!$this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH)) {
return $this->getUrl('sales/guest/reorder', array('order_id' => $order->getId()));
}
return $this->getUrl('sales/order/reorder', array('order_id' => $order->getId()));
}
示例10: getBackTitle
/**
* Return back title for logged in and guest users
*
* @return string
*/
public function getBackTitle()
{
if ($this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH)) {
return __('Back to My Orders');
}
return __('View Another Order');
}
示例11: getDefaultFrom
/**
* Get default value for From field
*
* @return string
*/
public function getDefaultFrom()
{
if ($this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH)) {
return $this->_customerSession->getCustomer()->getName();
} else {
return $this->getEntity()->getBillingAddress()->getName();
}
}
示例12: isWishlistActive
/**
* @return bool
*/
public function isWishlistActive()
{
$isActive = $this->_getData('is_wishlist_active');
if ($isActive === null) {
$isActive = $this->_scopeConfig->getValue('wishlist/general/active', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH);
$this->setIsWishlistActive($isActive);
}
return $isActive;
}
示例13: _construct
/**
* Initialize review form
*
* @return void
*/
protected function _construct()
{
parent::_construct();
$this->setAllowWriteReviewFlag($this->httpContext->getValue(Context::CONTEXT_AUTH) || $this->_reviewData->getIsGuestAllowToWrite());
if (!$this->getAllowWriteReviewFlag()) {
$queryParam = $this->urlEncoder->encode($this->getUrl('*/*/*', ['_current' => true]) . '#review-form');
$this->setLoginLink($this->getUrl('customer/account/login/', [Url::REFERER_QUERY_PARAM_NAME => $queryParam]));
}
$this->setTemplate('form.phtml');
}
示例14: getCacheKeyInfo
/**
* Get Key pieces for caching block content
*
* @return array
*/
public function getCacheKeyInfo()
{
$shortCacheId = ['CATALOG_NAVIGATION', $this->_storeManager->getStore()->getId(), $this->_design->getDesignTheme()->getId(), $this->httpContext->getValue(Context::CONTEXT_GROUP), 'template' => $this->getTemplate(), 'name' => $this->getNameInLayout(), $this->getCurrentCategoryKey()];
$cacheId = $shortCacheId;
$shortCacheId = array_values($shortCacheId);
$shortCacheId = implode('|', $shortCacheId);
$shortCacheId = md5($shortCacheId);
$cacheId['category_path'] = $this->getCurrentCategoryKey();
$cacheId['short_cache_id'] = $shortCacheId;
return $cacheId;
}
示例15: _prepareLastOrder
/**
* Get last order ID from session, fetch it and check whether it can be viewed, printed etc
*
* @return void
*/
protected function _prepareLastOrder()
{
$orderId = $this->_checkoutSession->getLastOrderId();
if ($orderId) {
$order = $this->_orderFactory->create()->load($orderId);
if ($order->getId()) {
$isVisible = !in_array($order->getStatus(), $this->_orderConfig->getInvisibleOnFrontStatuses());
$canView = $this->httpContext->getValue(Context::CONTEXT_AUTH) && $isVisible;
$this->addData(['is_order_visible' => $isVisible, 'view_order_url' => $this->getUrl('sales/order/view/', ['order_id' => $orderId]), 'print_url' => $this->getUrl('sales/order/print', ['order_id' => $orderId]), 'can_print_order' => $isVisible, 'can_view_order' => $canView, 'order_id' => $order->getIncrementId()]);
}
}
}