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 + "=([^&] ...
随机推荐
- Bag of mice(CodeForces 148D )
D. Bag of mice time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- BZOJ2708 [Violet 1]木偶
首先想到的是贪心...肯定不对嘛...T T 然后发现其实是可以DP的...不过我们要先排序 令f[i]表示前i个木偶最坏要丢掉几个,则 f[i] = max(f[j] + calc(j + 1, i ...
- POJ 3660
233333... Description: 就是说呢.牛是的实力室友大小之分的.然后呢.告诉你很多pair 表示任意两头牛之间的实力大小.按实力排序之后.问你一共有多少只牛的排名是确定了的. T_T ...
- SendMessage函数的常用消息及其应用大全
来源:http://www.360doc.com/content/09/0814/10/19147_4907488.shtml,非常全面的解释. 文本框控件通常用于输入和编辑文字.它属于标准 Wind ...
- 绑定本地Service并与之通信-----之一
import android.app.Service;import android.content.Intent;import android.os.Binder;import android.os. ...
- GFS: Evolution on Fast-forward
GFS: Evolution on Fast-forward by Marshall Kirk McKusick, Sean Quinlan | August 7, 2009 A discussion ...
- InLineHookSSDT
//当Ring3调用OpenProcess //1从自己的模块(.exe)的导入表中取值 //2Ntdll.dll模块的导出表中执行ZwOpenProcess(取索引 进入Ring0层) //3进入R ...
- 小记:利用递归调用循环寻找MP3文件的方法。
private void findMp3Data(File mp3file) { File[] filelist = mp3file.listFiles(); if (filelist != null ...
- 知名杀毒软件Mcafee(麦咖啡)个人版 资源汇总兼科普(来自卡饭)
虽然早已不是用咖啡了,但我也实时关注的咖啡的一举一动,潜水看帖日久,发现小白众多,好多有价值的帖子淹没于帖海当中,甚是惋惜. 我有如下建议 1.咖啡区管理层,能否吧一些优秀的资源教程 ...
- Phonegap hello world 不容易啊~!
今天一个项目要用phonegap,当初就是觉得phonegap配置太tmd的麻烦了,所以转头appcan,但今天项目必须用-- 先是看到官方说用nodejs装,tmd的,总是重复同一个错误,安装不起, ...