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 + "=([^&] ...
随机推荐
- vs版本与.net framework 版本对应
vs2002 .net framework 1.0 vs2003 版本号:7.x .net framework 1.1 window server 2003 vs2005 版本号:8.x . ...
- JSP中,当页面为404或者500时。设置跳转到错误提示页面
最好的就是在WEB.XML文件中配置错误代码的跳转页面,首先建立个 出现500错误的页面,提示出错了,然后再WEB.XML文件中配置,配置如下 一. 通过错误码来配置error-page <er ...
- Android Fragment完全解析,关于碎片你所需知道的一切 (转)。
我们都知道,Android上的界面展示都是通过Activity实现的,Activity实在是太常用了,我相信大家都已经非常熟悉了,这里就不再赘述. 但是Activity也有它的局限性,同样的界面在手机 ...
- Oracle练习题20~33
20.查询score中选学多门课程的同学中分数为非最高分成绩的记录. 21. 查询成绩高于学号为“109”.课程号为“3-105”的成绩的所有记录. 22.查询和学号为108的同学同年出生的所有学生的 ...
- 采用EntLib5.0(Unity+Interception+Caching)实现项目中可用的Caching机制
看了园子里很多介绍Caching的文章,多数都只介绍基本机制,对于Cache更新和依赖部分,更是只简单的实现ICacheItemRefreshAction接口,这在实际项目中是远远不够的.实际项目中, ...
- "琳琅满屋"调查问卷 心得体会及结果分析
·关于心得体会 当时小组提出这个校园二手交易市场的时候,就确定了对象范围,仅仅是面向在校大学生,而且在我们之前就已经有了很多成功的商品交易的例子可以让我们去借鉴,再加上我们或多或少的有过网 ...
- ios 常用的小框架
在ios开发中,一些请求 kvc 下拉列表 图片请求等等自己手写代码的话非常麻烦,还容易出现一系列的问题,现在整理了一些常用的一些小框架. 其中MJExtension 和 MJRefresh 这两个 ...
- Flux Demo解析
最近学习了阮一峰老师的博文 "Flux入门教程",博文中详细介绍了Flux框架和Controller view模式,并提供了Demo,受益匪浅. 现特参考阮老师的Demo,绘制了一 ...
- 《day18_String练习_基本类型包装类_集合入门》
package cn.itcast.api.String.test; public class StringTest_1 { public static void main(String[] args ...
- hdu4283 区间dp
//Accepted 300 KB 0 ms //区间dp //dp[i][j] 表示i到j第一个出场的最小diaosizhi //对于i到j考虑元素i //(1)i第一个出场,diaosizhi为 ...