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 + "=([^&] ...
随机推荐
- Generic泛型
1.问题 未使用泛型时,元素的类型不安全:操作麻烦,可能需要强制转换import java.util.ArrayList;import java.util.List;import org.junit. ...
- cl.exe
http://blog.csdn.net/happyanger6/article/details/7589016
- BZOJ1722 [Usaco2006 Mar] Milk Team Select 产奶比赛
直接树形dp就好了恩 令$f[i][j][t]$表示以$i$为根的子树,选出来的点存在$j$对父子关系,$t$表示$i$这个点选或者没选,的最大产奶值 分类讨论自己和儿子分别有没有选,然后转移一下就好 ...
- java之代理模式
静态代理: java代理是一种模式--代理模式.采用代理模式,可以在不改变目标类代码的基础上,通过代理对象,来增加额外的功能(比如增加日志检测等)或者只需要目标对象的部分行为. java中,代理分为静 ...
- treap codevs 4543普通平衡树
#include<cstdio>#include<ctime>#include<cstdlib>struct shu{ int l,r,sum1,zhi,dui,s ...
- 利用dispatch_once创建单例
无论是爱还是恨,你都需要单例.实际上每个iOS或Mac OS应用都至少会有UIApplication或NSApplication. 什么是单例呢?Wikipedia是如此定义的: 在软件工程中,单例 ...
- excel的变量
因需要定制游戏的公式,公式是以一个系数乘以等级,我想达到修改系数,每个等级对应的值就立即显示出来, 但把系数写在一个单元格,一拉,系数单元格也会跟着增长行数--不是我想要的: 但只要把系数单元格改成变 ...
- Java中断言的使用(转)
相信学过c,c++的朋友一定不会对断言感到陌生.下面介绍一下断言在JAVA中的使用,JAVA是从JDK1.4才开始支持断言的(添加了关键字assert),请注意老版的JRE不支持. 断言概述 编写代码 ...
- 类成员函数作为pthread_create函数参数
from:http://www.cnblogs.com/shijingxiang/articles/5389294.html 近日需要将线程池封装成C++类,类名为Threadpool.在类的成员函数 ...
- matlab 画框(一)
matlab进行图像处理之后,很多时候需要在图像上画出矩形框:如,调用matlab的某个检测函数,得到结果之后,往往需要将检测结果的矩形框画在图像上,直观.方便的进行查看:下面的代码就是这个目的: f ...