English 中文(简体)
在Magento的伐木后,将客户重新转向产品
原标题:Redirect customer back to product after login in Magento
  • 时间:2011-10-28 10:00:28
  •  标签:
  • magento

在Magento的客户记录出现违约时,这些记录被转至其账户页。

我将客户转回他们以前访问的产品/网页。

在Magento如何做到这一点? 我猜测,观察员应当是最佳办法,但我不知道从哪里开始。

问题回答
<a href="<?php echo Mage::getUrl( customer/account/login , array( referer  => Mage::helper( core )->urlEncode($this->helper( core/url )->getCurrentUrl())))?>" >Log In</a>

如果 customer锁的客户在你网站上的任何一页上,一旦他们点上了这个 anchor子,就会在他们成功登录后,被转往他们被点击 anchor的tag子上。

这是Magento原始“TopLink”逻辑中的Login链接的一种替代/模拟。

添加这些代码

<?php Mage::getSingleton( customer/session )->setBeforeAuthUrl($this->helper( core/url )->getCurrentUrl()); ?>

我已将马亨托标识带入一个灯箱,以便在网页上登出这一代码,然后将URL转介。 希望会有所助益。

<?php
   $current_url = $this->helper( core/url )->getCurrentUrl();
   $current_session = Mage::getSingleton( customer/session );
   if(isset($current_session)) $current_session->setData("before_auth_url", $current_url);
?> 

你们也可以把这一点放在头上,这样,它就会把之前的_auth_url放在每页上。 但是,确保你以一个条件完成这项工作,这样就没有把 before子放在 log子身上。 以下是我使用的守则。

<?php
if (! Mage::helper( customer )->isLoggedIn()) {
    $current_url = $this->helper( core/url )->getCurrentUrl();
    if((strpos($current_url,  login ) > -1) || (strpos($current_url,  sign-in ) > -1) || (strpos($current_url,  checkout ) > -1) ) {

    } else {
        $current_session = Mage::getSingleton( customer/session );
        if(isset($current_session)) $current_session->setData("before_auth_url", $current_url);
    }
}
?>

不是这样好的,而是行之有效的。

$redirectUrl = $_SERVER[ HTTP_REFERER ];
echo  <script>document.location.href=" . $redirectUrl .  ";</script> ;

http://www.magento commercial.com/magento-link/custom-login-re direct-pro.html” rel=“noestlow”>Coulmlogin Re direct Pro >。 您可以转而使用短式编号(}referer)。





相关问题
Magento addFieldToFilter allow NULLs

When using the Magento collection method addFieldToFilter is it possible to allow filtering by NULL values? I want to select all the products in a collection that have a custom attribute even if no ...

Get product link from Magento API

I am new to Magento and using their API. I need to be able to get the product url from the API call. I see that I can access the url_key and url_path, but unfortunately that s not necessarily what ...

magento extension installation

I want to install a Magento extension in WAMP, but not from the Magento connect system. How can I do this? I have the module (extension) code and I already installed the sample data in the Magento ...

Link to a specific step in onepage checkout

Is it possible to redirect the browser to nth step in the onepage checkout? If so, how would one go about doing it? I m working on a payment module and have a sort of "cancel" action that i would ...

How do I filter a collection by a YesNo type attribute?

I have a ‘featured’ attribute, which has a Yes/No select-list as the admin input. I presume that the values for Yes and No are 1 and 0, as they are for every other Yes/No list. However, if I try and ...

热门标签