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 + "=([^&] ...
随机推荐
- Go语言并发与并行学习笔记(三)
转:http://blog.csdn.net/kjfcpua/article/details/18265475 Go语言并发的设计模式和应用场景 以下设计模式和应用场景来自Google IO上的关于G ...
- 推荐10款非常优秀的 HTML5 开发工具
HTML5 发展如火如荼,随着各大浏览器对 HTML5 技术支持的不断完善以及 HTML5 技术的不断成熟,未来 HTML5 必将改变我们创建 Web 应用程序的方式.今天这篇文章向大家推荐10款 ...
- C#入门篇6-6:字符串操作 StringBiulder string char[]之间的转化
//StringBiulder string char[]之间的转化 public static void Fun3() { StringBuilder sb = new StringBuilder( ...
- easyui datagrid高度自适应问题
最近在使用datagrid的时候,发现在panel中嵌入一个datagrid时,当panel缩小时,datagrid下面会有一块空白,datagrid高度不能自适应,解决方法是在datagrid外面加 ...
- 戴文的Linux内核专题:08内核配置(4)
转自Linux中国 这个第四部分里,我们将继续配置更多的设置和特性. 这里我们被问及关于"IBM Calgary IOMMU support (CALGARY_IOMMU)".这个 ...
- sql 语句中使用条件判断case then else end
sql 语句中使用条件判断case then else end范例: SELECT les.[nLessonNo] FROM BS_Lesson AS les WHERE les.[sClassCod ...
- SharePoint 2013 企业搜索架构示例
博客地址:http://blog.csdn.net/FoxDave 本文参考自微软官方的Chart,我们来看一下企业中对于不同规模SharePoint搜索的场的架构是什么样的. 对于搜索场的规模, ...
- JVM-运行时数据区
运行时数据区示意图 ...
- 网络数据的XML解析
网络应用中的数据解析,因为最近的应用,无论是Android的和ios平台的,一直用也是建议用的都是Json解析, xml解析都有点被遗忘了. 然后最近自己在做着玩一个ios的小应用,涉及网络数据的抓取 ...
- Note_Master-Detail Application(iOS template)_06_ YJYDetailViewController.h
// YJYDetailViewController.h #import <UIKit/UIKit.h> @interface YJYDetailViewController : UIV ...