Magento获取当前页面URL地址
http://www.sunhaibing.com/?p=1260
在Magento中,可以通过core/url助手类中的getCurrentUrl()方法获取当前页面的URL地址
$currentUrl
=
$this
->helper(
'core/url'
)->getCurrentUrl();
//在社会化分享中,当前页面的URL地址非常有用
<a addthis:url=
"<?php echo $this->helper('core/url')->getCurrentUrl(); ?>"
>Share on Facebook</a><span>
--------------------------------------------------
Magento得到当前页面的URL,得到当前产品页面的URL
http://blog.csdn.net/hipihi_0/article/details/7719381
<?PHP
//获取当前URL
echoMage::helper('core/url')—>getCurrentUrl();
//判断是否为首页
if(Mage::getSingleton('cms/page')->getIdentifier() =='home' && Mage::app()->getFrontController()->getRequest()->getRouteName() =='cms') :
//如果是1.4.x
if($this->getUrl('') ==$this->getUrl('*/*/*',array('_current'=>true,'_use_rewrite'=>true))):
echo"Homepage";
else:
echo"Not in Homepage";
endif;
?>
补充说明:
$this->helper('core/url')->getCurrentUrl();
--------------------------------------------------
Magento登陆之后返回登录之前的页面
http://www.zuimoban.com/php/magento/3018.html
在购物车页面添加登录框时我们往往不需要默认的跳转至“我的账户”页面,这个时候我们就需要进行设置Magento登陆之后返回登录之前的页面
在Cart页面添加
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_secure'=>true)));
或者
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::helper("core/url")->getCurrentUrl());
即可实现Magento登陆之后返回登录之前的页面