magento获取页面url的办法还有magento的常用函数
<?php echo $this->getStoreUrl('checkout/cart');?>
获取结账页面的url:<?php echo $this->getUrl('checkout/cart');?>
magento的常用函数:
- //Get the path of your magento page.
- echo $this->getUrl('mypage');
- //Get the path of the image in your skin folder.
- echo $this->getSkinUrl('images/yourimage.gif');
- //Get the product link.
- echo $this->getProductData()->getProductUrl();
- //Get the product name.
- echo $this->htmlEscape($this->getProductData()->getName());
- //Call a static block in .phtml file.
- echo $this->getLayout()->createBlock('cms/block')->setBlockId('YOURBLOCKID')->toHtml();
- //Get Image url of current category.
- echo $this->getCurrentCategory()->getImageUrl();
- //Check whether the current category is Top category.
- echo $this->IsTopCategory();
- //Get description of current category.
- echo $this->getCurrentCategory()->getDescription();
- //Display products list page (list.phtml).
- echo $this->getProductListHtml();
- //Display CMS block page.
- echo $this->getCmsBlockHtml();
- //Get current store id.
- echo $storeId = Mage::app()->getStore()->getId();
- //Get current store name.
- echo $storeName = Mage::app()->getStore()->getName();
- //Get current store code.
- echo $storeCode = Mage::app()->getStore()->getCode();
- //Get website name.
- echo $websiteName = Mage::app()->getWebsite()->getName();
- //Get session id.
- echo $sessionId = Mage::getModel('core/session')->getSessionId();
- //Get customer id.
- echo $customerId = Mage::getModel('customer/session')->getCustomerId();
- //Get guest id.
- echo $vistitorId = Mage::getModel('core/session')->getVisitorId();
- Mage::getSingleton('customer/session')->isLoggedIn();
- Mage::getModel('coredate')-timestamp(time());
- //get Parent's Ids
- Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild( $childid );
- // 返回Ip地址的字符串格式:127.0.0.1
- echo Mage::helper('core/http')->getRemoteAddr();
- // 返回Ip地址的数值格式:2130706433
- echo Mage::helper('core/http')->getRemoteAddr(true);
magento获取页面url的办法还有magento的常用函数的更多相关文章
- js获取页面url的方法
我们可以用javascript获得其中的各个部分 1, window.location.href 整个URl字符串(在浏览器中就是完整的地址栏) 本例返回值: http://ifisker.com/b ...
- js获取页面url中的各项值
一. 通过window.location获取各项参数 1.获取页面完整的url url = window.location.href; 2.获取页面的域名 host = window.location ...
- Javascrip获取页面URL信息
使用Javascript可以方便获得页面的参数信息,常用的几种如下: 设置或获取对象指定的文件名或路径 window.location.pathname 设置或获取整个 URL 为字符串 wind ...
- JS获取页面URL信息
下面我们举例一个URL,然后获得它的各个组成部分: http://i.cnblogs.com/EditPosts.aspx?opt=1 window.location.href (设置或获取整个 UR ...
- 获取页面URL两种方式
以请求http://localhost:8080/doctor/demo?code=1为例 一:用java代码获取 //获取URL中的请求参数.即?后的条件 code=1 String querySt ...
- js获取页面url
设置或获取对象指定的文件名或路径. window.location.pathname例:http://localhost:8086/topic/index?topicId=361alert(windo ...
- jq获取页面url后边带的参数
//获取url后边的参数 $.getUrlParam = function (name) { var reg = new RegExp("(^|&) ...
- 获取页面url信息
方法: window.location.href = prefixURL+'webstatic/messageAnalysis/datadetail.html?id=' + num + "& ...
- 通过window.location.search获取页面url传递的参数
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...
随机推荐
- 快速将excel数据保存到Oracle数据库中【转】
我们在工作中,也许会碰到以下情况,客户或者同事发来需要调查的数据,并不是dmp文件,而是excel文件,此时通常是一张表,少量几条记录.最近我恰好碰到了这种情况,所以做了些调查,不敢藏私,拿出来跟大家 ...
- [整理]Svn常见问题汇总。
1.’.’ is not a working copy.Can’t open file‘.svn/entries’: 系统找不到指定的路径. 解答:原因是输入的访问路径不正确,如svn://192.1 ...
- [转]C# 应用程序安装部署步骤,安装前操作,先退出程序后卸载。
1. 点击[文件]-[新建]-[项目]-其他项目类型-安装和部署,选择安装项目,在下面的名称栏填写SetupTest(或者选择安装向导,一直点击[下一步])2. 安装项目----六个子项依次为:文件系 ...
- POJ 3687 逆序拓扑
额.题目大意:有N个球.编号和重量都是唯一不重复的.然后.给你m个pair a和b,表示编号为a的点一定比编号为b的点轻.然后捏.输出每个点对应的重量.关键是要求.如果有多种可能性的话,输出让序号小的 ...
- 作用域闭包、预解释和this关键字综合题目
var number = 2; var obj = {number : 5, fn1 : ( function() { this.number *= 2; number=number*2; var n ...
- UVa 10870 - Recurrences
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...
- CSU 1111 D(Contest #3)
有三户人家共拥有一座花园,每户人家的太太均需帮忙整理花园.A 太太工作了5 天,B 太太则工作了4 天,才将花园整理完毕.C 太太因为正身怀六甲无法加入她们的行列,便出了90元.请 ...
- ClassLoader相关内容
1.什么叫做bootstrap?作为形容词有依靠自己力量的:自己做的等意思,在我们计算机世界里,一般指的是自举,引导,引导程序. 那什么是bootstrapClassLoader呢?它是引导加载器,也 ...
- JSON.parse()和eval()区别
JSON.parse()只会将标准的Json字符串(key和value都由双引号引起来,最外面用单引号括住)转为JSON对象. eval()在转换字符串的时候是比较松的,即使不是标准的Json字符串也 ...
- Linux下screen命令
//1.列出当前的screenscreen -ls //2.新建一个screen,直接在命令行键入screen命令 screen -S [会话名称][root@www.lnuxidc.com ~]# ...